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

Commit 91d05ae6 authored by Heemin Seog's avatar Heemin Seog
Browse files

Adjust window focusable by view controller

Some adjustments to note:
1. remove previous focusability changes per view controller
2. disallow calling insetsController.show/hide without window focus
3. update tests to depend on window focus
4. update DisplaySystemBarsController to refer to parent class for ime
insets

Bug: 163135884
Test: manual, atest :carsysui-presubmit
Change-Id: If5adf599bc2c676ad296f89566534c1fdc9f2492
parent c634b35b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -178,7 +178,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
        }
    }

    class PerDisplay extends IDisplayWindowInsetsController.Stub {
    /** An implementation of {@link IDisplayWindowInsetsController} for a given display id. */
    public class PerDisplay extends IDisplayWindowInsetsController.Stub {
        final int mDisplayId;
        final InsetsState mInsetsState = new InsetsState();
        InsetsSourceControl mImeSourceControl = null;
@@ -189,7 +190,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
        final Rect mImeFrame = new Rect();
        boolean mAnimateAlpha = true;

        PerDisplay(int displayId, int initialRotation) {
        public PerDisplay(int displayId, int initialRotation) {
            mDisplayId = displayId;
            mRotation = initialRotation;
        }
+1 −4
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ public class CarKeyguardViewController extends OverlayViewController implements
    }

    @Override
    protected boolean shouldShowNavigationBar() {
    protected boolean shouldShowNavigationBarInsets() {
        return true;
    }

@@ -158,7 +158,6 @@ public class CarKeyguardViewController extends OverlayViewController implements
        mKeyguardStateController.notifyKeyguardState(mShowing, /* occluded= */ false);
        mCarNavigationBarController.showAllKeyguardButtons(/* isSetUp= */ true);
        start();
        getOverlayViewGlobalStateController().setWindowFocusable(/* focusable= */ true);
        reset(/* hideBouncerWhenShowing= */ false);
        notifyKeyguardUpdateMonitor();
    }
@@ -173,7 +172,6 @@ public class CarKeyguardViewController extends OverlayViewController implements
        mBouncer.hide(/* destroyView= */ true);
        mCarNavigationBarController.hideAllKeyguardButtons(/* isSetUp= */ true);
        stop();
        getOverlayViewGlobalStateController().setWindowFocusable(/* focusable= */ false);
        mKeyguardStateController.notifyKeyguardDoneFading();
        mHandler.post(mViewMediatorCallback::keyguardGone);
        notifyKeyguardUpdateMonitor();
@@ -218,7 +216,6 @@ public class CarKeyguardViewController extends OverlayViewController implements
    public void onCancelClicked() {
        if (mBouncer == null) return;

        getOverlayViewGlobalStateController().setWindowFocusable(/* focusable= */ false);
        getOverlayViewGlobalStateController().setWindowNeedsInput(/* needsInput= */ false);

        mBouncer.hide(/* destroyView= */ true);
+2 −2
Original line number Diff line number Diff line
@@ -193,12 +193,12 @@ public class NotificationPanelViewController extends OverlayPanelViewController
    }

    @Override
    protected boolean shouldShowNavigationBar() {
    protected boolean shouldShowNavigationBarInsets() {
        return true;
    }

    @Override
    protected boolean shouldShowStatusBar() {
    protected boolean shouldShowStatusBarInsets() {
        return true;
    }

+5 −0
Original line number Diff line number Diff line
@@ -77,6 +77,11 @@ public class FullScreenUserSwitcherViewController extends OverlayViewController
        registerCarUserManagerIfPossible();
    }

    @Override
    protected boolean shouldFocusWindow() {
        return false;
    }

    @Override
    protected void showInternal() {
        getLayout().setVisibility(View.VISIBLE);
+0 −2
Original line number Diff line number Diff line
@@ -238,7 +238,6 @@ public abstract class OverlayPanelViewController extends OverlayViewController {
        }

        onAnimateCollapsePanel();
        getOverlayViewGlobalStateController().setWindowFocusable(false);
        animatePanel(mClosingVelocity, /* isClosing= */ true);
    }

@@ -415,7 +414,6 @@ public abstract class OverlayPanelViewController extends OverlayViewController {
            getOverlayViewGlobalStateController().hideView(/* panelViewController= */ this);
        }
        getLayout().setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        getOverlayViewGlobalStateController().setWindowFocusable(visible);
    }

    /* ***************************************************************************************** *
Loading