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

Commit 46ba708b authored by Evan Rosky's avatar Evan Rosky
Browse files

Enable remote transition animations to append to the finish transaction

Adds a parameter to the IRemoteTransitionFinishedCallback. This
transaction will be merged into the finish transaction before it is
applied. This is needed by transitions like live-tile recents where
the end-state of the transition is altered during the "animation".

Bug: 172695387
Test: open app, swipe up to overview, resume that same app, screen
      shouldn't turn black anymore.
Change-Id: I6fa1e22288ce087ad17fdfc950a8419e6ba61a47
parent d939d3b4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -16,14 +16,18 @@

package android.window;

import android.view.SurfaceControl;
import android.window.WindowContainerTransaction;

/**
 * Interface to be invoked by the controlling process when a remote transition has finished.
 *
 * @see IRemoteTransition
 * @param wct An optional WindowContainerTransaction to apply before the transition finished.
 * @param sct An optional Surface Transaction that is added to the end of the finish/cleanup
 *            transaction. This is applied by shell.Transitions (before submitting the wct).
 * {@hide}
 */
interface IRemoteTransitionFinishedCallback {
    void onTransitionFinished(in WindowContainerTransaction wct);
    void onTransitionFinished(in WindowContainerTransaction wct, in SurfaceControl.Transaction sct);
}
+10 −4
Original line number Diff line number Diff line
@@ -71,12 +71,17 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {
        };
        IRemoteTransitionFinishedCallback cb = new IRemoteTransitionFinishedCallback.Stub() {
            @Override
            public void onTransitionFinished(WindowContainerTransaction wct) {
            public void onTransitionFinished(WindowContainerTransaction wct,
                    SurfaceControl.Transaction sct) {
                if (mRemote.asBinder() != null) {
                    mRemote.asBinder().unlinkToDeath(remoteDied, 0 /* flags */);
                }
                mMainExecutor.execute(
                        () -> finishCallback.onTransitionFinished(wct, null /* wctCB */));
                mMainExecutor.execute(() -> {
                    if (sct != null) {
                        finishTransaction.merge(sct);
                    }
                    finishCallback.onTransitionFinished(wct, null /* wctCB */);
                });
            }
        };
        try {
@@ -103,7 +108,8 @@ public class OneShotRemoteHandler implements Transitions.TransitionHandler {

        IRemoteTransitionFinishedCallback cb = new IRemoteTransitionFinishedCallback.Stub() {
            @Override
            public void onTransitionFinished(WindowContainerTransaction wct) {
            public void onTransitionFinished(WindowContainerTransaction wct,
                    SurfaceControl.Transaction sct) {
                mMainExecutor.execute(
                        () -> finishCallback.onTransitionFinished(wct, null /* wctCB */));
            }
+7 −2
Original line number Diff line number Diff line
@@ -133,11 +133,15 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
        };
        IRemoteTransitionFinishedCallback cb = new IRemoteTransitionFinishedCallback.Stub() {
            @Override
            public void onTransitionFinished(WindowContainerTransaction wct) {
            public void onTransitionFinished(WindowContainerTransaction wct,
                    SurfaceControl.Transaction sct) {
                if (remote.asBinder() != null) {
                    remote.asBinder().unlinkToDeath(remoteDied, 0 /* flags */);
                }
                mMainExecutor.execute(() -> {
                    if (sct != null) {
                        finishTransaction.merge(sct);
                    }
                    mRequestedRemotes.remove(transition);
                    finishCallback.onTransitionFinished(wct, null /* wctCB */);
                });
@@ -171,7 +175,8 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {

        IRemoteTransitionFinishedCallback cb = new IRemoteTransitionFinishedCallback.Stub() {
            @Override
            public void onTransitionFinished(WindowContainerTransaction wct) {
            public void onTransitionFinished(WindowContainerTransaction wct,
                    SurfaceControl.Transaction sct) {
                mMainExecutor.execute(() -> {
                    if (!mRequestedRemotes.containsKey(mergeTarget)) {
                        Log.e(TAG, "Merged transition finished after it's mergeTarget (the "
+1 −1
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ public class SplitTransitionTests extends ShellTestCase {
                IRemoteTransitionFinishedCallback finishCallback)
                throws RemoteException {
            mCalled = true;
            finishCallback.onTransitionFinished(mRemoteFinishWCT);
            finishCallback.onTransitionFinished(mRemoteFinishWCT, null /* sct */);
        }

        @Override
+3 −3
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ public class ShellTransitionTests {
                    SurfaceControl.Transaction t,
                    IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {
                remoteCalled[0] = true;
                finishCallback.onTransitionFinished(remoteFinishWCT);
                finishCallback.onTransitionFinished(remoteFinishWCT, null /* sct */);
            }

            @Override
@@ -287,7 +287,7 @@ public class ShellTransitionTests {
                    SurfaceControl.Transaction t,
                    IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {
                remoteCalled[0] = true;
                finishCallback.onTransitionFinished(null /* wct */);
                finishCallback.onTransitionFinished(null /* wct */, null /* sct */);
            }

            @Override
@@ -334,7 +334,7 @@ public class ShellTransitionTests {
                    SurfaceControl.Transaction t,
                    IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {
                remoteCalled[0] = true;
                finishCallback.onTransitionFinished(remoteFinishWCT);
                finishCallback.onTransitionFinished(remoteFinishWCT, null /* sct */);
            }

            @Override
Loading