Migrate from using taskIDs to taskViewIDs in RecentsView

* Follow up CL coming to introduce a TaskView that
can have multiple Tasks, so a taskID won't be particularly useful
in that scenario.

Bug: 192292305
Test: Manual, w/ and w/o live tile
Change-Id: I1900b999ac51aa99923239f2af400c90c71c3dae
This commit is contained in:
Vinit Nayak
2021-07-27 18:28:10 -07:00
parent 2095731650
commit 51a6c92174
6 changed files with 183 additions and 76 deletions
@@ -366,6 +366,9 @@ public class TaskView extends FrameLayout implements Reusable {
private float mModalness = 0;
private float mStableAlpha = 1;
private int mTaskViewId = -1;
private final int[] mTaskIdContainer = new int[]{-1, -1};
private boolean mShowScreenshot;
// The current background requests to load the task thumbnail and icon
@@ -401,6 +404,14 @@ public class TaskView extends FrameLayout implements Reusable {
setOutlineProvider(mOutlineProvider);
}
public void setTaskViewId(int id) {
this.mTaskViewId = id;
}
public int getTaskViewId() {
return mTaskViewId;
}
/**
* Builds proto for logging
*/
@@ -506,6 +517,7 @@ public class TaskView extends FrameLayout implements Reusable {
public void bind(Task task, RecentsOrientedState orientedState) {
cancelPendingLoadTasks();
mTask = task;
mTaskIdContainer[0] = mTask.key.id;
mSnapshotView.bind(task);
setOrientationState(orientedState);
}
@@ -514,8 +526,12 @@ public class TaskView extends FrameLayout implements Reusable {
return mTask;
}
public int getTaskId() {
return mTask != null && mTask.key != null ? mTask.key.id : -1;
/**
* @return integer array of two elements to be size consistent with max number of tasks possible
* index 0 will contain the taskId, index 1 will be -1 indicating a null taskID value
*/
public int[] getTaskIds() {
return mTaskIdContainer;
}
public TaskThumbnailView getThumbnail() {
@@ -598,7 +614,8 @@ public class TaskView extends FrameLayout implements Reusable {
ActivityOptionsWrapper opts = mActivity.getActivityLaunchOptions(this, null);
if (ActivityManagerWrapper.getInstance()
.startActivityFromRecents(mTask.key, opts.options)) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get() && getRecentsView().getRunningTaskId() != -1) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get() &&
getRecentsView().getRunningTaskViewId() != -1) {
// Return a fresh callback in the live tile case, so that it's not accidentally
// triggered by QuickstepTransitionManager.AppLaunchAnimationRunner.
RunnableList callbackList = new RunnableList();