Reputation: 12643
In some new Android 7.0 firmwares there's an option to changes screen resolution (e.g. Android 7.0 firmware for S7 Edge has option to switch display resolution during runtime from qhd / fhd / hd).
My debugging attempts show that there's no config change coming (since my app properly handles language change, but not resolution change).
How to handle this kind of configuration change properly?
Upvotes: 2
Views: 2768
Reputation: 1542
I found that a non-documented flag density
is required to be set in configChanges
for the activity in Android 7 in order to survive the Screen Zoom.
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|fontScale|density"
Upvotes: 1
Reputation: 199805
Per the Screen Zoom documentation:
If an app targets API level 23 or lower, the system automatically kills all its background processes. This means that if a user switches away from such an app to open the Settings screen and changes the Display size setting, the system kills the app in the same manner that it would in a low-memory situation. If the app has any foreground processes, the system notifies those processes of the configuration change as described in Handling Runtime Changes, just as if the device's orientation had changed.
If an app targets Android 7.0, all of its processes (foreground and background) are notified of the configuration change as described in Handling Runtime Changes.
Similarly to handling configuration changes for multi-window, you should make sure you handle the following configChanges
:
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
Upvotes: 5