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

Commit cf6d9d86 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Boost remote animation process earlier" into main

parents 2d2adf05 6e2f0aae
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -173,7 +173,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
    private final TransitionController mController;
    private final BLASTSyncEngine mSyncEngine;
    private final Token mToken;
    private IApplicationThread mRemoteAnimApp;

    private @Nullable ActivityRecord mPipActivity;

@@ -1485,13 +1484,14 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        return mForcePlaying;
    }

    /** Adjusts the priority of the process which will run the transition animation. */
    void setRemoteAnimationApp(IApplicationThread app) {
        mRemoteAnimApp = app;
        final WindowProcessController wpc = mController.mAtm.getProcessController(app);
        if (wpc != null) {
            // This is an early prediction. If the process doesn't ack the animation in 200 ms,
            // the priority will be restored.
            mController.mRemotePlayer.update(wpc, true /* running */, true /* predict */);
        }

    /** Returns the app which will run the transition animation. */
    IApplicationThread getRemoteAnimationApp() {
        return mRemoteAnimApp;
    }

    void setNoAnimation(WindowContainer wc) {
+1 −7
Original line number Diff line number Diff line
@@ -1251,13 +1251,7 @@ class TransitionController {
        } else if (mPlayingTransitions.isEmpty()) {
            mTransitionPlayerProc.setRunningRemoteAnimation(false);
            mRemotePlayer.clear();
            return;
        }
        final IApplicationThread appThread = transition.getRemoteAnimationApp();
        if (appThread == null || appThread == mTransitionPlayerProc.getThread()) return;
        final WindowProcessController delegate = mAtm.getProcessController(appThread);
        if (delegate == null) return;
        mRemotePlayer.update(delegate, isPlaying, true /* predict */);
    }

    /** Called when a transition is aborted. This should only be called by {@link Transition} */
@@ -1483,7 +1477,7 @@ class TransitionController {
     * {@link #mTransitionPlayerProc}.
     */
    static class RemotePlayer {
        private static final long REPORT_RUNNING_GRACE_PERIOD_MS = 100;
        private static final long REPORT_RUNNING_GRACE_PERIOD_MS = 200;
        @GuardedBy("itself")
        private final ArrayMap<IBinder, DelegateProcess> mDelegateProcesses = new ArrayMap<>();
        private final ActivityTaskManagerService mAtm;
+1 −1
Original line number Diff line number Diff line
@@ -636,6 +636,7 @@ public class TransitionTests extends WindowTestsBase {
        transition.collect(app);
        controller.requestStartTransition(transition, null /* startTask */, remoteTransition,
                null /* displayChange */);
        assertTrue(delegateProc.isRunningRemoteTransition());
        testPlayer.startTransition();
        app.onStartingWindowDrawn();
        // The task appeared event should be deferred until transition ready.
@@ -643,7 +644,6 @@ public class TransitionTests extends WindowTestsBase {
        testPlayer.onTransactionReady(app.getSyncTransaction());
        assertTrue(task.taskAppearedReady());
        assertTrue(playerProc.isRunningRemoteTransition());
        assertTrue(delegateProc.isRunningRemoteTransition());
        assertTrue(controller.mRemotePlayer.reportRunning(delegateProc.getThread()));
        assertTrue(app.isVisible());