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

Commit a6c2ad9f authored by Tiger's avatar Tiger
Browse files

Let InsetsStateController apply mPendingControlTarget

When mPendingControlTarget is ready to be the real control target,
InsetsSourceProvider should ask InsetsStateController to update it
instead of updating it silently. Otherwise, mControlTargetProvidersMap
and InsetsSourceProvider#mControlTarget might be not synchronized.

Fix: 340445972
Flag: NA
Test: atest InsetsStateControllerTest
Change-Id: I3dd255fd11a7affe575299a09d28435ea986fdc7
parent 412a1d55
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -198,7 +198,7 @@ class InsetsSourceProvider {
            if (mControllable) {
            if (mControllable) {
                mWindowContainer.setControllableInsetProvider(this);
                mWindowContainer.setControllableInsetProvider(this);
                if (mPendingControlTarget != mControlTarget) {
                if (mPendingControlTarget != mControlTarget) {
                    updateControlForTarget(mPendingControlTarget, true /* force */);
                    mStateController.notifyControlTargetChanged(mPendingControlTarget, this);
                }
                }
            }
            }
        }
        }
+11 −0
Original line number Original line Diff line number Diff line
@@ -352,6 +352,17 @@ public class InsetsStateControllerTest extends WindowTestsBase {
        assertNull(getController().getControlsForDispatch(app));
        assertNull(getController().getControlsForDispatch(app));
    }
    }


    @Test
    public void testControlTargetChangedWhileProviderHasNoWindow() {
        final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
        final InsetsSourceProvider provider = getController().getOrCreateSourceProvider(
                ID_STATUS_BAR, statusBars());
        getController().onBarControlTargetChanged(app, null, null, null);
        assertNull(getController().getControlsForDispatch(app));
        provider.setWindowContainer(createWindow(null, TYPE_APPLICATION, "statusBar"), null, null);
        assertNotNull(getController().getControlsForDispatch(app));
    }

    @Test
    @Test
    public void testTransientVisibilityOfFixedRotationState() {
    public void testTransientVisibilityOfFixedRotationState() {
        final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
        final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");