Do not recreate navigation bar for screen layout change
According to the document, the screenLayout can be changed if orientation is changed: If you want to manually handle orientation changes in your app you must declare the "orientation", "screenSize", and "screenLayout" values in the android:configChanges attributes. The activity configuration follows the behavior for years, so [1] makes the calculation of display screen layout (sent to application) consistent, instead of computing a smallest value. NavigationBar was configured to recreate if it detects a screen layout change, then it may trigger an additional display config change since [2] considers the insets of decor windows as a factor to affect screen size. The InterestingConfigChanges flags of NavigationBar was just reused from [3] which is not added for NavigationBar. So a simple redraw is enough for screen layout change, that is also more efficient. [1]: If806e2a42a6c3c548d93ba43c1aed69889901193 [2]: If966bcc8125300d47d5cd631f7db17ff027e5261 [3]: I48af51cc4694ba5c492794631a1e1a54a60fce0b Bug: 233855302 Test: Simulate screen layout change (LONG) of rotation adb shell wm size 720x1280 adb shell wm density 320 atest ConfigChangeTests#testRotation90NoRelaunch Test: Simulate large screen change (width>600dp) The navigation bar shows correctly with adb shell wm size 2600x2200 Switch navigation mode / rotate device. adb shell wm size reset Change-Id: I7c47faabc66ac117a8429ca4d856865e581e1a3d
Loading
Please register or sign in to comment