From c510ecb3ec0eeca5425f5bc96fae80ea56f85be6 Mon Sep 17 00:00:00 2001 From: Phil Weaver Date: Fri, 18 Aug 2017 18:01:46 -0700 Subject: Backport overlay security fix Replacing app opps fix with the flag that is used elsewhere. Bug: 37442941 Test: Verified that toast and system overlay still goes away on permission and a11y service capability screens. Merged-In: I1a3e3c5b1696a5f5b95eac187acb5a03863b4a0b Change-Id: If9bec515105369055415d54c7fcad7a65431f8e7 --- api/system-current.txt | 1 + core/java/android/view/WindowManager.java | 12 +++-- core/res/AndroidManifest.xml | 9 ++++ .../core/java/com/android/server/wm/Session.java | 4 ++ .../com/android/server/wm/TaskSnapshotSurface.java | 4 +- .../android/server/wm/WindowManagerService.java | 51 ++++++++++++++++++++-- .../java/com/android/server/wm/WindowState.java | 42 ++++++++++++++++-- .../android/server/wm/WindowSurfaceController.java | 4 +- 8 files changed, 108 insertions(+), 19 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index a2c2771b4844..74a2bae634ad 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -120,6 +120,7 @@ package android { field public static final java.lang.String GRANT_RUNTIME_PERMISSIONS = "android.permission.GRANT_RUNTIME_PERMISSIONS"; field public static final java.lang.String HARDWARE_TEST = "android.permission.HARDWARE_TEST"; field public static final java.lang.String HDMI_CEC = "android.permission.HDMI_CEC"; + field public static final java.lang.String HIDE_NON_SYSTEM_OVERLAY_WINDOWS = "android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS"; field public static final java.lang.String INJECT_EVENTS = "android.permission.INJECT_EVENTS"; field public static final java.lang.String INSTALL_GRANT_RUNTIME_PERMISSIONS = "android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS"; field public static final java.lang.String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER"; diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 4060b9a7c271..c1e8f1cc3bc6 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1380,15 +1380,13 @@ public interface WindowManager extends ViewManager { public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000; /** - * Flag to indicate that this window is used as a task snapshot window. A task snapshot - * window is a starting window that gets shown with a screenshot from the previous state - * that is active until the app has drawn its first frame. - * - *

If this flag is set, SystemUI flags are ignored such that the real window behind can - * set the SystemUI flags. + * Flag to indicate that any window added by an application process that is of type + * {@link #TYPE_TOAST} or that requires + * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when + * this window is visible. * @hide */ - public static final int PRIVATE_FLAG_TASK_SNAPSHOT = 0x00080000; + public static final int PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000; /** * Control flags that are private to the platform. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 794d4f8b78b9..b2a736304ed0 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2333,6 +2333,15 @@ + + +