Get correct insets of the phone screen at boot

Before places such as
DockedStackDividerController.initSnapAlgorithmForRotations() tries to
run getStableInsetsLw() will get no insets on boot (via
onConfigurationChanged) because the navigationbar and statusbar have not
been added yet. This would leads to some miscalculations until
configuration changes such as rotating the screen.

Test: manual - logged the inset values on bootup with adb logcat
Change-Id: If07c8c007cb355dc418ff987fbb36ce104192379
This commit is contained in:
Matthew Ng
2016-12-13 16:55:09 -08:00
parent 5686ade06c
commit ca4c1a34fd

View File

@@ -6674,9 +6674,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Navigation bar and status bar.
getNonDecorInsetsLw(displayRotation, displayWidth, displayHeight, outInsets);
if (mStatusBar != null) {
outInsets.top = mStatusBarHeight;
}
outInsets.top = mStatusBarHeight;
}
@Override
@@ -6685,7 +6683,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
outInsets.setEmpty();
// Only navigation bar
if (mNavigationBar != null) {
if (mHasNavigationBar) {
int position = navigationBarPosition(displayWidth, displayHeight, displayRotation);
if (position == NAV_BAR_BOTTOM) {
outInsets.bottom = getNavigationBarHeight(displayRotation, mUiMode);