I'm updating my Android apps to support multi-window mode in Android 7. Since the apps already handle rotation changes in onConfigurationChanged, I want to handle window size changes the same way. So, I've updated AndroidManifest.xml to include android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout"
for my activities.
This works as expected when resizing the windows so my app takes up 2/3 or 1/2 of the screen: onConfigurationChanged is called, and my activity is not restarted. But when I resize my app to or from the 1/3 screen size (so my app takes only 1/3 of the screen and another app takes the remaining 2/3), the app behaves as if I didn't have those configChanges values: onConfigurationChanged is not called, and my activity is restarted.
I checked the possible values for configChanges, but didn't see anything else that looked relevant.
Is there any reason for it to work this way, or is this an Android bug? I'm running Android 7.1.2 on a Google Pixel C tablet.
Per the Preparing for multi-window blog post, the minimal set of
configChanges
you need to handle multi-window is:You are missing
smallestScreenSize
, which occurs when the smallest width of your Activity changes.