Loading core/java/android/view/ImeBackAnimationController.java +3 −1 Original line number Diff line number Diff line Loading @@ -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; } Loading core/tests/coretests/src/android/view/ImeBackAnimationControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -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)); Loading Loading
core/java/android/view/ImeBackAnimationController.java +3 −1 Original line number Diff line number Diff line Loading @@ -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; } Loading
core/tests/coretests/src/android/view/ImeBackAnimationControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -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)); Loading