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

Commit a5625411 authored by Vishnu Nair's avatar Vishnu Nair Committed by Automerger Merge Worker
Browse files

Merge "Drop input for toast and child surfaces" into sc-v2-dev am: fd48bc50 am: 6b4d48b6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15899036

Change-Id: Iad08522c711614314946f61c33729133adb37165
parents 1381f155 6b4d48b6
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ import android.graphics.Insets;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.Region;
import android.gui.DropInputMode;
import android.hardware.power.Boost;
import android.os.Handler;
import android.os.IBinder;
@@ -961,6 +962,20 @@ public class DisplayPolicy {
        attrs.flags = sanitizeFlagSlippery(attrs.flags, attrs.privateFlags, win.getName());
    }

    /**
     * Add additional policy if needed to ensure the window or its children should not receive any
     * input.
     */
    public void setDropInputModePolicy(WindowState win, LayoutParams attrs) {
        if (attrs.type == TYPE_TOAST
                && (attrs.privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) == 0) {
            // Toasts should not receive input. These windows should not have any children, so
            // force this hierarchy of windows to drop all input.
            mService.mTransactionFactory.get()
                    .setDropInputMode(win.getSurfaceControl(), DropInputMode.ALL).apply();
        }
    }

    /**
     * Check if a window can be added to the system.
     *
+1 −0
Original line number Diff line number Diff line
@@ -1783,6 +1783,7 @@ public class WindowManagerService extends IWindowManager.Stub

            win.mToken.addWindow(win);
            displayPolicy.addWindowLw(win, attrs);
            displayPolicy.setDropInputModePolicy(win, win.mAttrs);
            if (type == TYPE_APPLICATION_STARTING && activity != null) {
                activity.attachStartingWindow(win);
                ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "addWindow: %s startingWindow=%s",