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

Commit 9df67487 authored by Calvin Huang's avatar Calvin Huang
Browse files

Fix immersive mode for seahawk_car_ui_portrait

config_remoteInsetsControllerControlsSystemBars field is not read
correctly on seahawk_car_ui_portrait due to the rro kicks in after
InsetPolicy init.
So update it in DisplayPolicy#onConfigurationChanged

Bug: 270747068
Test: atest InsetsPolicyTest
Change-Id: I8276ae9e73dc3df15fd403b39cc9647ef04d3d6e
parent a2430203
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -198,6 +198,11 @@ public class DisplayPolicy {

    private boolean mCanSystemBarsBeShownByUser;

    /**
     * Let remote insets controller control system bars regardless of other settings.
     */
    private boolean mRemoteInsetsControllerControlsSystemBars;

    StatusBarManagerInternal getStatusBarManagerInternal() {
        synchronized (mServiceAcquireLock) {
            if (mStatusBarManagerInternal == null) {
@@ -781,6 +786,17 @@ public class DisplayPolicy {
        return mScreenOnListener;
    }


    boolean isRemoteInsetsControllerControllingSystemBars() {
        return mRemoteInsetsControllerControlsSystemBars;
    }

    @VisibleForTesting
    void setRemoteInsetsControllerControlsSystemBars(
            boolean remoteInsetsControllerControlsSystemBars) {
        mRemoteInsetsControllerControlsSystemBars = remoteInsetsControllerControlsSystemBars;
    }

    public void screenTurnedOn(ScreenOnListener screenOnListener) {
        synchronized (mLock) {
            mScreenOnEarly = true;
@@ -1664,6 +1680,8 @@ public class DisplayPolicy {
        mRightGestureInset = mGestureNavigationSettingsObserver.getRightSensitivity(res);
        mNavigationBarAlwaysShowOnSideGesture =
                res.getBoolean(R.bool.config_navBarAlwaysShowOnSideEdgeGesture);
        mRemoteInsetsControllerControlsSystemBars = res.getBoolean(
                R.bool.config_remoteInsetsControllerControlsSystemBars);

        updateConfigurationAndScreenSizeDependentBehaviors();

@@ -2553,7 +2571,7 @@ public class DisplayPolicy {
        pw.print(mForceShowNavigationBarEnabled);
        pw.print(" mAllowLockscreenWhenOn="); pw.println(mAllowLockscreenWhenOn);
        pw.print(prefix); pw.print("mRemoteInsetsControllerControlsSystemBars=");
        pw.println(mDisplayContent.getInsetsPolicy().getRemoteInsetsControllerControlsSystemBars());
        pw.println(mRemoteInsetsControllerControlsSystemBars);
        pw.print(prefix); pw.println("mDecorInsetsInfo:");
        for (int rotation = 0; rotation < mDecorInsets.mInfoForRotation.length; rotation++) {
            final DecorInsets.Info info = mDecorInsets.mInfoForRotation[rotation];
+2 −19
Original line number Diff line number Diff line
@@ -116,11 +116,6 @@ class InsetsPolicy {
    private @InsetsType int mShowingTransientTypes;
    private boolean mAnimatingShown;

    /**
     * Let remote insets controller control system bars regardless of other settings.
     */
    private boolean mRemoteInsetsControllerControlsSystemBars;

    private final boolean mHideNavBarForKeyboard;
    private final float[] mTmpFloat9 = new float[9];

@@ -129,22 +124,9 @@ class InsetsPolicy {
        mDisplayContent = displayContent;
        mPolicy = displayContent.getDisplayPolicy();
        final Resources r = mPolicy.getContext().getResources();
        mRemoteInsetsControllerControlsSystemBars = r.getBoolean(
                R.bool.config_remoteInsetsControllerControlsSystemBars);
        mHideNavBarForKeyboard = r.getBoolean(R.bool.config_hideNavBarForKeyboard);
    }

    boolean getRemoteInsetsControllerControlsSystemBars() {
        return mRemoteInsetsControllerControlsSystemBars;
    }

    /**
     * Used only for testing.
     */
    @VisibleForTesting
    void setRemoteInsetsControllerControlsSystemBars(boolean controlsSystemBars) {
        mRemoteInsetsControllerControlsSystemBars = controlsSystemBars;
    }

    /** Updates the target which can control system bars. */
    void updateBarControlTarget(@Nullable WindowState focusedWin) {
@@ -625,7 +607,8 @@ class InsetsPolicy {
        if (focusedWin == null) {
            return false;
        }
        if (!mRemoteInsetsControllerControlsSystemBars) {

        if (!mPolicy.isRemoteInsetsControllerControllingSystemBars()) {
            return false;
        }
        if (mDisplayContent == null || mDisplayContent.mRemoteInsetsControlTarget == null) {
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class InsetsPolicyTest extends WindowTestsBase {
    @Test
    public void testControlsForDispatch_remoteInsetsControllerControlsBars_appHasNoControl() {
        mDisplayContent.setRemoteInsetsController(createDisplayWindowInsetsController());
        mDisplayContent.getInsetsPolicy().setRemoteInsetsControllerControlsSystemBars(true);
        mDisplayContent.getDisplayPolicy().setRemoteInsetsControllerControlsSystemBars(true);
        addStatusBar();
        addNavigationBar();

+1 −1
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
        beforeCreateTestDisplay();
        mDisplayContent = createNewDisplayWithImeSupport(DISPLAY_IME_POLICY_LOCAL);
        addCommonWindows(annotation.addAllCommonWindows(), annotation.addWindows());
        mDisplayContent.getInsetsPolicy().setRemoteInsetsControllerControlsSystemBars(false);
        mDisplayContent.getDisplayPolicy().setRemoteInsetsControllerControlsSystemBars(false);

        // Adding a display will cause freezing the display. Make sure to wait until it's
        // unfrozen to not run into race conditions with the tests.