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

Commit be8064ce authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Fix messed-up divider position when unlocking with IME showing

Bug was happening because we didn't account for the case where the device is unlocked with the IME showing. So the layout was properly being adjusted for IME, but the divider showing animation (applyDividerVisibility) was erroneously setting the divider's position back to the center of the screen afterwards.

Solution is for applyDividerVisibility() to update the full layout using updateSurfaceBounds() instead of just setting the position based on app bounds.

Fixes: 378620695
Flag: EXEMPT bugfix
Test: Bug no longer repros
Change-Id: Ieb7be52a015099addf8fff94edf693b198dfcd17
parent 7bc0eb3b
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -1876,11 +1876,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            mDividerFadeInAnimator.cancel();
        }

        mSplitLayout.getRefDividerBounds(mTempRect1);
        if (t != null) {
            updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */);
            t.setVisibility(dividerLeash, mDividerVisible);
            t.setLayer(dividerLeash, Integer.MAX_VALUE);
            t.setPosition(dividerLeash, mTempRect1.left, mTempRect1.top);
        } else if (mDividerVisible) {
            final SurfaceControl.Transaction transaction = mTransactionPool.acquire();
            mDividerFadeInAnimator = ValueAnimator.ofFloat(0f, 1f);
@@ -1900,11 +1898,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                        mDividerFadeInAnimator.cancel();
                        return;
                    }
                    mSplitLayout.getRefDividerBounds(mTempRect1);
                    updateSurfaceBounds(mSplitLayout, transaction, false /* applyResizingOffset */);
                    transaction.show(dividerLeash);
                    transaction.setAlpha(dividerLeash, 0);
                    transaction.setLayer(dividerLeash, Integer.MAX_VALUE);
                    transaction.setPosition(dividerLeash, mTempRect1.left, mTempRect1.top);
                    transaction.apply();
                }

+3 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.notNull;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -292,7 +293,8 @@ public class StageCoordinatorTests extends ShellTestCase {
    public void testFinishEnterSplitScreen_applySurfaceLayout() {
        mStageCoordinator.finishEnterSplitScreen(new SurfaceControl.Transaction());

        verify(mSplitLayout).applySurfaceChanges(any(), any(), any(), any(), any(), eq(false));
        verify(mSplitLayout, atLeastOnce())
                .applySurfaceChanges(any(), any(), any(), any(), any(), eq(false));
    }

    @Test