diff options
| author | Ming-Shin Lu <lumark@google.com> | 2021-03-17 12:33:15 +0800 |
|---|---|---|
| committer | Ming-Shin Lu <lumark@google.com> | 2021-03-22 18:52:21 +0800 |
| commit | 5a810c8403eeafc6e86084c6b0ce11c96908a30d (patch) | |
| tree | 8884e7ed4fadd093d1d4497d8938bfcaf5267593 /core/java/android/view/ViewRootImpl.java | |
| parent | 39217229c8040f9e313c47ac29514c38b23a4298 (diff) | |
Don't skip IME animation when backed to Task has no editor focus
When the dialer app previously shows IME, if the user swipe out the
dialer task to launcher or switching task and then navigating back
to dialer task, will see IME surface will fade-out because the
editor view has been cleared the focus.
The issue happens when user taping editText to show keyboard and
the IME show animaion will be skipped.
It could be related the CL[1] that we skip the animation once
when the task snapshot has the IME surface, but we should not
skip IME show animation if the launching task has been cleared
the editor focus.
[1]: I83ffc03119e01da71ad12f8ad8043cf0730dfd50
Fix: 183347520
Bug: 166736352
Test: manual as steps in commit message
Test: atest ImeInsetsSourceConsumerTest#\
testImeGetAndClearSkipAnimationOnce_expectNoSkip
Change-Id: Ib140801f1ce03b5566e756914f96dacba3ad8892
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index e4fb61107c4a..a56f6b7e0f59 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -3354,8 +3354,9 @@ public final class ViewRootImpl implements ViewParent, } // TODO (b/131181940): Make sure this doesn't leak Activity with mActivityConfigCallback // config changes. + final View focusedView = mView != null ? mView.findFocus() : null; if (hasWindowFocus) { - mInsetsController.onWindowFocusGained(); + mInsetsController.onWindowFocusGained(focusedView != null /* hasViewFocused */); } else { mInsetsController.onWindowFocusLost(); } @@ -3404,8 +3405,7 @@ public final class ViewRootImpl implements ViewParent, // Note: must be done after the focus change callbacks, // so all of the view state is set up correctly. - mImeFocusController.onPostWindowFocus(mView != null ? mView.findFocus() : null, - hasWindowFocus, mWindowAttributes); + mImeFocusController.onPostWindowFocus(focusedView, hasWindowFocus, mWindowAttributes); if (hasWindowFocus) { // Clear the forward bit. We can just do this directly, since |
