2c/ Update car launcher to reflect change to GroupedTaskInfo
- No behavior change from the type change, other than removing
deprecated usage of setLastSnapshotData()
Bug: 346588978
Flag: EXEMPT adding new flag enable_shell_top_task_tracking
Test: m CarLauncher CarLauncherTests
Test: atest WMShellUnitTests
Change-Id: Ib86fc47bbc610bcef94963c540b4bab64502e034
diff --git a/app/src/com/android/car/carlauncher/recents/RecentTasksProvider.java b/app/src/com/android/car/carlauncher/recents/RecentTasksProvider.java
index ec1b4af..03ec2ab 100644
--- a/app/src/com/android/car/carlauncher/recents/RecentTasksProvider.java
+++ b/app/src/com/android/car/carlauncher/recents/RecentTasksProvider.java
@@ -18,12 +18,13 @@
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
-import static com.android.wm.shell.shared.GroupedRecentTaskInfo.TYPE_FREEFORM;
-import static com.android.wm.shell.shared.GroupedRecentTaskInfo.TYPE_SINGLE;
-import static com.android.wm.shell.shared.GroupedRecentTaskInfo.TYPE_SPLIT;
+import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_FREEFORM;
+import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_FULLSCREEN;
+import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_SPLIT;
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.TaskInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -49,7 +50,7 @@
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.wm.shell.recents.IRecentTasks;
-import com.android.wm.shell.shared.GroupedRecentTaskInfo;
+import com.android.wm.shell.shared.GroupedTaskInfo;
import com.google.common.annotations.VisibleForTesting;
@@ -152,7 +153,7 @@
return;
}
sRecentsModelExecutor.execute(() -> {
- GroupedRecentTaskInfo[] groupedRecentTasks;
+ GroupedTaskInfo[] groupedRecentTasks;
try {
// todo: b/271498799 use ActivityManagerWrapper.getInstance().getCurrentUserId()
// or equivalent instead of hidden API mContext.getUserId()
@@ -171,12 +172,12 @@
mRecentTaskIds = new ArrayList<>(groupedRecentTasks.length);
mRecentTaskIdToTaskMap = new HashMap<>(groupedRecentTasks.length);
boolean areSplitOrFreeformTypeTasksPresent = false;
- for (GroupedRecentTaskInfo groupedRecentTask : groupedRecentTasks) {
+ for (GroupedTaskInfo groupedRecentTask : groupedRecentTasks) {
switch (groupedRecentTask.getType()) {
- case TYPE_SINGLE:
+ case TYPE_FULLSCREEN:
// Automotive doesn't have split screen functionality, only process tasks
- // of TYPE_SINGLE.
- ActivityManager.RecentTaskInfo taskInfo = groupedRecentTask.getTaskInfo1();
+ // of TYPE_FULLSCREEN.
+ TaskInfo taskInfo = groupedRecentTask.getTaskInfo1();
Task.TaskKey taskKey = new Task.TaskKey(taskInfo);
// isLocked is always set to false since this value is not required in
@@ -186,7 +187,6 @@
// where this value is necessary to check if profile user associated with
// the task is unlocked.
Task task = Task.from(taskKey, taskInfo, /* isLocked= */ false);
- task.setLastSnapshotData(taskInfo);
mRecentTaskIds.add(task.key.id);
mRecentTaskIdToTaskMap.put(task.key.id, task);
getRecentTaskThumbnailAsync(task.key.id);
diff --git a/app/tests/src/com/android/car/carlauncher/recents/RecentTasksProviderTest.java b/app/tests/src/com/android/car/carlauncher/recents/RecentTasksProviderTest.java
index 71aa8d8..5e7703e 100644
--- a/app/tests/src/com/android/car/carlauncher/recents/RecentTasksProviderTest.java
+++ b/app/tests/src/com/android/car/carlauncher/recents/RecentTasksProviderTest.java
@@ -18,9 +18,9 @@
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
-import static com.android.wm.shell.shared.GroupedRecentTaskInfo.TYPE_FREEFORM;
-import static com.android.wm.shell.shared.GroupedRecentTaskInfo.TYPE_SINGLE;
-import static com.android.wm.shell.shared.GroupedRecentTaskInfo.TYPE_SPLIT;
+import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_FREEFORM;
+import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_FULLSCREEN;
+import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_SPLIT;
import static com.google.common.truth.Truth.assertThat;
@@ -37,6 +37,7 @@
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
+import android.app.TaskInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -56,7 +57,7 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.PackageManagerWrapper;
import com.android.wm.shell.recents.IRecentTasks;
-import com.android.wm.shell.shared.GroupedRecentTaskInfo;
+import com.android.wm.shell.shared.GroupedTaskInfo;
import com.google.common.util.concurrent.MoreExecutors;
@@ -78,7 +79,7 @@
private static final int FREEFORM_RECENT_TASKS_LENGTH = 3;
private RecentTasksProvider mRecentTasksProvider;
- private GroupedRecentTaskInfo[] mGroupedRecentTaskInfo;
+ private GroupedTaskInfo[] mGroupedRecentTaskInfo;
@Mock
private IRecentTasks mRecentTaskProxy;
@@ -363,10 +364,10 @@
}
private void initRecentTaskList(boolean addTypeSplit, boolean addTypeFreeform) {
- List<GroupedRecentTaskInfo> groupedRecentTaskInfos = new ArrayList<>();
+ List<GroupedTaskInfo> groupedRecentTaskInfos = new ArrayList<>();
for (int i = 0; i < RECENT_TASKS_LENGTH; i++) {
groupedRecentTaskInfos.add(
- createGroupedRecentTaskInfo(createRecentTaskInfo(i), TYPE_SINGLE));
+ createGroupedRecentTaskInfo(createRecentTaskInfo(i), TYPE_FULLSCREEN));
}
if (addTypeSplit) {
for (int i = 0; i < SPLIT_RECENT_TASKS_LENGTH; i++) {
@@ -380,18 +381,18 @@
createGroupedRecentTaskInfo(createRecentTaskInfo(i), TYPE_FREEFORM));
}
}
- mGroupedRecentTaskInfo = groupedRecentTaskInfos.toArray(GroupedRecentTaskInfo[]::new);
+ mGroupedRecentTaskInfo = groupedRecentTaskInfos.toArray(GroupedTaskInfo[]::new);
}
- private GroupedRecentTaskInfo createGroupedRecentTaskInfo(ActivityManager.RecentTaskInfo info,
- int type) {
- GroupedRecentTaskInfo groupedRecentTaskInfo = mock(GroupedRecentTaskInfo.class);
+ private GroupedTaskInfo createGroupedRecentTaskInfo(TaskInfo info, int type) {
+ GroupedTaskInfo groupedRecentTaskInfo =
+ (GroupedTaskInfo) mock(GroupedTaskInfo.class);
when(groupedRecentTaskInfo.getType()).thenReturn(type);
when(groupedRecentTaskInfo.getTaskInfo1()).thenReturn(info);
return groupedRecentTaskInfo;
}
- private ActivityManager.RecentTaskInfo createRecentTaskInfo(int taskId) {
+ private TaskInfo createRecentTaskInfo(int taskId) {
when(mBaseIntent.getComponent()).thenReturn(mComponent);
ActivityManager.RecentTaskInfo recentTaskInfo = new ActivityManager.RecentTaskInfo();
recentTaskInfo.taskId = taskId;