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

Commit 7ede1a66 authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Android (Google) Code Review
Browse files

Merge "Fix IME not hidden by back gesture in split screen" into main

parents 5281d674 2ff61aaf
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -134,7 +134,9 @@ public class ImeBackAnimationController implements OnBackAnimationCallback {

    @Override
    public void onBackInvoked() {
        if (!isBackAnimationAllowed()) {
        if (!isBackAnimationAllowed() || !mIsPreCommitAnimationInProgress) {
            // play regular hide animation if back-animation is not allowed or if insets control has
            // been cancelled by the system (this can happen in split screen for example)
            mInsetsController.hide(ime());
            return;
        }
+17 −0
Original line number Diff line number Diff line
@@ -241,6 +241,23 @@ public class ImeBackAnimationControllerTest {
        });
    }

    @Test
    public void testOnBackInvokedHidesImeEvenIfInsetsControlCancelled() {
        InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
            // start back gesture
            WindowInsetsAnimationControlListener animationControlListener = startBackGesture();

            // simulate ImeBackAnimationController not receiving control (e.g. due to split screen)
            animationControlListener.onCancelled(mWindowInsetsAnimationController);

            // commit back gesture
            mBackAnimationController.onBackInvoked();

            // verify that InsetsController#hide is called
            verify(mInsetsController, times(1)).hide(ime());
        });
    }

    private WindowInsetsAnimationControlListener startBackGesture() {
        // start back gesture
        mBackAnimationController.onBackStarted(new BackEvent(0f, 0f, 0f, EDGE_LEFT));