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

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

Merge changes from topic "toast-security-fix-sc-dev" into sc-dev am: 799f0a7f

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

Change-Id: I44df933c6e2e65cf44f4f1215f51d543491b8d1a
parents 52873f28 799f0a7f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -124,6 +124,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;
@@ -929,6 +930,20 @@ public class DisplayPolicy {
        }
    }

    /**
     * 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
@@ -1780,6 +1780,7 @@ public class WindowManagerService extends IWindowManager.Stub

            win.mToken.addWindow(win);
            displayPolicy.addWindowLw(win, attrs);
            displayPolicy.setDropInputModePolicy(win, win.mAttrs);
            if (type == TYPE_INPUT_METHOD) {
                displayContent.setInputMethodWindowLocked(win);
                imMayMove = false;