Merge "Make recents transition wrapper implement IRAC" into udc-dev am: fb32cc4be8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21692404

Change-Id: I0975be1256a9c5b7410d9a622d7a32c3c761787c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Evan Rosky
2023-03-03 02:16:56 +00:00
committed by Automerger Merge Worker

View File

@@ -43,7 +43,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;
@@ -56,7 +55,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;
@@ -67,7 +66,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
@@ -96,9 +95,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;
/**
@@ -135,7 +133,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) {
@@ -143,7 +141,6 @@ public class RemoteTransitionCompat {
+ " recents is already active.");
}
mListener = listener;
mWrapped = wrapped;
mInfo = info;
mFinishCB = finishedCallback;
mPausingTasks = new ArrayList<>();
@@ -200,7 +197,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());
}
@@ -342,13 +340,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);
}
@@ -356,30 +350,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
@@ -389,7 +377,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();
@@ -462,7 +449,6 @@ public class RemoteTransitionCompat {
// for releasing the leashes created by local.
mInfo.releaseAllSurfaces();
// Reset all members.
mWrapped = null;
mListener = null;
mFinishCB = null;
mPausingTasks = null;
@@ -476,23 +462,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;
}
/**