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

Commit 2ff61aaf authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Fix IME not hidden by back gesture in split screen

Bug: 322836622
Flag: android.view.inputmethod.predictive_back_ime STAGING
Test: atest FrameworksCoreTests:ImeBackAnimationControllerTest
Change-Id: Ie95363dd5b414dbaaa73782c2ffe256fb3ba8226
parent c78496f9
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));