diff options
| author | Tarandeep Singh <tarandeep@google.com> | 2020-02-20 17:51:18 -0800 |
|---|---|---|
| committer | Taran Singh <tarandeep@google.com> | 2020-02-28 19:33:11 +0000 |
| commit | b9538cdfffdc14ba99fa6b3445a8797794738de2 (patch) | |
| tree | 3a60ae77fddfb29156e0217441d44b70fd70c9ae /core/java/android/view/ImeInsetsSourceConsumer.java | |
| parent | 73b1d16d283175c4e19c5112136f7b53ccb59f34 (diff) | |
Fix controlWindowInsets for IME
If IME is already visible, requestShow() is immediate.
If animation is finishing and IME is hiding, notify IME process of the
visibility.
Bug: 111084606
Test: Use test app [1] and verify that swiping up and down multiple
times opens and closes the IME respectively.
[1] I4320871bdc8184fac38921616e1a1322f8dbc804
Change-Id: Icf202b56c0bc3833e86ee70c43fedd418e27b140
Diffstat (limited to 'core/java/android/view/ImeInsetsSourceConsumer.java')
| -rw-r--r-- | core/java/android/view/ImeInsetsSourceConsumer.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/view/ImeInsetsSourceConsumer.java b/core/java/android/view/ImeInsetsSourceConsumer.java index 43afc15072ce..35286ba007c4 100644 --- a/core/java/android/view/ImeInsetsSourceConsumer.java +++ b/core/java/android/view/ImeInsetsSourceConsumer.java @@ -16,6 +16,8 @@ package android.view; +import static android.view.InsetsController.ANIMATION_TYPE_USER; +import static android.view.InsetsController.AnimationType; import static android.view.InsetsState.ITYPE_IME; import android.annotation.Nullable; @@ -99,9 +101,15 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { } @Override - void hide(boolean animationFinished) { + void hide(boolean animationFinished, @AnimationType int animationType) { super.hide(); - if (animationFinished) { + + if (!animationFinished) { + if (animationType == ANIMATION_TYPE_USER) { + // if controlWindowInsetsAnimation is hiding keyboard. + notifyHidden(); + } + } else { // remove IME surface as IME has finished hide animation. removeSurface(); } @@ -118,7 +126,8 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { // If we had a request before to show from IME (tracked with mImeRequestedShow), reaching // this code here means that we now got control, so we can start the animation immediately. - if (fromIme || mImeRequestedShow) { + // If client window is trying to control IME and IME is already visible, it is immediate. + if (fromIme || mImeRequestedShow || mState.getSource(getType()).isVisible()) { mImeRequestedShow = false; return ShowResult.SHOW_IMMEDIATELY; } |
