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

Commit e8f37591 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Notify transition ready for player before taking snapshot

So SnapshotController and shell's onTransitionReady can run in parallel.
That reduces the latency before starting the animator.

Theoretically, the binder transmission time of transition info is
usually enough to complete the snapshot. However, even if hardcoding
hundreds millisecond to delay the snapshot until the transition is
finished, the snapshot is still captured successfully, so it should be
safe to reorder.

Bug: 279437990
Bug: 297493149
Test: TransitionTests#testTransientLaunch
      KeyboardVisibilityControlTest
Test: Disable animation. Launch/back between different tasks.
      The valid snapshot of the closed task can still be shown in recent.
Change-Id: Id3cc1cc47412c098c8c8e8d63a09367772527400
parent 7b4ab317
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -1597,13 +1597,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            }
        }

        // Take task snapshots before the animation so that we can capture IME before it gets
        // transferred. If transition is transient, IME won't be moved during the transition and
        // the tasks are still live, so we take the snapshot at the end of the transition instead.
        if (mTransientLaunches == null) {
            mController.mSnapshotController.onTransactionReady(mType, mTargets);
        }

        // This is non-null only if display has changes. It handles the visible windows that don't
        // need to be participated in the transition.
        for (int i = 0; i < mTargetDisplays.size(); ++i) {
@@ -1654,6 +1647,16 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {

        reportStartReasonsToLogger();

        // Take snapshots for closing tasks/activities before the animation finished but after
        // dispatching onTransitionReady, so IME (if there is) can be captured together and the
        // time spent on snapshot won't delay the start of animation. Note that if this transition
        // is transient (mTransientLaunches != null), the snapshot will be captured at the end of
        // the transition, because IME won't move be moved during the transition and the tasks are
        // still live.
        if (mTransientLaunches == null) {
            mController.mSnapshotController.onTransactionReady(mType, mTargets);
        }

        // Since we created root-leash but no longer reference it from core, release it now
        info.releaseAnimSurfaces();