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

Commit 1ee94742 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Use latest surface of parent for finish transaction on failure

For example:
(1) A transition is playing.
    Its finish transaction contains the restore operations.
(2) SystemUI died/crashed
(3) Update new surface for organized DisplayArea
    DisplayAreaOrganizerController.DeathRecipient#binderDied
     DisplayAreaOrganizerState#destroy
      setOrganizer(null)
       sendDisplayAreaVanished
        migrateToNewSurfaceControl
(4) Update new surface for organized Task
    TaskOrganizerController#DeathRecipient.binderDied
     TaskOrganizerState#dispose
      removeTask
       migrateToNewSurfaceControl
(5) Cleanup playing transition
    TransitionController.TransitionPlayerRecord#mDeath
     unregisterTransitionPlayer
      flushRunningTransitions
       cleanUpOnFailure
        mFinishTransaction.apply()
         ^ old surfaces were removed by (3) and (4).
           Then the transition targets become off-screen.

Bug: 420956820
Flag: EXEMPT bugfix
Test: Enlarge transition animation scale to 5x.
      Trigger a display transition (e.g. resize,rotate).
      Kill SystemUI before the transition is finished.
      After SystemUI restarted, the screen should not be blank.
Change-Id: I13441d0ffd366ac3eb20fc5983fc821f1d81a61d
parent bccf1b44
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2389,6 +2389,18 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            mStartTransaction.apply();
        }
        if (mFinishTransaction != null) {
            Slog.i(TAG, "cleanUpOnFailure for #" + mSyncId);
            // In case this is called from DeathRecipient of ITransitionPlayer, which usually means
            // that the organizers are also dead. And when deposing the organizers, it will call
            // WindowContainer#migrateToNewSurfaceControl to reset the containers which were
            // organized. So make sure the finish transaction uses the new surface of parents.
            for (int i = mTargets.size() - 1; i >= 0; --i) {
                final WindowContainer<?> target = mTargets.get(i).mContainer;
                if (target.getParent() == null) continue;
                final SurfaceControl targetLeash = getLeashSurface(target, null /* t */);
                final SurfaceControl origParent = getOrigParentSurface(target);
                mFinishTransaction.reparent(targetLeash, origParent);
            }
            mFinishTransaction.apply();
        }
        mController.finishTransition(mController.mAtm.mChainTracker.startFinish("clean-up", this));