diff options
5 files changed, 46 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java index 34998a025663..b9240c78d711 100644 --- a/services/core/java/com/android/server/wm/AccessibilityController.java +++ b/services/core/java/com/android/server/wm/AccessibilityController.java @@ -898,11 +898,16 @@ final class AccessibilityController { /* ignore */ } mSurfaceControl = surfaceControl; - mService.mTransactionFactory.get().setLayer(mSurfaceControl, - mService.mPolicy.getWindowLayerFromTypeLw(TYPE_MAGNIFICATION_OVERLAY) - * WindowManagerService.TYPE_LAYER_MULTIPLIER) - .setPosition(mSurfaceControl, 0, 0) - .apply(); + + final SurfaceControl.Transaction t = mService.mTransactionFactory.get(); + final int layer = + mService.mPolicy.getWindowLayerFromTypeLw(TYPE_MAGNIFICATION_OVERLAY) * + WindowManagerService.TYPE_LAYER_MULTIPLIER; + t.setLayer(mSurfaceControl, layer).setPosition(mSurfaceControl, 0, 0); + InputMonitor.setTrustedOverlayInputInfo(mSurfaceControl, t, + mDisplayContent.getDisplayId(), "Magnification Overlay"); + t.apply(); + mSurface.copyFrom(mSurfaceControl); mAnimationController = new AnimationController(context, diff --git a/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java b/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java index 2165b0e8b593..c9cc94423fe2 100644 --- a/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java +++ b/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java @@ -66,6 +66,9 @@ class EmulatorDisplayOverlay { t.setLayer(ctrl, zOrder); t.setPosition(ctrl, 0, 0); t.show(ctrl); + // Ensure we aren't considered as obscuring for Input purposes. + InputMonitor.setTrustedOverlayInputInfo(ctrl, t, + dc.getDisplayId(), "EmulatorDisplayOverlay"); mSurface.copyFrom(ctrl); } catch (OutOfResourcesException e) { } diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index efcd61df5c75..8734b5efa45d 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -16,13 +16,17 @@ package com.android.server.wm; +import static android.os.Process.myPid; +import static android.os.Process.myUid; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.WindowManager.INPUT_CONSUMER_NAVIGATION; import static android.view.WindowManager.INPUT_CONSUMER_PIP; import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION; import static android.view.WindowManager.INPUT_CONSUMER_WALLPAPER; 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_SECURE_SYSTEM_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT; @@ -550,4 +554,26 @@ final class InputMonitor { } } } + + /** + * Helper function to generate an InputInfo with type SECURE_SYSTEM_OVERLAY. This input + * info will not have an input channel or be touchable, but is used to omit Surfaces + * from occlusion detection, so that System global overlays like the Watermark aren't + * counted by the InputDispatcher as occluding applications below. + */ + static void setTrustedOverlayInputInfo(SurfaceControl sc, SurfaceControl.Transaction t, + int displayId, String name) { + InputWindowHandle inputWindowHandle = new InputWindowHandle(null, displayId); + inputWindowHandle.name = name; + inputWindowHandle.layoutParamsType = TYPE_SECURE_SYSTEM_OVERLAY; + inputWindowHandle.dispatchingTimeoutNanos = -1; + inputWindowHandle.visible = true; + inputWindowHandle.canReceiveKeys = false; + inputWindowHandle.hasFocus = false; + inputWindowHandle.ownerPid = myPid(); + inputWindowHandle.ownerUid = myUid(); + inputWindowHandle.inputFeatures = INPUT_FEATURE_NO_INPUT_CHANNEL; + inputWindowHandle.scaleFactor = 1; + t.setInputWindowInfo(sc, inputWindowHandle); + } } diff --git a/services/core/java/com/android/server/wm/StrictModeFlash.java b/services/core/java/com/android/server/wm/StrictModeFlash.java index f537005c955c..fa62daaff3fc 100644 --- a/services/core/java/com/android/server/wm/StrictModeFlash.java +++ b/services/core/java/com/android/server/wm/StrictModeFlash.java @@ -54,6 +54,10 @@ class StrictModeFlash { t.setLayer(ctrl, WindowManagerService.TYPE_LAYER_MULTIPLIER * 101); t.setPosition(ctrl, 0, 0); t.show(ctrl); + // Ensure we aren't considered as obscuring for Input purposes. + InputMonitor.setTrustedOverlayInputInfo(ctrl, t, dc.getDisplayId(), + "StrictModeFlash"); + mSurface.copyFrom(ctrl); } catch (OutOfResourcesException e) { } diff --git a/services/core/java/com/android/server/wm/Watermark.java b/services/core/java/com/android/server/wm/Watermark.java index 4e1b2177c87c..3d49ebe306e6 100644 --- a/services/core/java/com/android/server/wm/Watermark.java +++ b/services/core/java/com/android/server/wm/Watermark.java @@ -29,6 +29,7 @@ import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import android.view.Display; +import android.view.InputWindowHandle; import android.view.Surface; import android.view.Surface.OutOfResourcesException; import android.view.SurfaceControl; @@ -124,6 +125,8 @@ class Watermark { t.setLayer(ctrl, WindowManagerService.TYPE_LAYER_MULTIPLIER * 100) .setPosition(ctrl, 0, 0) .show(ctrl); + // Ensure we aren't considered as obscuring for Input purposes. + InputMonitor.setTrustedOverlayInputInfo(ctrl, t, dc.getDisplayId(), "Watermark"); mSurface.copyFrom(ctrl); } catch (OutOfResourcesException e) { } |