diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java index 70a36ce7e9045..485b201ab4cc8 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java @@ -45,7 +45,6 @@ import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; import com.android.internal.annotations.VisibleForTesting; -import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.wm.shell.util.TransitionUtil; import java.util.ArrayList; @@ -58,7 +57,7 @@ public class RemoteTransitionCompat { /** Constructor specifically for recents animation */ public static RemoteTransition newRemoteTransition(RecentsAnimationListener recents, - RecentsAnimationControllerCompat controller, IApplicationThread appThread) { + IApplicationThread appThread) { IRemoteTransition remote = new IRemoteTransition.Stub() { final RecentsControllerWrap mRecentsSession = new RecentsControllerWrap(); IBinder mToken = null; @@ -69,7 +68,7 @@ public class RemoteTransitionCompat { IRemoteTransitionFinishedCallback finishedCallback) { // TODO(b/177438007): Move this set-up logic into launcher's animation impl. mToken = transition; - mRecentsSession.start(controller, recents, mToken, info, t, finishedCallback); + mRecentsSession.start(recents, mToken, info, t, finishedCallback); } @Override @@ -98,9 +97,8 @@ public class RemoteTransitionCompat { * TODO(b/177438007): Remove this once Launcher handles shell transitions directly. */ @VisibleForTesting - static class RecentsControllerWrap extends RecentsAnimationControllerCompat { + static class RecentsControllerWrap extends IRecentsAnimationController.Default { private RecentsAnimationListener mListener = null; - private RecentsAnimationControllerCompat mWrapped = null; private IRemoteTransitionFinishedCallback mFinishCB = null; /** @@ -137,7 +135,7 @@ public class RemoteTransitionCompat { /** The latest state that the recents animation is operating in. */ private int mState = STATE_NORMAL; - void start(RecentsAnimationControllerCompat wrapped, RecentsAnimationListener listener, + void start(RecentsAnimationListener listener, IBinder transition, TransitionInfo info, SurfaceControl.Transaction t, IRemoteTransitionFinishedCallback finishedCallback) { if (mInfo != null) { @@ -145,7 +143,6 @@ public class RemoteTransitionCompat { + " recents is already active."); } mListener = listener; - mWrapped = wrapped; mInfo = info; mFinishCB = finishedCallback; mPausingTasks = new ArrayList<>(); @@ -203,7 +200,8 @@ public class RemoteTransitionCompat { } } t.apply(); - mListener.onAnimationStart(this, apps.toArray(new RemoteAnimationTarget[apps.size()]), + mListener.onAnimationStart(new RecentsAnimationControllerCompat(this), + apps.toArray(new RemoteAnimationTarget[apps.size()]), wallpapers.toArray(new RemoteAnimationTarget[wallpapers.size()]), new Rect(0, 0, 0, 0), new Rect()); } @@ -337,13 +335,9 @@ public class RemoteTransitionCompat { } } - @Override public ThumbnailData screenshotTask(int taskId) { + @Override public TaskSnapshot screenshotTask(int taskId) { try { - final TaskSnapshot snapshot = - ActivityTaskManager.getService().takeTaskSnapshot(taskId); - if (snapshot != null) { - return new ThumbnailData(snapshot); - } + return ActivityTaskManager.getService().takeTaskSnapshot(taskId); } catch (RemoteException e) { Log.e(TAG, "Failed to screenshot task", e); } @@ -351,30 +345,24 @@ public class RemoteTransitionCompat { } @Override public void setInputConsumerEnabled(boolean enabled) { - if (enabled) { - // transient launches don't receive focus automatically. Since we are taking over - // the gesture now, take focus explicitly. - // This also moves recents back to top if the user gestured before a switch - // animation finished. - try { - ActivityTaskManager.getService().setFocusedTask(mRecentsTaskId); - } catch (RemoteException e) { - Log.e(TAG, "Failed to set focused task", e); - } + if (!enabled) return; + // transient launches don't receive focus automatically. Since we are taking over + // the gesture now, take focus explicitly. + // This also moves recents back to top if the user gestured before a switch + // animation finished. + try { + ActivityTaskManager.getService().setFocusedTask(mRecentsTaskId); + } catch (RemoteException e) { + Log.e(TAG, "Failed to set focused task", e); } - if (mWrapped != null) mWrapped.setInputConsumerEnabled(enabled); } @Override public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) { - if (mWrapped != null) mWrapped.setAnimationTargetsBehindSystemBars(behindSystemBars); } @Override public void setFinishTaskTransaction(int taskId, PictureInPictureSurfaceTransaction finishTransaction, SurfaceControl overlay) { mPipTransaction = finishTransaction; - if (mWrapped != null) { - mWrapped.setFinishTaskTransaction(taskId, finishTransaction, overlay); - } } @Override @@ -384,7 +372,6 @@ public class RemoteTransitionCompat { Log.e(TAG, "Duplicate call to finish", new RuntimeException()); return; } - if (mWrapped != null) mWrapped.finish(toHome, sendUserLeaveHint); final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); final WindowContainerTransaction wct = new WindowContainerTransaction(); @@ -457,7 +444,6 @@ public class RemoteTransitionCompat { // for releasing the leashes created by local. mInfo.releaseAllSurfaces(); // Reset all members. - mWrapped = null; mListener = null; mFinishCB = null; mPausingTasks = null; @@ -471,23 +457,20 @@ public class RemoteTransitionCompat { } @Override public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) { - if (mWrapped != null) mWrapped.setDeferCancelUntilNextTransition(defer, screenshot); } @Override public void cleanupScreenshot() { - if (mWrapped != null) mWrapped.cleanupScreenshot(); } @Override public void setWillFinishToHome(boolean willFinishToHome) { mWillFinishToHome = willFinishToHome; - if (mWrapped != null) mWrapped.setWillFinishToHome(willFinishToHome); } /** * @see IRecentsAnimationController#removeTask */ @Override public boolean removeTask(int taskId) { - return mWrapped != null ? mWrapped.removeTask(taskId) : false; + return false; } /**