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
This commit is contained in:
Jerry Chang
2021-03-12 00:09:54 +08:00
parent 31d065f556
commit 6d17d410f9

View File

@@ -143,14 +143,14 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor
@ImeAnimationFlags @ImeAnimationFlags
public int onImeStartPositioning(int displayId, int hiddenTop, int shownTop, public int onImeStartPositioning(int displayId, int hiddenTop, int shownTop,
boolean imeShouldShow, boolean imeIsFloating, SurfaceControl.Transaction t) { boolean imeShouldShow, boolean imeIsFloating, SurfaceControl.Transaction t) {
mHiddenTop = hiddenTop;
mShownTop = shownTop;
mTargetShown = imeShouldShow;
if (!isDividerVisible()) { if (!isDividerVisible()) {
return 0; return 0;
} }
final boolean splitIsVisible = !getView().isHidden(); mHiddenTop = hiddenTop;
mShownTop = shownTop;
mTargetShown = imeShouldShow;
mSecondaryHasFocus = getSecondaryHasFocus(displayId); mSecondaryHasFocus = getSecondaryHasFocus(displayId);
final boolean splitIsVisible = !getView().isHidden();
final boolean targetAdjusted = splitIsVisible && imeShouldShow && mSecondaryHasFocus final boolean targetAdjusted = splitIsVisible && imeShouldShow && mSecondaryHasFocus
&& !imeIsFloating && !getLayout().mDisplayLayout.isLandscape() && !imeIsFloating && !getLayout().mDisplayLayout.isLandscape()
&& !mSplits.mSplitScreenController.isMinimized(); && !mSplits.mSplitScreenController.isMinimized();