Merge "Save multiple RunningTaskInfo in GestureState" into sc-v2-dev

This commit is contained in:
Vinit Nayak 2021-12-16 00:03:20 +00:00 committed by Android (Google) Code Review
commit 20102c3dd7
3 changed files with 28 additions and 5 deletions

View File

@ -569,9 +569,14 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
runningTasks = new ActivityManager.RunningTaskInfo[splitTaskIds.length];
for (int i = 0; i < splitTaskIds.length; i++) {
int taskId = splitTaskIds[i];
ActivityManager.RunningTaskInfo rti = new ActivityManager.RunningTaskInfo();
rti.taskId = taskId;
runningTasks[i] = rti;
// Order matters here, we want first indexed RunningTaskInfo to be leftTop task
for (ActivityManager.RunningTaskInfo rti : mGestureState.getRunningTasks()) {
if (taskId == rti.taskId) {
runningTasks[i] = rti;
break;
}
}
}
} else {
runningTasks = new ActivityManager.RunningTaskInfo[]{mGestureState.getRunningTask()};

View File

@ -135,6 +135,7 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
private final int mGestureId;
private ActivityManager.RunningTaskInfo mRunningTask;
private ActivityManager.RunningTaskInfo[] mRunningTasks;
private GestureEndTarget mEndTarget;
private RemoteAnimationTargetCompat mLastAppearedTaskTarget;
private Set<Integer> mPreviouslyAppearedTaskIds = new HashSet<>();
@ -234,6 +235,14 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
return mRunningTask;
}
/**
* This will array will contain the task returned by {@link #getRunningTask()}
* @return the running tasks for this gesture.
*/
public ActivityManager.RunningTaskInfo[] getRunningTasks() {
return mRunningTasks;
}
/**
* @return the running task id for this gesture.
*/
@ -248,6 +257,15 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
mRunningTask = runningTask;
}
/**
* TODO(b/210903248) refactor to consolidate w/ method above
* Updates the running task for the gesture to be the given {@param runningTask}.
*/
public void updateRunningTasks(ActivityManager.RunningTaskInfo[] runningTasks) {
mRunningTasks = runningTasks;
updateRunningTask(runningTasks[0]);
}
/**
* Updates the last task that appeared during this gesture.
*/

View File

@ -665,8 +665,8 @@ public class TouchInteractionService extends Service
gestureState.updatePreviouslyAppearedTaskIds(
previousGestureState.getPreviouslyAppearedTaskIds());
} else {
gestureState.updateRunningTask(TraceHelper.allowIpcs("getRunningTask.0",
() -> mAM.getRunningTask(false /* filterOnlyVisibleRecents */)));
gestureState.updateRunningTasks(TraceHelper.allowIpcs("getRunningTask.0",
() -> mAM.getRunningTasks(false /* filterOnlyVisibleRecents */)));
}
return gestureState;
}