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

Commit d89efebc authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Reset visibility before creating leash

Otherwise we create the leash with visibility=shown before the
client can update it, creating a flicker.

Test: Open IME, go home, observe no flicker
Bug: 111084606
Change-Id: I38eadaef79c27036edf5a86b773f6695d463db5c
parent 92fd2908
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ public class InsetsSourceConsumer {
        mState = state;
        mTransactionSupplier = transactionSupplier;
        mController = controller;
        mVisible = InsetsState.getDefaultVisibly(type);
        mVisible = InsetsState.getDefaultVisibility(type);
    }

    public void setControl(@Nullable InsetsSourceControl control) {
+1 −1
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ public class InsetsState implements Parcelable {
        }
    }

    public static boolean getDefaultVisibly(@InsetType int type) {
    public static boolean getDefaultVisibility(@InsetType int type) {
        switch (type) {
            case TYPE_TOP_BAR:
            case TYPE_SIDE_BAR_1:
+5 −5
Original line number Diff line number Diff line
@@ -155,10 +155,10 @@ public class InsetsStateTest {

    @Test
    public void testGetDefaultVisibility() {
        assertTrue(InsetsState.getDefaultVisibly(TYPE_TOP_BAR));
        assertTrue(InsetsState.getDefaultVisibly(TYPE_SIDE_BAR_1));
        assertTrue(InsetsState.getDefaultVisibly(TYPE_SIDE_BAR_2));
        assertTrue(InsetsState.getDefaultVisibly(TYPE_SIDE_BAR_3));
        assertFalse(InsetsState.getDefaultVisibly(TYPE_IME));
        assertTrue(InsetsState.getDefaultVisibility(TYPE_TOP_BAR));
        assertTrue(InsetsState.getDefaultVisibility(TYPE_SIDE_BAR_1));
        assertTrue(InsetsState.getDefaultVisibility(TYPE_SIDE_BAR_2));
        assertTrue(InsetsState.getDefaultVisibility(TYPE_SIDE_BAR_3));
        assertFalse(InsetsState.getDefaultVisibility(TYPE_IME));
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ class InsetsSourceProvider {

    InsetsSourceProvider(InsetsSource source, InsetsStateController stateController,
            DisplayContent displayContent) {
        mClientVisible = InsetsState.getDefaultVisibly(source.getType());
        mClientVisible = InsetsState.getDefaultVisibility(source.getType());
        mSource = source;
        mDisplayContent = displayContent;
        mStateController = stateController;
@@ -153,6 +153,7 @@ class InsetsSourceProvider {
            return;
        }
        mAdapter = new ControlAdapter();
        setClientVisible(InsetsState.getDefaultVisibility(mSource.getType()));
        mWin.startAnimation(mDisplayContent.getPendingTransaction(), mAdapter,
                !mClientVisible /* hidden */);
        mControllingWin = target;
@@ -219,7 +220,7 @@ class InsetsSourceProvider {
        public void onAnimationCancelled(SurfaceControl animationLeash) {
            if (mAdapter == this) {
                mStateController.notifyControlRevoked(mControllingWin, InsetsSourceProvider.this);
                setClientVisible(InsetsState.getDefaultVisibly(mSource.getType()));
                setClientVisible(InsetsState.getDefaultVisibility(mSource.getType()));
                mControl = null;
                mControllingWin = null;
                mAdapter = null;