diff options
| author | 2022-08-05 15:14:16 +0200 | |
|---|---|---|
| committer | 2022-08-05 17:27:52 +0200 | |
| commit | 778191bdf21661b41030f9308e095c0445dec33c (patch) | |
| tree | bd1e079afbf8edbbdca3ea5214ba3db851e79c0c | |
| parent | ea69ad5892195471cdd448bcb3d76539cb6b19a6 (diff) | |
DO NOT MERGE - Exclude TYPE_PRIVATE_PRESENTATION app visiblity
These windows can only be placed on private virtual displays, and as
such they should not be considered when deciding if an application has
any visible windows or not.
Bug:205130886
Test:Manually verified that sample from 205130886 no longer allows
background activity launches
Test: atest CtsActivityManagerBackgroundActivityTestCases
Change-Id: I76208722bbb7a407ba1f2dc4305a28226166414d
Merged-In: I76208722bbb7a407ba1f2dc4305a28226166414d
| -rw-r--r-- | services/core/java/com/android/server/wm/RootWindowContainer.java | 5 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowState.java | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index c6d75fc6fe9f..d768d339cbc6 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -564,8 +564,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent> /** * Returns {@code true} if the callingUid has any non-toast window currently visible to the * user. Also ignores {@link android.view.WindowManager.LayoutParams#TYPE_APPLICATION_STARTING}, - * since those windows don't belong to apps. - * @see WindowState#isNonToastOrStarting() + * and{@link android.view.WindowManager.LayoutParams#TYPE_PRIVATE_PRESENTATION}, as they + * should not count towards the apps visibility + * @see WindowState#isNonToastOrStartingOrPrivatePresentation() */ boolean isAnyNonToastWindowVisibleForUid(int callingUid) { final PooledPredicate p = PooledLambda.obtainPredicate( diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index ce9b2cecef35..6e1b17c4c51f 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -5825,20 +5825,24 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } /** - * Returns {@code true} if this window is not {@link WindowManager.LayoutParams#TYPE_TOAST} - * or {@link WindowManager.LayoutParams#TYPE_APPLICATION_STARTING}, - * since this window doesn't belong to apps. + * Returns {@code true} if this window is not {@link WindowManager.LayoutParams#TYPE_TOAST}, + * {@link WindowManager.LayoutParams#TYPE_APPLICATION_STARTING} or + * {@link WindowManager.LayoutParams#TYPE_PRIVATE_PRESENTATION}, + * since those windows should not count towards the apps visibility. */ - boolean isNonToastOrStarting() { - return mAttrs.type != TYPE_TOAST && mAttrs.type != TYPE_APPLICATION_STARTING; + boolean isNonToastOrStartingOrPrivatePresentation() { + return mAttrs.type != TYPE_TOAST && mAttrs.type != TYPE_APPLICATION_STARTING + && mAttrs.type != TYPE_PRIVATE_PRESENTATION; } boolean isNonToastWindowVisibleForUid(int callingUid) { - return getOwningUid() == callingUid && isNonToastOrStarting() && isVisibleNow(); + return getOwningUid() == callingUid && isNonToastOrStartingOrPrivatePresentation() + && isVisibleNow(); } boolean isNonToastWindowVisibleForPid(int pid) { - return mSession.mPid == pid && isNonToastOrStarting() && isVisibleNow(); + return mSession.mPid == pid && isNonToastOrStartingOrPrivatePresentation() + && isVisibleNow(); } void setViewVisibility(int viewVisibility) { |