WindowInsetsAnimation: Fix app driven closing of IME
When using controlWindowInsetsAnimation to close the IME,
delay reporting this to the IME until the animation is actually
finished. Otherwise, the IME will self-hide and start a transition
that breaks the just-begun app-driven transition.
(Regression from I7f6098a61a5942795ffd33a60329e4dd5fb5d6cb which
changed InputMethodService to hide itself in reponse to notifyHidden)
Bug: 151980214
Test: make WindowInsetsTests, ensure that dragging the IME closed doesnt get cancelled
Change-Id: If4e64cc78742a4e1e8c98137bd97d65dd567f674
(cherry picked from commit 3b19ff1e0f7a0c8b180c91e4227db48ab40c03af)
diff --git a/core/java/android/view/ImeInsetsSourceConsumer.java b/core/java/android/view/ImeInsetsSourceConsumer.java
index 35286ba..2461e96 100644
--- a/core/java/android/view/ImeInsetsSourceConsumer.java
+++ b/core/java/android/view/ImeInsetsSourceConsumer.java
@@ -16,7 +16,6 @@
package android.view;
-import static android.view.InsetsController.ANIMATION_TYPE_USER;
import static android.view.InsetsController.AnimationType;
import static android.view.InsetsState.ITYPE_IME;
@@ -104,13 +103,9 @@
void hide(boolean animationFinished, @AnimationType int animationType) {
super.hide();
- if (!animationFinished) {
- if (animationType == ANIMATION_TYPE_USER) {
- // if controlWindowInsetsAnimation is hiding keyboard.
- notifyHidden();
- }
- } else {
+ if (animationFinished) {
// remove IME surface as IME has finished hide animation.
+ notifyHidden();
removeSurface();
}
}