summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/wm/RecentsAnimationController.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index e21ae05c0827..0495302533a5 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -97,6 +97,9 @@ public class RecentsAnimationController implements DeathRecipient {
*/
private static final long LATENCY_TRACKER_LOG_DELAY_MS = 300;
+ // Constant for a yet-to-be-calculated {@link RemoteAnimationTarget#Mode} state
+ private static final int MODE_UNKNOWN = -1;
+
public static final int REORDER_KEEP_IN_PLACE = 0;
public static final int REORDER_MOVE_TO_TOP = 1;
public static final int REORDER_MOVE_TO_ORIGINAL_POSITION = 2;
@@ -704,7 +707,8 @@ public class RecentsAnimationController implements DeathRecipient {
if (isAnimatingTask(task) || skipAnimation(task)) {
return;
}
- final RemoteAnimationTarget target = createTaskRemoteAnimation(task, finishedCallback);
+ final RemoteAnimationTarget target = createTaskRemoteAnimation(task, MODE_OPENING,
+ finishedCallback);
if (target == null) {
return;
}
@@ -725,7 +729,7 @@ public class RecentsAnimationController implements DeathRecipient {
}
}
- private RemoteAnimationTarget createTaskRemoteAnimation(Task task,
+ private RemoteAnimationTarget createTaskRemoteAnimation(Task task, int mode,
OnAnimationFinishedCallback finishedCallback) {
final SparseBooleanArray recentTaskIds =
mService.mAtmService.getRecentTasks().getRecentTaskIds();
@@ -737,7 +741,7 @@ public class RecentsAnimationController implements DeathRecipient {
TaskAnimationAdapter adapter = addAnimation(task,
!recentTaskIds.get(taskId), true /* hidden */, finishedCallback);
mPendingNewTaskTargets.add(taskId);
- return adapter.createRemoteAnimationTarget(taskId);
+ return adapter.createRemoteAnimationTarget(taskId, mode);
}
void logRecentsAnimationStartTime(int durationMs) {
@@ -773,7 +777,7 @@ public class RecentsAnimationController implements DeathRecipient {
for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
final TaskAnimationAdapter taskAdapter = mPendingAnimations.get(i);
final RemoteAnimationTarget target =
- taskAdapter.createRemoteAnimationTarget(INVALID_TASK_ID);
+ taskAdapter.createRemoteAnimationTarget(INVALID_TASK_ID, MODE_UNKNOWN);
if (target != null) {
targets.add(target);
} else {
@@ -1196,8 +1200,11 @@ public class RecentsAnimationController implements DeathRecipient {
* some cases where we are animating root tasks but need need leaf
* ids for identification. If this is INVALID (-1), then mTaskId
* will be used.
+ * @param overrideMode overrides the target's mode. If this is -1, the mode will be
+ * calculated relative to going to the target activity (ie. OPENING if
+ * this is the target task, CLOSING otherwise).
*/
- RemoteAnimationTarget createRemoteAnimationTarget(int overrideTaskId) {
+ RemoteAnimationTarget createRemoteAnimationTarget(int overrideTaskId, int overrideMode) {
final ActivityRecord topApp = mTask.getTopVisibleActivity();
final WindowState mainWindow = topApp != null
? topApp.findMainWindow()
@@ -1208,9 +1215,11 @@ public class RecentsAnimationController implements DeathRecipient {
final Rect insets = mainWindow.getInsetsStateWithVisibilityOverride().calculateInsets(
mBounds, Type.systemBars(), false /* ignoreVisibility */).toRect();
InsetUtils.addInsets(insets, mainWindow.mActivityRecord.getLetterboxInsets());
- final int mode = topApp.getActivityType() == mTargetActivityType
- ? MODE_OPENING
- : MODE_CLOSING;
+ final int mode = overrideMode != MODE_UNKNOWN
+ ? overrideMode
+ : topApp.getActivityType() == mTargetActivityType
+ ? MODE_OPENING
+ : MODE_CLOSING;
if (overrideTaskId < 0) {
overrideTaskId = mTask.mTaskId;
}