From 6d17d410f91658ad235eeca87cf6e22e48f51e64 Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Fri, 12 Mar 2021 00:09:54 +0800 Subject: [PATCH] Prevent caching unexpected IME shown state for legacy split Due to DisplayImeController listens to insetsChanged and display rotation at all time, it might caching unexpected IME shown state in DividerImeController. Since RemoteInsetsControllerTarget only controlling insets during split mode, it won't receive hideInsets event when the target app request to hide IME. Thus leaving unexpected IME state in split component. When the next time entering split screen, it'll adjust split layout with wrong IME state. Update to not caching IME shown state in DividerImeController if the split is not activated. Bug: 176846448 Test: atest WMShellUnitTests Test: open IME and rotate and dock two apps in split mode, observed the divider bar is interactable and there's no dim layer on the secondary split Change-Id: I2f63eebb208b8c987a0a05615ddef4f6feef10d6 --- .../wm/shell/legacysplitscreen/DividerImeController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/DividerImeController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/DividerImeController.java index 7ce9014fc9baf..57a9dd2ec6cc1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/DividerImeController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/DividerImeController.java @@ -143,14 +143,14 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor @ImeAnimationFlags public int onImeStartPositioning(int displayId, int hiddenTop, int shownTop, boolean imeShouldShow, boolean imeIsFloating, SurfaceControl.Transaction t) { - mHiddenTop = hiddenTop; - mShownTop = shownTop; - mTargetShown = imeShouldShow; if (!isDividerVisible()) { return 0; } - final boolean splitIsVisible = !getView().isHidden(); + mHiddenTop = hiddenTop; + mShownTop = shownTop; + mTargetShown = imeShouldShow; mSecondaryHasFocus = getSecondaryHasFocus(displayId); + final boolean splitIsVisible = !getView().isHidden(); final boolean targetAdjusted = splitIsVisible && imeShouldShow && mSecondaryHasFocus && !imeIsFloating && !getLayout().mDisplayLayout.isLandscape() && !mSplits.mSplitScreenController.isMinimized();