Skip to content

Commit 309127e

Browse files
Linus Tufvessonofficialputuid
authored andcommitted
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 (cherry picked from commit 778191b) Merged-In: I76208722bbb7a407ba1f2dc4305a28226166414d
1 parent 433ded7 commit 309127e

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

services/core/java/com/android/server/wm/RootWindowContainer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,9 @@ private void getWindowsByName(ArrayList<WindowState> output, String name, int ob
569569
/**
570570
* Returns {@code true} if the callingUid has any non-toast window currently visible to the
571571
* user. Also ignores {@link android.view.WindowManager.LayoutParams#TYPE_APPLICATION_STARTING},
572-
* since those windows don't belong to apps.
573-
* @see WindowState#isNonToastOrStarting()
572+
* and{@link android.view.WindowManager.LayoutParams#TYPE_PRIVATE_PRESENTATION}, as they
573+
* should not count towards the apps visibility
574+
* @see WindowState#isNonToastOrStartingOrPrivatePresentation()
574575
*/
575576
boolean isAnyNonToastWindowVisibleForUid(int callingUid) {
576577
final PooledPredicate p = PooledLambda.obtainPredicate(

services/core/java/com/android/server/wm/WindowState.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5812,20 +5812,24 @@ void getAnimationFrames(Rect outFrame, Rect outInsets, Rect outStableInsets,
58125812
}
58135813

58145814
/**
5815-
* Returns {@code true} if this window is not {@link WindowManager.LayoutParams#TYPE_TOAST}
5816-
* or {@link WindowManager.LayoutParams#TYPE_APPLICATION_STARTING},
5817-
* since this window doesn't belong to apps.
5815+
* Returns {@code true} if this window is not {@link WindowManager.LayoutParams#TYPE_TOAST},
5816+
* {@link WindowManager.LayoutParams#TYPE_APPLICATION_STARTING} or
5817+
* {@link WindowManager.LayoutParams#TYPE_PRIVATE_PRESENTATION},
5818+
* since those windows should not count towards the apps visibility.
58185819
*/
5819-
boolean isNonToastOrStarting() {
5820-
return mAttrs.type != TYPE_TOAST && mAttrs.type != TYPE_APPLICATION_STARTING;
5820+
boolean isNonToastOrStartingOrPrivatePresentation() {
5821+
return mAttrs.type != TYPE_TOAST && mAttrs.type != TYPE_APPLICATION_STARTING
5822+
&& mAttrs.type != TYPE_PRIVATE_PRESENTATION;
58215823
}
58225824

58235825
boolean isNonToastWindowVisibleForUid(int callingUid) {
5824-
return getOwningUid() == callingUid && isNonToastOrStarting() && isVisibleNow();
5826+
return getOwningUid() == callingUid && isNonToastOrStartingOrPrivatePresentation()
5827+
&& isVisibleNow();
58255828
}
58265829

58275830
boolean isNonToastWindowVisibleForPid(int pid) {
5828-
return mSession.mPid == pid && isNonToastOrStarting() && isVisibleNow();
5831+
return mSession.mPid == pid && isNonToastOrStartingOrPrivatePresentation()
5832+
&& isVisibleNow();
58295833
}
58305834

58315835
void setViewVisibility(int viewVisibility) {

0 commit comments

Comments
 (0)