Fix WindowInputTests#testOverlapWindow failing (1/2)

The 'InputWindowInfo.isTrustedOverlay' function had been removed, we
have to indicate the trustedOverlay flag when fill input info to overlay
window.

Bug: 161789401
Bug: 158717144
Test: atest WindowInputTests
Change-Id: Idf17fd64c6a1399d04c51e3f0bd600dc4a84239a
This commit is contained in:
arthurhung
2020-07-23 17:15:04 +08:00
parent 7452bc3021
commit c3decccdc6
3 changed files with 27 additions and 20 deletions

View File

@@ -88,6 +88,7 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
mWindowHandle.ownerUid = Process.myUid();
mWindowHandle.inputFeatures = 0;
mWindowHandle.scaleFactor = 1.0f;
mWindowHandle.trustedOverlay = true;
mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId).getSession())
.setContainerLayer()

View File

@@ -27,7 +27,18 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
import static android.view.WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_CONSUMER;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
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_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT;
@@ -67,9 +78,6 @@ final class InputMonitor {
private boolean mUpdateInputWindowsPending;
private boolean mUpdateInputWindowsImmediately;
// Currently focused input window handle.
private InputWindowHandle mFocusedInputWindowHandle;
private boolean mDisableWallpaperTouchEvents;
private final Rect mTmpRect = new Rect();
private final UpdateInputForAllWindowsConsumer mUpdateInputForAllWindowsConsumer;
@@ -309,10 +317,6 @@ final class InputMonitor {
Slog.d(TAG_WM, "addInputWindowHandle: "
+ child + ", " + inputWindowHandle);
}
if (hasFocus) {
mFocusedInputWindowHandle = inputWindowHandle;
}
}
void setUpdateInputWindowsNeededLw() {
@@ -578,6 +582,7 @@ final class InputMonitor {
inputWindowHandle.portalToDisplayId = INVALID_DISPLAY;
inputWindowHandle.touchableRegion.setEmpty();
inputWindowHandle.setTouchableRegionCrop(null);
inputWindowHandle.trustedOverlay = isTrustedOverlay(type);
}
/**
@@ -592,4 +597,17 @@ final class InputMonitor {
populateOverlayInputInfo(inputWindowHandle, name, TYPE_SECURE_SYSTEM_OVERLAY, true);
t.setInputWindowInfo(sc, inputWindowHandle);
}
static boolean isTrustedOverlay(int type) {
return type == TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY
|| type == TYPE_INPUT_METHOD || type == TYPE_INPUT_METHOD_DIALOG
|| type == TYPE_MAGNIFICATION_OVERLAY || type == TYPE_STATUS_BAR
|| type == TYPE_NOTIFICATION_SHADE
|| type == TYPE_NAVIGATION_BAR
|| type == TYPE_NAVIGATION_BAR_PANEL
|| type == TYPE_SECURE_SYSTEM_OVERLAY
|| type == TYPE_DOCK_DIVIDER
|| type == TYPE_ACCESSIBILITY_OVERLAY
|| type == TYPE_INPUT_CONSUMER;
}
}

View File

@@ -63,7 +63,6 @@ import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;
@@ -88,7 +87,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT;
import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
@@ -954,17 +952,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mInputWindowHandle.trustedOverlay =
(mAttrs.privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0
&& mOwnerCanAddInternalSystemWindow;
mInputWindowHandle.trustedOverlay |=
mAttrs.type == TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY
|| mAttrs.type == TYPE_INPUT_METHOD || mAttrs.type == TYPE_INPUT_METHOD_DIALOG
|| mAttrs.type == TYPE_MAGNIFICATION_OVERLAY || mAttrs.type == TYPE_STATUS_BAR
|| mAttrs.type == TYPE_NOTIFICATION_SHADE
|| mAttrs.type == TYPE_NAVIGATION_BAR
|| mAttrs.type == TYPE_NAVIGATION_BAR_PANEL
|| mAttrs.type == TYPE_SECURE_SYSTEM_OVERLAY
|| mAttrs.type == TYPE_DOCK_DIVIDER
|| mAttrs.type == TYPE_ACCESSIBILITY_OVERLAY
|| mAttrs.type == TYPE_INPUT_CONSUMER;
mInputWindowHandle.trustedOverlay |= InputMonitor.isTrustedOverlay(mAttrs.type);
// Make sure we initial all fields before adding to parentWindow, to prevent exception
// during onDisplayChanged.