diff options
| author | 2024-12-05 15:27:59 +0000 | |
|---|---|---|
| committer | 2024-12-06 08:11:53 +0000 | |
| commit | 0d1d1c3515c775554982cb79edacd53be065d95f (patch) | |
| tree | dc4675963daf50dc68745ebe2ffaf076d272613f | |
| parent | d8dacaf6582c007dd1d69027c36bd1ee4b192f15 (diff) | |
Update layout position in SplitLayout (hide IME) without imeLayeringTarget
In case of having an app that set STATE_ALWAYS_HIDDEN, a hide IME call is triggered by losing window focus, e.g. when locking the screen. This also resets the imeLayeringTarget and therefore SplitLayout will ignore all updates from DisplayImeController. After unlocking the screen, the IME was hidden, was the window positions not updated (blank space at the bottom).
This CL enables SplitLayout to take the changed into account (in case of a hide animation), also if there is no imeFocus.
Test: manual: open any app (top) and Chrome (lower window), focus Chrome search bar, lock screen, unlock (without having screen lock set)
Bug: 379792779
Flag: android.view.inputmethod.refactor_insets_controller
Change-Id: Iec0efe101410938bdeb053d4e86dcc325ad43778
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java | 11 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java | 17 |
2 files changed, 22 insertions, 6 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java index 38b859220256..2d00ab096b47 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java @@ -415,9 +415,14 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged // already (e.g., when focussing an editText in activity B, while and editText in // activity A is focussed), we will not get a call of #insetsControlChanged, and // therefore have to start the show animation from here - startAnimation(mImeRequestedVisible /* show */, false /* forceRestart */); - - setVisibleDirectly(mImeRequestedVisible || mAnimation != null, statsToken); + startAnimation(mImeRequestedVisible /* show */, false /* forceRestart */, + statsToken); + + // In case of a hide, the statsToken should not been send yet (as the animation + // is still ongoing). It will be sent at the end of the animation + boolean hideAnimOngoing = !mImeRequestedVisible && mAnimation != null; + setVisibleDirectly(mImeRequestedVisible || mAnimation != null, + hideAnimOngoing ? null : statsToken); } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java index 1852cda7e804..e6b6ef737f6e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java @@ -1560,7 +1560,9 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange final int imeTargetPosition = getImeTargetPosition(); mHasImeFocus = imeTargetPosition != SPLIT_POSITION_UNDEFINED; if (!mHasImeFocus) { - return 0; + if (!android.view.inputmethod.Flags.refactorInsetsController() || showing) { + return 0; + } } mStartImeTop = showing ? hiddenTop : shownTop; @@ -1613,7 +1615,11 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange @Override public void onImePositionChanged(int displayId, int imeTop, SurfaceControl.Transaction t) { - if (displayId != mDisplayId || !mHasImeFocus) return; + if (displayId != mDisplayId || !mHasImeFocus) { + if (!android.view.inputmethod.Flags.refactorInsetsController() || mImeShown) { + return; + } + } onProgress(getProgress(imeTop)); mSplitLayoutHandler.onLayoutPositionChanging(SplitLayout.this); } @@ -1621,7 +1627,12 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange @Override public void onImeEndPositioning(int displayId, boolean cancel, SurfaceControl.Transaction t) { - if (displayId != mDisplayId || !mHasImeFocus || cancel) return; + if (displayId != mDisplayId || cancel) return; + if (!mHasImeFocus) { + if (!android.view.inputmethod.Flags.refactorInsetsController() || mImeShown) { + return; + } + } ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Split IME animation ending, canceled=%b", cancel); onProgress(1.0f); |