summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2021-09-21 23:39:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-09-21 23:39:02 +0000
commit509c8c269c1af150d559e77689a27e5dc75f928d (patch)
treea6144722558bd3d4cd26bf8719ec6f6b8b932890
parent44e5c9a0f5ba24dfc5ae54ae25a9c6d3e6e0ae22 (diff)
parent902aa77e4f72e69003a09dfea41169127cb6660b (diff)
Merge "Ignore rotations while the view is not yet attached" into sc-qpr1-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java1
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
index 5d37bff192eb..8e6eb02bb6f6 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
@@ -607,6 +607,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
public void destroyView() {
+ setAutoHideController(/* autoHideController */ null);
mCommandQueue.removeCallback(this);
mContext.getSystemService(WindowManager.class).removeViewImmediate(
mNavigationBarView.getRootView());
@@ -946,6 +947,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
@Override
public void onRotationProposal(final int rotation, boolean isValid) {
+ // The CommandQueue callbacks are added when the view is created to ensure we track other
+ // states, but until the view is attached (at the next traversal), the view's display is
+ // not valid. Just ignore the rotation in this case.
+ if (!mNavigationBarView.isAttachedToWindow()) return;
+
final int winRotation = mNavigationBarView.getDisplay().getRotation();
final boolean rotateSuggestionsDisabled = RotationButtonController
.hasDisable2RotateSuggestionFlag(mDisabledFlags2);
@@ -1525,7 +1531,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
/** Sets {@link AutoHideController} to the navigation bar. */
- public void setAutoHideController(AutoHideController autoHideController) {
+ private void setAutoHideController(AutoHideController autoHideController) {
mAutoHideController = autoHideController;
if (mAutoHideController != null) {
mAutoHideController.setNavigationBar(mAutoHideUiElement);
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
index b9e9240b354a..1628c71ae005 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
@@ -395,7 +395,6 @@ public class NavigationBarController implements Callbacks,
void removeNavigationBar(int displayId) {
NavigationBar navBar = mNavigationBars.get(displayId);
if (navBar != null) {
- navBar.setAutoHideController(/* autoHideController */ null);
navBar.destroyView();
mNavigationBars.remove(displayId);
}