Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f8343d2 authored by Austin Delgado's avatar Austin Delgado Committed by Android (Google) Code Review
Browse files

Merge "Revert "Set trusted overlay on SurfaceControl instead of InputWindow"" into main

parents 751720c2 14b9b5ee
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@ import java.lang.ref.WeakReference;
 * @hide
 */
public final class InputWindowHandle {
    // TODO (b/300094445): Convert to use correct flagging infrastructure
    public static final boolean USE_SURFACE_TRUSTED_OVERLAY = true;

    /**
     * An internal annotation for all the {@link android.os.InputConfig} flags that can be
@@ -61,6 +59,7 @@ 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,
@@ -273,13 +272,4 @@ public final class InputWindowHandle {
        }
        this.inputConfig &= ~inputConfig;
    }

    public void setTrustedOverlay(SurfaceControl.Transaction t, SurfaceControl sc,
            boolean isTrusted) {
        if (USE_SURFACE_TRUSTED_OVERLAY) {
            t.setTrustedOverlay(sc, isTrusted);
        } else if (isTrusted) {
            inputConfig |= InputConfig.TRUSTED_OVERLAY;
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -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;
        mWindowHandle.inputConfig =
                InputConfig.NOT_FOCUSABLE | InputConfig.SPY | InputConfig.TRUSTED_OVERLAY;

        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);
+2 −2
Original line number Diff line number Diff line
@@ -57,13 +57,13 @@ final class HandwritingEventReceiverSurface {
                InputConfig.NOT_FOCUSABLE
                        | InputConfig.NOT_TOUCHABLE
                        | InputConfig.SPY
                        | InputConfig.INTERCEPTS_STYLUS;
                        | InputConfig.INTERCEPTS_STYLUS
                        | InputConfig.TRUSTED_OVERLAY;

        // 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);
+8 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.content.ClipDescription.MIMETYPE_APPLICATION_SHORTCUT;
import static android.content.ClipDescription.MIMETYPE_APPLICATION_TASK;
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INTERCEPT_GLOBAL_DRAG_AND_DROP;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_ORIENTATION;
import static com.android.internal.protolog.ProtoLogGroup.WM_SHOW_TRANSACTIONS;
import static com.android.server.wm.DragDropController.MSG_ANIMATION_END;
@@ -32,6 +33,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACT
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.MY_PID;
import static com.android.server.wm.WindowManagerService.MY_UID;

import static java.util.concurrent.CompletableFuture.completedFuture;

import android.animation.Animator;
@@ -46,6 +48,7 @@ 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;
@@ -183,13 +186,8 @@ 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)
                .setTrustedOverlay(mInputSurface, true)
                .setLayer(mInputSurface, Integer.MAX_VALUE)
                .setCrop(mInputSurface, mTmpClipRect);

@@ -379,6 +377,11 @@ 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();

+1 −3
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
        mWindowHandle.ownerPid = WindowManagerService.MY_PID;
        mWindowHandle.ownerUid = WindowManagerService.MY_UID;
        mWindowHandle.scaleFactor = 1.0f;
        mWindowHandle.inputConfig = InputConfig.NOT_FOCUSABLE;
        mWindowHandle.inputConfig = InputConfig.NOT_FOCUSABLE | InputConfig.TRUSTED_OVERLAY;

        mInputSurface = mService.makeSurfaceBuilder(
                        mService.mRoot.getDisplayContent(displayId).getSession())
@@ -129,14 +129,12 @@ class InputConsumerImpl implements IBinder.DeathRecipient {

    void show(SurfaceControl.Transaction t, WindowContainer w) {
        t.show(mInputSurface);
        mWindowHandle.setTrustedOverlay(t, mInputSurface, true);
        t.setInputWindowInfo(mInputSurface, mWindowHandle);
        t.setRelativeLayer(mInputSurface, w.getSurfaceControl(), 1);
    }

    void show(SurfaceControl.Transaction t, int layer) {
        t.show(mInputSurface);
        mWindowHandle.setTrustedOverlay(t, mInputSurface, true);
        t.setInputWindowInfo(mInputSurface, mWindowHandle);
        t.setLayer(mInputSurface, layer);
    }
Loading