Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06e83fd1 authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Ignore rotations while the view is not yet attached" into sc-v2-dev am:...

Merge "Ignore rotations while the view is not yet attached" into sc-v2-dev am: e2907ad2 am: c2798317

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15391837

Change-Id: I871678a8071d42952e0f80c25338b712d4797808
parents c5c57261 c2798317
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -597,6 +597,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
    }

    public void destroyView() {
        setAutoHideController(/* autoHideController */ null);
        mCommandQueue.removeCallback(this);
        mContext.getSystemService(WindowManager.class).removeViewImmediate(
                mNavigationBarView.getRootView());
@@ -919,6 +920,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);
@@ -1484,7 +1490,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);
+0 −1
Original line number Diff line number Diff line
@@ -402,7 +402,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);
        }