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

Commit bf678707 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Reset the remote transition references on the main shell thread" into main

parents 3b8bcbc9 e9d61ec1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -451,6 +451,8 @@ class SplitScreenTransitions {
            mPendingResize.onConsumed(aborted);
            mPendingResize = null;
        }

        // TODO: handle transition consumed for active remote handler
    }

    void onFinish(WindowContainerTransaction wct) {
+13 −3
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
            @Override
            public void onTransitionFinished(WindowContainerTransaction wct,
                    SurfaceControl.Transaction sct) {
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
                        "Finished one-shot remote transition %s for (#%d).", mRemote,
                        info.getDebugId());
                if (mRemote.asBinder() != null) {
                    mRemote.asBinder().unlinkToDeath(remoteDied, 0 /* flags */);
                }
@@ -82,8 +85,8 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
                }
                mMainExecutor.execute(() -> {
                    finishCallback.onTransitionFinished(wct);
                });
                    mRemote = null;
                });
            }
        };
        Transitions.setRunningRemoteTransitionDelegate(mRemote.getAppThread());
@@ -115,17 +118,24 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
    public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
            @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,
            @NonNull Transitions.TransitionFinishCallback finishCallback) {
        ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Merging registered One-shot remote"
                + " transition %s for (#%d).", mRemote, info.getDebugId());
        IRemoteTransitionFinishedCallback cb = new IRemoteTransitionFinishedCallback.Stub() {
            @Override
            public void onTransitionFinished(WindowContainerTransaction wct,
                    SurfaceControl.Transaction sct) {
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
                        "Finished merging one-shot remote transition %s for (#%d).", mRemote,
                        info.getDebugId());
                // We have merged, since we sent the transaction over binder, the one in this
                // process won't be cleared if the remote applied it. We don't actually know if the
                // remote applied the transaction, but applying twice will break surfaceflinger
                // so just assume the worst-case and clear the local transaction.
                t.clear();
                mMainExecutor.execute(() -> finishCallback.onTransitionFinished(wct));
                mMainExecutor.execute(() -> {
                    finishCallback.onTransitionFinished(wct);
                    mRemote = null;
                });
            }
        };
        try {