Don't allow pinned window to be IME target

SysUi's PIP window (PipMenuActivity) is always focusable,
transparent and yet never should be an IME target.

Bug: 158881678
Test: atest WindowStateTests#testCanBeImeTarget
Change-Id: Ie863dd1037d0c446f35a8b1ec07c18efaddb1840
This commit is contained in:
Taran Singh
2020-06-15 16:54:35 -07:00
parent 06b2e1cb17
commit 6c240d1432
2 changed files with 11 additions and 0 deletions

View File

@@ -2339,6 +2339,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return false;
}
if (inPinnedWindowingMode()) {
return false;
}
final boolean windowsAreFocusable = mActivityRecord == null || mActivityRecord.windowsAreFocusable();
if (!windowsAreFocusable) {
// This window can't be an IME target if the app's windows should not be focusable.

View File

@@ -18,6 +18,7 @@ package com.android.server.wm;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.hardware.camera2.params.OutputConfiguration.ROTATION_90;
import static android.view.InsetsState.ITYPE_STATUS_BAR;
@@ -244,6 +245,12 @@ public class WindowStateTests extends WindowTestsBase {
appWindow.mAttrs.flags &= ~FLAG_NOT_FOCUSABLE;
assertTrue(appWindow.canBeImeTarget());
// Verify PINNED windows can't be IME target.
int initialMode = appWindow.mActivityRecord.getWindowingMode();
appWindow.mActivityRecord.setWindowingMode(WINDOWING_MODE_PINNED);
assertFalse(appWindow.canBeImeTarget());
appWindow.mActivityRecord.setWindowingMode(initialMode);
// Make windows invisible
appWindow.hideLw(false /* doAnimation */);
imeWindow.hideLw(false /* doAnimation */);