Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c90595c9 authored by Evan Rosky's avatar Evan Rosky
Browse files

Prevent premature-ready between activity finish and completePause

when starting an activity, due to lifecycle mechanics, WM waits
for the prior activity to pause before starting the new activity.

If an activity starts a new activity and then finishes itself
immediately, there is a short-window where neither it nor the
next activity is visibleRequested so if a syncgroup is already
marked ready, its possible for the sync to finish prematurely.

Normally, we try to manage the readiness; however, if the
activity-start came from WCT, the SyncGroup will be marked
allready.

This CL adds a check to prevent a pausing activity from being
considered sync-finished until visibility is recalculated in
completePause

Bug: 361127213
Test: Launch a trampolining task (eg. calendar) from a shortcut
      (specifically via WCT pendingIntent) multiple times and
      observe no Transition error message.
Flag: EXEMPT bugfig
Change-Id: Ie7733a62eea865f1f67f20ae5cc162c57325e190
parent 3e55b3ff
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -10286,7 +10286,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                .isVisibilityUnknown(this)) {
            return false;
        }
        if (!isVisibleRequested()) return true;
        if (!isVisibleRequested()) {
            // TODO(b/294925498): Remove this finishing check once we have accurate ready tracking.
            if (task != null && task.getPausingActivity() == this) {
                // Visibility of starting activities isn't calculated until pause-complete, so if
                // this is not paused yet, don't consider it ready.
                return false;
            }
            return true;
        }
        if (mPendingRelaunchCount > 0) return false;
        // Wait for attach. That is the earliest time where we know if there will be an associated
        // display rotation. If we don't wait, the starting-window can finishDrawing first and