Loading core/java/android/view/InsetsController.java +2 −3 Original line number Diff line number Diff line Loading @@ -1180,7 +1180,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation final InsetsSourceConsumer consumer = getSourceConsumer(internalTypes.valueAt(i)); boolean show = animationType == ANIMATION_TYPE_SHOW || animationType == ANIMATION_TYPE_USER; boolean canRun = false; boolean canRun = true; if (show) { // Show request if (fromIme) { Loading @@ -1190,7 +1190,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } switch(consumer.requestShow(fromIme)) { case ShowResult.SHOW_IMMEDIATELY: canRun = true; break; case ShowResult.IME_SHOW_DELAYED: imeReady = false; Loading @@ -1201,6 +1200,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation + fromIme); // IME cannot be shown (since it didn't have focus), proceed // with animation of other types. canRun = false; break; } } else { Loading @@ -1210,7 +1210,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (!fromIme) { consumer.notifyHidden(); } canRun = true; } if (!canRun) { if (WARN) Log.w(TAG, String.format( Loading core/tests/coretests/src/android/view/InsetsControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -929,6 +929,23 @@ public class InsetsControllerTest { }); } @Test public void testImeRequestedVisibleWhenImeNotControllable() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { // Simulate IME insets is not controllable mController.onControlsChanged(new InsetsSourceControl[0]); final InsetsSourceConsumer imeInsetsConsumer = mController.getSourceConsumer(ITYPE_IME); assertNull(imeInsetsConsumer.getControl()); // Verify IME requested visibility should be updated to IME consumer from controller. mController.show(ime()); assertTrue(imeInsetsConsumer.isRequestedVisible()); mController.hide(ime()); assertFalse(imeInsetsConsumer.isRequestedVisible()); }); } private void waitUntilNextFrame() throws Exception { final CountDownLatch latch = new CountDownLatch(1); Choreographer.getMainThreadInstance().postCallback(Choreographer.CALLBACK_COMMIT, Loading Loading
core/java/android/view/InsetsController.java +2 −3 Original line number Diff line number Diff line Loading @@ -1180,7 +1180,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation final InsetsSourceConsumer consumer = getSourceConsumer(internalTypes.valueAt(i)); boolean show = animationType == ANIMATION_TYPE_SHOW || animationType == ANIMATION_TYPE_USER; boolean canRun = false; boolean canRun = true; if (show) { // Show request if (fromIme) { Loading @@ -1190,7 +1190,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } switch(consumer.requestShow(fromIme)) { case ShowResult.SHOW_IMMEDIATELY: canRun = true; break; case ShowResult.IME_SHOW_DELAYED: imeReady = false; Loading @@ -1201,6 +1200,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation + fromIme); // IME cannot be shown (since it didn't have focus), proceed // with animation of other types. canRun = false; break; } } else { Loading @@ -1210,7 +1210,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (!fromIme) { consumer.notifyHidden(); } canRun = true; } if (!canRun) { if (WARN) Log.w(TAG, String.format( Loading
core/tests/coretests/src/android/view/InsetsControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -929,6 +929,23 @@ public class InsetsControllerTest { }); } @Test public void testImeRequestedVisibleWhenImeNotControllable() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { // Simulate IME insets is not controllable mController.onControlsChanged(new InsetsSourceControl[0]); final InsetsSourceConsumer imeInsetsConsumer = mController.getSourceConsumer(ITYPE_IME); assertNull(imeInsetsConsumer.getControl()); // Verify IME requested visibility should be updated to IME consumer from controller. mController.show(ime()); assertTrue(imeInsetsConsumer.isRequestedVisible()); mController.hide(ime()); assertFalse(imeInsetsConsumer.isRequestedVisible()); }); } private void waitUntilNextFrame() throws Exception { final CountDownLatch latch = new CountDownLatch(1); Choreographer.getMainThreadInstance().postCallback(Choreographer.CALLBACK_COMMIT, Loading