Skip to content

Commit

Permalink
Ignore virtual presentation windows - RESTRICT AUTOMERGE
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Achim Thesmann authored and thestinger committed Sep 6, 2023
1 parent df4a936 commit b55563b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions services/core/java/com/android/server/wm/WindowState.java
Original file line number Diff line number Diff line change
Expand Up @@ -3596,12 +3596,20 @@ void onSurfaceShownChanged(boolean shown) {
// apps won't always be considered as foreground state.
// Exclude private presentations as they can only be shown on private virtual displays and
// shouldn't be the cause of an app be considered foreground.
if (mAttrs.type >= FIRST_SYSTEM_WINDOW && mAttrs.type != TYPE_TOAST
&& mAttrs.type != TYPE_PRIVATE_PRESENTATION) {
// Exclude presentations on virtual displays as they are not actually visible.
if (mAttrs.type >= FIRST_SYSTEM_WINDOW
&& mAttrs.type != TYPE_TOAST
&& mAttrs.type != TYPE_PRIVATE_PRESENTATION
&& !(mAttrs.type == TYPE_PRESENTATION && isOnVirtualDisplay())
) {
mWmService.mAtmService.mActiveUids.onNonAppSurfaceVisibilityChanged(mOwnerUid, shown);
}
}

private boolean isOnVirtualDisplay() {
return getDisplayContent().mDisplay.getType() == Display.TYPE_VIRTUAL;
}

private void logExclusionRestrictions(int side) {
if (!logsGestureExclusionRestrictions(this)
|| SystemClock.uptimeMillis() < mLastExclusionLogUptimeMillis[side]
Expand Down

0 comments on commit b55563b

Please sign in to comment.