Loading core/res/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -5870,6 +5870,10 @@ <!-- Allows input events to be monitored. Very dangerous! @hide --> <permission android:name="android.permission.MONITOR_INPUT" android:protectionLevel="signature|recents" /> <!-- Allows the use of FLAG_SLIPPERY, which permits touch events to slip from the current window to the window where the touch currently is on top of. @hide --> <permission android:name="android.permission.ALLOW_SLIPPERY_TOUCHES" android:protectionLevel="signature|recents" /> <!-- Allows the caller to change the associations between input devices and displays. Very dangerous! @hide --> <permission android:name="android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY" Loading packages/SystemUI/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ <uses-permission android:name="android.permission.SET_ORIENTATION" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> <uses-permission android:name="android.permission.MONITOR_INPUT" /> <uses-permission android:name="android.permission.ALLOW_SLIPPERY_TOUCHES" /> <uses-permission android:name="android.permission.INPUT_CONSUMER" /> <!-- DreamManager --> Loading services/core/java/com/android/server/wm/DisplayPolicy.java +0 −17 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ import static android.view.WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCRE import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN; import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; Loading Loading @@ -845,20 +844,6 @@ public class DisplayPolicy { return true; } /** * Only trusted overlays are allowed to use FLAG_SLIPPERY. */ static int sanitizeFlagSlippery(int flags, int privateFlags, String name) { if ((flags & FLAG_SLIPPERY) == 0) { return flags; } if ((privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0) { return flags; } Slog.w(TAG, "Removing FLAG_SLIPPERY for non-trusted overlay " + name); return flags & ~FLAG_SLIPPERY; } /** * Sanitize the layout parameters coming from a client. Allows the policy * to do things like ensure that windows of a specific type can't take Loading Loading @@ -942,8 +927,6 @@ public class DisplayPolicy { } else if (mRoundedCornerWindow == win) { mRoundedCornerWindow = null; } attrs.flags = sanitizeFlagSlippery(attrs.flags, attrs.privateFlags, win.getName()); } /** Loading services/core/java/com/android/server/wm/WindowManagerService.java +20 −1 Original line number Diff line number Diff line Loading @@ -1652,6 +1652,7 @@ public class WindowManagerService extends IWindowManager.Stub final DisplayPolicy displayPolicy = displayContent.getDisplayPolicy(); displayPolicy.adjustWindowParamsLw(win, win.mAttrs); attrs.flags = sanitizeFlagSlippery(attrs.flags, win.getName(), callingUid, callingPid); win.setRequestedVisibilities(requestedVisibilities); res = displayPolicy.validateAddingWindowLw(attrs, callingPid, callingUid); Loading Loading @@ -2207,6 +2208,7 @@ public class WindowManagerService extends IWindowManager.Stub if (attrs != null) { displayPolicy.adjustWindowParamsLw(win, attrs); win.mToken.adjustWindowParams(win, attrs); attrs.flags = sanitizeFlagSlippery(attrs.flags, win.getName(), uid, pid); int disableFlags = (attrs.systemUiVisibility | attrs.subtreeSystemUiVisibility) & DISABLE_MASK; if (disableFlags != 0 && !hasStatusBarPermission(pid, uid)) { Loading Loading @@ -8219,6 +8221,23 @@ public class WindowManagerService extends IWindowManager.Stub mAtmService.setFocusedTask(task.mTaskId, touchedActivity); } /** * You need ALLOW_SLIPPERY_TOUCHES permission to be able to set FLAG_SLIPPERY. */ private int sanitizeFlagSlippery(int flags, String windowName, int callingUid, int callingPid) { if ((flags & FLAG_SLIPPERY) == 0) { return flags; } final int permissionResult = mContext.checkPermission( android.Manifest.permission.ALLOW_SLIPPERY_TOUCHES, callingPid, callingUid); if (permissionResult != PackageManager.PERMISSION_GRANTED) { Slog.w(TAG, "Removing FLAG_SLIPPERY from '" + windowName + "' because it doesn't have ALLOW_SLIPPERY_TOUCHES permission"); return flags & ~FLAG_SLIPPERY; } return flags; } /** * Assigns an InputChannel to a SurfaceControl and configures it to receive * touch input according to it's on-screen geometry. Loading Loading @@ -8258,7 +8277,7 @@ public class WindowManagerService extends IWindowManager.Stub h.setWindowToken(window); h.name = name; flags = DisplayPolicy.sanitizeFlagSlippery(flags, privateFlags, name); flags = sanitizeFlagSlippery(flags, name, callingUid, callingPid); final int sanitizedFlags = flags & (LayoutParams.FLAG_NOT_TOUCHABLE | FLAG_SLIPPERY | LayoutParams.FLAG_NOT_FOCUSABLE); Loading Loading
core/res/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -5870,6 +5870,10 @@ <!-- Allows input events to be monitored. Very dangerous! @hide --> <permission android:name="android.permission.MONITOR_INPUT" android:protectionLevel="signature|recents" /> <!-- Allows the use of FLAG_SLIPPERY, which permits touch events to slip from the current window to the window where the touch currently is on top of. @hide --> <permission android:name="android.permission.ALLOW_SLIPPERY_TOUCHES" android:protectionLevel="signature|recents" /> <!-- Allows the caller to change the associations between input devices and displays. Very dangerous! @hide --> <permission android:name="android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY" Loading
packages/SystemUI/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ <uses-permission android:name="android.permission.SET_ORIENTATION" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> <uses-permission android:name="android.permission.MONITOR_INPUT" /> <uses-permission android:name="android.permission.ALLOW_SLIPPERY_TOUCHES" /> <uses-permission android:name="android.permission.INPUT_CONSUMER" /> <!-- DreamManager --> Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +0 −17 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ import static android.view.WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCRE import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN; import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR; Loading Loading @@ -845,20 +844,6 @@ public class DisplayPolicy { return true; } /** * Only trusted overlays are allowed to use FLAG_SLIPPERY. */ static int sanitizeFlagSlippery(int flags, int privateFlags, String name) { if ((flags & FLAG_SLIPPERY) == 0) { return flags; } if ((privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0) { return flags; } Slog.w(TAG, "Removing FLAG_SLIPPERY for non-trusted overlay " + name); return flags & ~FLAG_SLIPPERY; } /** * Sanitize the layout parameters coming from a client. Allows the policy * to do things like ensure that windows of a specific type can't take Loading Loading @@ -942,8 +927,6 @@ public class DisplayPolicy { } else if (mRoundedCornerWindow == win) { mRoundedCornerWindow = null; } attrs.flags = sanitizeFlagSlippery(attrs.flags, attrs.privateFlags, win.getName()); } /** Loading
services/core/java/com/android/server/wm/WindowManagerService.java +20 −1 Original line number Diff line number Diff line Loading @@ -1652,6 +1652,7 @@ public class WindowManagerService extends IWindowManager.Stub final DisplayPolicy displayPolicy = displayContent.getDisplayPolicy(); displayPolicy.adjustWindowParamsLw(win, win.mAttrs); attrs.flags = sanitizeFlagSlippery(attrs.flags, win.getName(), callingUid, callingPid); win.setRequestedVisibilities(requestedVisibilities); res = displayPolicy.validateAddingWindowLw(attrs, callingPid, callingUid); Loading Loading @@ -2207,6 +2208,7 @@ public class WindowManagerService extends IWindowManager.Stub if (attrs != null) { displayPolicy.adjustWindowParamsLw(win, attrs); win.mToken.adjustWindowParams(win, attrs); attrs.flags = sanitizeFlagSlippery(attrs.flags, win.getName(), uid, pid); int disableFlags = (attrs.systemUiVisibility | attrs.subtreeSystemUiVisibility) & DISABLE_MASK; if (disableFlags != 0 && !hasStatusBarPermission(pid, uid)) { Loading Loading @@ -8219,6 +8221,23 @@ public class WindowManagerService extends IWindowManager.Stub mAtmService.setFocusedTask(task.mTaskId, touchedActivity); } /** * You need ALLOW_SLIPPERY_TOUCHES permission to be able to set FLAG_SLIPPERY. */ private int sanitizeFlagSlippery(int flags, String windowName, int callingUid, int callingPid) { if ((flags & FLAG_SLIPPERY) == 0) { return flags; } final int permissionResult = mContext.checkPermission( android.Manifest.permission.ALLOW_SLIPPERY_TOUCHES, callingPid, callingUid); if (permissionResult != PackageManager.PERMISSION_GRANTED) { Slog.w(TAG, "Removing FLAG_SLIPPERY from '" + windowName + "' because it doesn't have ALLOW_SLIPPERY_TOUCHES permission"); return flags & ~FLAG_SLIPPERY; } return flags; } /** * Assigns an InputChannel to a SurfaceControl and configures it to receive * touch input according to it's on-screen geometry. Loading Loading @@ -8258,7 +8277,7 @@ public class WindowManagerService extends IWindowManager.Stub h.setWindowToken(window); h.name = name; flags = DisplayPolicy.sanitizeFlagSlippery(flags, privateFlags, name); flags = sanitizeFlagSlippery(flags, name, callingUid, callingPid); final int sanitizedFlags = flags & (LayoutParams.FLAG_NOT_TOUCHABLE | FLAG_SLIPPERY | LayoutParams.FLAG_NOT_FOCUSABLE); Loading