Loading core/java/android/view/InputWindowHandle.java +11 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static com.android.window.flags.Flags.surfaceTrustedOverlay; import android.annotation.IntDef; import android.annotation.Nullable; import android.graphics.Matrix; Loading @@ -35,7 +37,6 @@ import java.lang.ref.WeakReference; * @hide */ public final class InputWindowHandle { /** * An internal annotation for all the {@link android.os.InputConfig} flags that can be * specified to {@link #inputConfig} to control the behavior of an input window. Only the Loading @@ -59,7 +60,6 @@ public final class InputWindowHandle { InputConfig.DUPLICATE_TOUCH_TO_WALLPAPER, InputConfig.IS_WALLPAPER, InputConfig.PAUSE_DISPATCHING, InputConfig.TRUSTED_OVERLAY, InputConfig.WATCH_OUTSIDE_TOUCH, InputConfig.SLIPPERY, InputConfig.DISABLE_USER_ACTIVITY, Loading Loading @@ -272,4 +272,13 @@ public final class InputWindowHandle { } this.inputConfig &= ~inputConfig; } public void setTrustedOverlay(SurfaceControl.Transaction t, SurfaceControl sc, boolean isTrusted) { if (surfaceTrustedOverlay()) { t.setTrustedOverlay(sc, isTrusted); } else if (isTrusted) { inputConfig |= InputConfig.TRUSTED_OVERLAY; } } } core/java/android/window/flags/window_surfaces.aconfig 0 → 100644 +11 −0 Original line number Diff line number Diff line package: "com.android.window.flags" # Project link: https://gantry.corp.google.com/projects/android_platform_window_surfaces/changes flag { namespace: "window_surfaces" name: "surface_trusted_overlay" description: "Whether to add trusted overlay flag on the SurfaceControl or the InputWindow" is_fixed_read_only: true bug: "292032926" } services/core/java/com/android/server/input/GestureMonitorSpyWindow.java +2 −2 Original line number Diff line number Diff line Loading @@ -62,10 +62,10 @@ class GestureMonitorSpyWindow { mWindowHandle.ownerUid = uid; mWindowHandle.scaleFactor = 1.0f; mWindowHandle.replaceTouchableRegionWithCrop(null /* use this surface's bounds */); mWindowHandle.inputConfig = InputConfig.NOT_FOCUSABLE | InputConfig.SPY | InputConfig.TRUSTED_OVERLAY; mWindowHandle.inputConfig = InputConfig.NOT_FOCUSABLE | InputConfig.SPY; final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); mWindowHandle.setTrustedOverlay(t, mInputSurface, true); t.setInputWindowInfo(mInputSurface, mWindowHandle); t.setLayer(mInputSurface, InputManagerService.INPUT_OVERLAY_LAYER_GESTURE_MONITOR); t.setPosition(mInputSurface, 0, 0); Loading services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java +2 −2 Original line number Diff line number Diff line Loading @@ -57,13 +57,13 @@ final class HandwritingEventReceiverSurface { InputConfig.NOT_FOCUSABLE | InputConfig.NOT_TOUCHABLE | InputConfig.SPY | InputConfig.INTERCEPTS_STYLUS | InputConfig.TRUSTED_OVERLAY; | InputConfig.INTERCEPTS_STYLUS; // Configure the surface to receive stylus events across the entire display. mWindowHandle.replaceTouchableRegionWithCrop(null /* use this surface's bounds */); final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); mWindowHandle.setTrustedOverlay(t, mInputSurface, true); t.setInputWindowInfo(mInputSurface, mWindowHandle); t.setLayer(mInputSurface, InputManagerService.INPUT_OVERLAY_LAYER_HANDWRITING_SURFACE); t.setPosition(mInputSurface, 0, 0); Loading services/core/java/com/android/server/wm/DragState.java +4 −6 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ import android.hardware.input.InputManagerGlobal; import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.os.InputConfig; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -186,6 +185,10 @@ class DragState { // Crop the input surface to the display size. mTmpClipRect.set(0, 0, mDisplaySize.x, mDisplaySize.y); // Make trusted overlay to not block any touches while D&D ongoing and allowing // touches to pass through to windows underneath. This allows user to interact with the // UI to navigate while dragging. h.setTrustedOverlay(mTransaction, mInputSurface, true); mTransaction.show(mInputSurface) .setInputWindowInfo(mInputSurface, h) .setLayer(mInputSurface, Integer.MAX_VALUE) Loading Loading @@ -377,11 +380,6 @@ class DragState { mDragWindowHandle.ownerUid = MY_UID; mDragWindowHandle.scaleFactor = 1.0f; // InputConfig.TRUSTED_OVERLAY: To not block any touches while D&D ongoing and allowing // touches to pass through to windows underneath. This allows user to interact with the // UI to navigate while dragging. mDragWindowHandle.inputConfig = InputConfig.TRUSTED_OVERLAY; // The drag window cannot receive new touches. mDragWindowHandle.touchableRegion.setEmpty(); Loading Loading
core/java/android/view/InputWindowHandle.java +11 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static com.android.window.flags.Flags.surfaceTrustedOverlay; import android.annotation.IntDef; import android.annotation.Nullable; import android.graphics.Matrix; Loading @@ -35,7 +37,6 @@ import java.lang.ref.WeakReference; * @hide */ public final class InputWindowHandle { /** * An internal annotation for all the {@link android.os.InputConfig} flags that can be * specified to {@link #inputConfig} to control the behavior of an input window. Only the Loading @@ -59,7 +60,6 @@ public final class InputWindowHandle { InputConfig.DUPLICATE_TOUCH_TO_WALLPAPER, InputConfig.IS_WALLPAPER, InputConfig.PAUSE_DISPATCHING, InputConfig.TRUSTED_OVERLAY, InputConfig.WATCH_OUTSIDE_TOUCH, InputConfig.SLIPPERY, InputConfig.DISABLE_USER_ACTIVITY, Loading Loading @@ -272,4 +272,13 @@ public final class InputWindowHandle { } this.inputConfig &= ~inputConfig; } public void setTrustedOverlay(SurfaceControl.Transaction t, SurfaceControl sc, boolean isTrusted) { if (surfaceTrustedOverlay()) { t.setTrustedOverlay(sc, isTrusted); } else if (isTrusted) { inputConfig |= InputConfig.TRUSTED_OVERLAY; } } }
core/java/android/window/flags/window_surfaces.aconfig 0 → 100644 +11 −0 Original line number Diff line number Diff line package: "com.android.window.flags" # Project link: https://gantry.corp.google.com/projects/android_platform_window_surfaces/changes flag { namespace: "window_surfaces" name: "surface_trusted_overlay" description: "Whether to add trusted overlay flag on the SurfaceControl or the InputWindow" is_fixed_read_only: true bug: "292032926" }
services/core/java/com/android/server/input/GestureMonitorSpyWindow.java +2 −2 Original line number Diff line number Diff line Loading @@ -62,10 +62,10 @@ class GestureMonitorSpyWindow { mWindowHandle.ownerUid = uid; mWindowHandle.scaleFactor = 1.0f; mWindowHandle.replaceTouchableRegionWithCrop(null /* use this surface's bounds */); mWindowHandle.inputConfig = InputConfig.NOT_FOCUSABLE | InputConfig.SPY | InputConfig.TRUSTED_OVERLAY; mWindowHandle.inputConfig = InputConfig.NOT_FOCUSABLE | InputConfig.SPY; final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); mWindowHandle.setTrustedOverlay(t, mInputSurface, true); t.setInputWindowInfo(mInputSurface, mWindowHandle); t.setLayer(mInputSurface, InputManagerService.INPUT_OVERLAY_LAYER_GESTURE_MONITOR); t.setPosition(mInputSurface, 0, 0); Loading
services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java +2 −2 Original line number Diff line number Diff line Loading @@ -57,13 +57,13 @@ final class HandwritingEventReceiverSurface { InputConfig.NOT_FOCUSABLE | InputConfig.NOT_TOUCHABLE | InputConfig.SPY | InputConfig.INTERCEPTS_STYLUS | InputConfig.TRUSTED_OVERLAY; | InputConfig.INTERCEPTS_STYLUS; // Configure the surface to receive stylus events across the entire display. mWindowHandle.replaceTouchableRegionWithCrop(null /* use this surface's bounds */); final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); mWindowHandle.setTrustedOverlay(t, mInputSurface, true); t.setInputWindowInfo(mInputSurface, mWindowHandle); t.setLayer(mInputSurface, InputManagerService.INPUT_OVERLAY_LAYER_HANDWRITING_SURFACE); t.setPosition(mInputSurface, 0, 0); Loading
services/core/java/com/android/server/wm/DragState.java +4 −6 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ import android.hardware.input.InputManagerGlobal; import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.os.InputConfig; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -186,6 +185,10 @@ class DragState { // Crop the input surface to the display size. mTmpClipRect.set(0, 0, mDisplaySize.x, mDisplaySize.y); // Make trusted overlay to not block any touches while D&D ongoing and allowing // touches to pass through to windows underneath. This allows user to interact with the // UI to navigate while dragging. h.setTrustedOverlay(mTransaction, mInputSurface, true); mTransaction.show(mInputSurface) .setInputWindowInfo(mInputSurface, h) .setLayer(mInputSurface, Integer.MAX_VALUE) Loading Loading @@ -377,11 +380,6 @@ class DragState { mDragWindowHandle.ownerUid = MY_UID; mDragWindowHandle.scaleFactor = 1.0f; // InputConfig.TRUSTED_OVERLAY: To not block any touches while D&D ongoing and allowing // touches to pass through to windows underneath. This allows user to interact with the // UI to navigate while dragging. mDragWindowHandle.inputConfig = InputConfig.TRUSTED_OVERLAY; // The drag window cannot receive new touches. mDragWindowHandle.touchableRegion.setEmpty(); Loading