Skip to content

Commit e6171cf

Browse files
Achim ThesmannAndroid Build Coastguard Worker
authored andcommitted
Ignore virtual presentation windows - RESTRICT AUTOMERGE
Windows of TYPE_PRESENTATION on virtual displays should not be counted as visible windows to determine if BAL is allowed. Test: manual test, atest BackgroundActivityLaunchTest Bug: 264029851, 205130886 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4c40b187cd5277c27d20758c675865bf89180c7a) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5bf9607bec3f1224158cfcff7dd91ac558b46c0f) Merged-In: I08b16ba1c155e951286ddc22019180cbd6334dfa Change-Id: I08b16ba1c155e951286ddc22019180cbd6334dfa
1 parent 66e18e6 commit e6171cf

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3596,12 +3596,20 @@ void onSurfaceShownChanged(boolean shown) {
35963596
// apps won't always be considered as foreground state.
35973597
// Exclude private presentations as they can only be shown on private virtual displays and
35983598
// shouldn't be the cause of an app be considered foreground.
3599-
if (mAttrs.type >= FIRST_SYSTEM_WINDOW && mAttrs.type != TYPE_TOAST
3600-
&& mAttrs.type != TYPE_PRIVATE_PRESENTATION) {
3599+
// Exclude presentations on virtual displays as they are not actually visible.
3600+
if (mAttrs.type >= FIRST_SYSTEM_WINDOW
3601+
&& mAttrs.type != TYPE_TOAST
3602+
&& mAttrs.type != TYPE_PRIVATE_PRESENTATION
3603+
&& !(mAttrs.type == TYPE_PRESENTATION && isOnVirtualDisplay())
3604+
) {
36013605
mWmService.mAtmService.mActiveUids.onNonAppSurfaceVisibilityChanged(mOwnerUid, shown);
36023606
}
36033607
}
36043608

3609+
private boolean isOnVirtualDisplay() {
3610+
return getDisplayContent().mDisplay.getType() == Display.TYPE_VIRTUAL;
3611+
}
3612+
36053613
private void logExclusionRestrictions(int side) {
36063614
if (!logsGestureExclusionRestrictions(this)
36073615
|| SystemClock.uptimeMillis() < mLastExclusionLogUptimeMillis[side]

0 commit comments

Comments
 (0)