Merge "Reland: Let the system dialog honor FLAG_ALT_FOCUSABLE_IM" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
62df1760bf
@@ -361,6 +361,7 @@ final class SaveUi {
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.accessibilityTitle = context.getString(R.string.autofill_save_accessibility_title);
|
||||
params.windowAnimations = R.style.AutofillSaveAnimation;
|
||||
params.setTrustedOverlay();
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
@@ -5330,6 +5330,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
&& imeTarget.compareTo(this) <= 0;
|
||||
return inTokenWithAndAboveImeTarget;
|
||||
}
|
||||
|
||||
// The condition is for the system dialog not belonging to any Activity.
|
||||
// (^FLAG_NOT_FOCUSABLE & FLAG_ALT_FOCUSABLE_IM) means the dialog is still focusable but
|
||||
// should be placed above the IME window.
|
||||
if ((mAttrs.flags & (FLAG_NOT_FOCUSABLE | FLAG_ALT_FOCUSABLE_IM))
|
||||
== FLAG_ALT_FOCUSABLE_IM && isTrustedOverlay() && canAddInternalSystemWindow()) {
|
||||
// Check the current IME target so that it does not lift this window above the IME if
|
||||
// the Z-order of the current IME layering target is greater than it.
|
||||
final WindowState imeTarget = getImeLayeringTarget();
|
||||
return imeTarget != null && imeTarget != this && imeTarget.compareTo(this) <= 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
|
||||
|
||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||
@@ -969,6 +971,33 @@ public class WindowStateTests extends WindowTestsBase {
|
||||
assertFalse(sameTokenWindow.needsRelativeLayeringToIme());
|
||||
}
|
||||
|
||||
@UseTestDisplay(addWindows = {W_ACTIVITY, W_INPUT_METHOD})
|
||||
@Test
|
||||
public void testNeedsRelativeLayeringToIme_systemDialog() {
|
||||
WindowState systemDialogWindow = createWindow(null, TYPE_SECURE_SYSTEM_OVERLAY,
|
||||
mDisplayContent,
|
||||
"SystemDialog", true);
|
||||
mDisplayContent.setImeLayeringTarget(mAppWindow);
|
||||
mAppWindow.getRootTask().setWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
|
||||
makeWindowVisible(mImeWindow);
|
||||
systemDialogWindow.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
|
||||
assertTrue(systemDialogWindow.needsRelativeLayeringToIme());
|
||||
}
|
||||
|
||||
@UseTestDisplay(addWindows = {W_INPUT_METHOD})
|
||||
@Test
|
||||
public void testNeedsRelativeLayeringToIme_notificationShadeShouldNotHideSystemDialog() {
|
||||
WindowState systemDialogWindow = createWindow(null, TYPE_SECURE_SYSTEM_OVERLAY,
|
||||
mDisplayContent,
|
||||
"SystemDialog", true);
|
||||
mDisplayContent.setImeLayeringTarget(systemDialogWindow);
|
||||
makeWindowVisible(mImeWindow);
|
||||
WindowState notificationShade = createWindow(null, TYPE_NOTIFICATION_SHADE,
|
||||
mDisplayContent, "NotificationShade", true);
|
||||
notificationShade.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
|
||||
assertFalse(notificationShade.needsRelativeLayeringToIme());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetFreezeInsetsState() {
|
||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||
|
||||
@@ -22,6 +22,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
||||
@@ -31,6 +32,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
|
||||
@@ -552,6 +554,30 @@ public class ZOrderingTests extends WindowTestsBase {
|
||||
mDisplayContent.getImeContainer().getSurfaceControl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSystemDialogWindow_expectHigherThanIme_inMultiWindow() {
|
||||
// Simulate the app window is in multi windowing mode and being IME target
|
||||
mAppWindow.getConfiguration().windowConfiguration.setWindowingMode(
|
||||
WINDOWING_MODE_MULTI_WINDOW);
|
||||
mDisplayContent.setImeLayeringTarget(mAppWindow);
|
||||
mDisplayContent.setImeInputTarget(mAppWindow);
|
||||
makeWindowVisible(mImeWindow);
|
||||
|
||||
// Create a popupWindow
|
||||
final WindowState systemDialogWindow = createWindow(null, TYPE_SECURE_SYSTEM_OVERLAY,
|
||||
mDisplayContent, "SystemDialog", true);
|
||||
systemDialogWindow.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
|
||||
spyOn(systemDialogWindow);
|
||||
|
||||
mDisplayContent.assignChildLayers(mTransaction);
|
||||
|
||||
// Verify the surface layer of the popupWindow should higher than IME
|
||||
verify(systemDialogWindow).needsRelativeLayeringToIme();
|
||||
assertThat(systemDialogWindow.needsRelativeLayeringToIme()).isTrue();
|
||||
assertZOrderGreaterThan(mTransaction, systemDialogWindow.getSurfaceControl(),
|
||||
mDisplayContent.getImeContainer().getSurfaceControl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImeScreenshotLayer() {
|
||||
final Task task = createTask(mDisplayContent);
|
||||
|
||||
Reference in New Issue
Block a user