Merge "Make recents transition wrapper implement IRAC" into udc-dev
This commit is contained in:
@@ -43,7 +43,6 @@ import android.window.WindowContainerToken;
|
|||||||
import android.window.WindowContainerTransaction;
|
import android.window.WindowContainerTransaction;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
|
||||||
import com.android.wm.shell.util.TransitionUtil;
|
import com.android.wm.shell.util.TransitionUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -56,7 +55,7 @@ public class RemoteTransitionCompat {
|
|||||||
|
|
||||||
/** Constructor specifically for recents animation */
|
/** Constructor specifically for recents animation */
|
||||||
public static RemoteTransition newRemoteTransition(RecentsAnimationListener recents,
|
public static RemoteTransition newRemoteTransition(RecentsAnimationListener recents,
|
||||||
RecentsAnimationControllerCompat controller, IApplicationThread appThread) {
|
IApplicationThread appThread) {
|
||||||
IRemoteTransition remote = new IRemoteTransition.Stub() {
|
IRemoteTransition remote = new IRemoteTransition.Stub() {
|
||||||
final RecentsControllerWrap mRecentsSession = new RecentsControllerWrap();
|
final RecentsControllerWrap mRecentsSession = new RecentsControllerWrap();
|
||||||
IBinder mToken = null;
|
IBinder mToken = null;
|
||||||
@@ -67,7 +66,7 @@ public class RemoteTransitionCompat {
|
|||||||
IRemoteTransitionFinishedCallback finishedCallback) {
|
IRemoteTransitionFinishedCallback finishedCallback) {
|
||||||
// TODO(b/177438007): Move this set-up logic into launcher's animation impl.
|
// TODO(b/177438007): Move this set-up logic into launcher's animation impl.
|
||||||
mToken = transition;
|
mToken = transition;
|
||||||
mRecentsSession.start(controller, recents, mToken, info, t, finishedCallback);
|
mRecentsSession.start(recents, mToken, info, t, finishedCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -96,9 +95,8 @@ public class RemoteTransitionCompat {
|
|||||||
* TODO(b/177438007): Remove this once Launcher handles shell transitions directly.
|
* TODO(b/177438007): Remove this once Launcher handles shell transitions directly.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static class RecentsControllerWrap extends RecentsAnimationControllerCompat {
|
static class RecentsControllerWrap extends IRecentsAnimationController.Default {
|
||||||
private RecentsAnimationListener mListener = null;
|
private RecentsAnimationListener mListener = null;
|
||||||
private RecentsAnimationControllerCompat mWrapped = null;
|
|
||||||
private IRemoteTransitionFinishedCallback mFinishCB = null;
|
private IRemoteTransitionFinishedCallback mFinishCB = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,7 +133,7 @@ public class RemoteTransitionCompat {
|
|||||||
/** The latest state that the recents animation is operating in. */
|
/** The latest state that the recents animation is operating in. */
|
||||||
private int mState = STATE_NORMAL;
|
private int mState = STATE_NORMAL;
|
||||||
|
|
||||||
void start(RecentsAnimationControllerCompat wrapped, RecentsAnimationListener listener,
|
void start(RecentsAnimationListener listener,
|
||||||
IBinder transition, TransitionInfo info, SurfaceControl.Transaction t,
|
IBinder transition, TransitionInfo info, SurfaceControl.Transaction t,
|
||||||
IRemoteTransitionFinishedCallback finishedCallback) {
|
IRemoteTransitionFinishedCallback finishedCallback) {
|
||||||
if (mInfo != null) {
|
if (mInfo != null) {
|
||||||
@@ -143,7 +141,6 @@ public class RemoteTransitionCompat {
|
|||||||
+ " recents is already active.");
|
+ " recents is already active.");
|
||||||
}
|
}
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mWrapped = wrapped;
|
|
||||||
mInfo = info;
|
mInfo = info;
|
||||||
mFinishCB = finishedCallback;
|
mFinishCB = finishedCallback;
|
||||||
mPausingTasks = new ArrayList<>();
|
mPausingTasks = new ArrayList<>();
|
||||||
@@ -200,7 +197,8 @@ public class RemoteTransitionCompat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.apply();
|
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()]),
|
wallpapers.toArray(new RemoteAnimationTarget[wallpapers.size()]),
|
||||||
new Rect(0, 0, 0, 0), new Rect());
|
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 {
|
try {
|
||||||
final TaskSnapshot snapshot =
|
return ActivityTaskManager.getService().takeTaskSnapshot(taskId);
|
||||||
ActivityTaskManager.getService().takeTaskSnapshot(taskId);
|
|
||||||
if (snapshot != null) {
|
|
||||||
return new ThumbnailData(snapshot);
|
|
||||||
}
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Failed to screenshot task", e);
|
Log.e(TAG, "Failed to screenshot task", e);
|
||||||
}
|
}
|
||||||
@@ -356,30 +350,24 @@ public class RemoteTransitionCompat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setInputConsumerEnabled(boolean enabled) {
|
@Override public void setInputConsumerEnabled(boolean enabled) {
|
||||||
if (enabled) {
|
if (!enabled) return;
|
||||||
// transient launches don't receive focus automatically. Since we are taking over
|
// transient launches don't receive focus automatically. Since we are taking over
|
||||||
// the gesture now, take focus explicitly.
|
// the gesture now, take focus explicitly.
|
||||||
// This also moves recents back to top if the user gestured before a switch
|
// This also moves recents back to top if the user gestured before a switch
|
||||||
// animation finished.
|
// animation finished.
|
||||||
try {
|
try {
|
||||||
ActivityTaskManager.getService().setFocusedTask(mRecentsTaskId);
|
ActivityTaskManager.getService().setFocusedTask(mRecentsTaskId);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Failed to set focused task", e);
|
Log.e(TAG, "Failed to set focused task", e);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mWrapped != null) mWrapped.setInputConsumerEnabled(enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) {
|
@Override public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) {
|
||||||
if (mWrapped != null) mWrapped.setAnimationTargetsBehindSystemBars(behindSystemBars);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setFinishTaskTransaction(int taskId,
|
@Override public void setFinishTaskTransaction(int taskId,
|
||||||
PictureInPictureSurfaceTransaction finishTransaction, SurfaceControl overlay) {
|
PictureInPictureSurfaceTransaction finishTransaction, SurfaceControl overlay) {
|
||||||
mPipTransaction = finishTransaction;
|
mPipTransaction = finishTransaction;
|
||||||
if (mWrapped != null) {
|
|
||||||
mWrapped.setFinishTaskTransaction(taskId, finishTransaction, overlay);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -389,7 +377,6 @@ public class RemoteTransitionCompat {
|
|||||||
Log.e(TAG, "Duplicate call to finish", new RuntimeException());
|
Log.e(TAG, "Duplicate call to finish", new RuntimeException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mWrapped != null) mWrapped.finish(toHome, sendUserLeaveHint);
|
|
||||||
final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
|
final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
|
|
||||||
@@ -462,7 +449,6 @@ public class RemoteTransitionCompat {
|
|||||||
// for releasing the leashes created by local.
|
// for releasing the leashes created by local.
|
||||||
mInfo.releaseAllSurfaces();
|
mInfo.releaseAllSurfaces();
|
||||||
// Reset all members.
|
// Reset all members.
|
||||||
mWrapped = null;
|
|
||||||
mListener = null;
|
mListener = null;
|
||||||
mFinishCB = null;
|
mFinishCB = null;
|
||||||
mPausingTasks = null;
|
mPausingTasks = null;
|
||||||
@@ -476,23 +462,20 @@ public class RemoteTransitionCompat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) {
|
@Override public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) {
|
||||||
if (mWrapped != null) mWrapped.setDeferCancelUntilNextTransition(defer, screenshot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void cleanupScreenshot() {
|
@Override public void cleanupScreenshot() {
|
||||||
if (mWrapped != null) mWrapped.cleanupScreenshot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setWillFinishToHome(boolean willFinishToHome) {
|
@Override public void setWillFinishToHome(boolean willFinishToHome) {
|
||||||
mWillFinishToHome = willFinishToHome;
|
mWillFinishToHome = willFinishToHome;
|
||||||
if (mWrapped != null) mWrapped.setWillFinishToHome(willFinishToHome);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see IRecentsAnimationController#removeTask
|
* @see IRecentsAnimationController#removeTask
|
||||||
*/
|
*/
|
||||||
@Override public boolean removeTask(int taskId) {
|
@Override public boolean removeTask(int taskId) {
|
||||||
return mWrapped != null ? mWrapped.removeTask(taskId) : false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user