Workaround for slow -1 drawing when swiping home

- Recents animation is the one most affected by this visually (other
  transitions are blocked from starting entirely, which is another
  issue).  TLDR, the -1 is always visible by modulates the alpha
  of its window as the user swipes to/from it.  As such, it's still
  considered an interesting window for allDrawn purposes, but in rare
  cases, AGSA may not be scheduled and the drawing of the -1 window
  even if it is alpha=0, will block Launcher's allDrawn state and
  prevent the Launcher surface from being shown.

  As a workaround, we ignore non-base windows associated with the
  recents animation target activity if their alpha is 0 for the purposes
  of considering when all windows are drawn.

Bug: 245407006
Test: TBD
Change-Id: I91ed411eb36e23f22c0a3b2bbbd80b6632b8c0b5
This commit is contained in:
Winson Chung
2022-09-23 05:10:38 +00:00
parent bc3406f638
commit 9989ffa47d
2 changed files with 22 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ public class RecentsAnimationController implements DeathRecipient {
private boolean mWillFinishToHome = false;
private final Runnable mFailsafeRunnable = this::onFailsafe;
// The recents component app token that is shown behind the visibile tasks
// The recents component app token that is shown behind the visible tasks
private ActivityRecord mTargetActivityRecord;
private DisplayContent mDisplayContent;
private int mTargetActivityType;
@@ -457,6 +457,22 @@ public class RecentsAnimationController implements DeathRecipient {
}
}
/**
* Return whether the given window should still be considered interesting for the all-drawn
* state. This is only interesting for the target app, which may have child windows that are
* not actually visible and should not be considered interesting and waited upon.
*/
protected boolean isInterestingForAllDrawn(WindowState window) {
if (isTargetApp(window.getActivityRecord())) {
if (window.getWindowType() != TYPE_BASE_APPLICATION
&& window.getAttrs().alpha == 0f) {
// If there is a cihld window that is alpha 0, then ignore that window
return false;
}
}
// By default all windows are still interesting for all drawn purposes
return true;
}
/**
* Whether a task should be filtered from the recents animation. This can be true for tasks

View File

@@ -2043,9 +2043,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* it must be drawn before allDrawn can become true.
*/
boolean isInteresting() {
final RecentsAnimationController recentsAnimationController =
mWmService.getRecentsAnimationController();
return mActivityRecord != null && !mAppDied
&& (!mActivityRecord.isFreezingScreen() || !mAppFreezing)
&& mViewVisibility == View.VISIBLE;
&& mViewVisibility == View.VISIBLE
&& (recentsAnimationController == null
|| recentsAnimationController.isInterestingForAllDrawn(this));
}
/**