Exclude the embedded tasks from Recents

Currently embedded tasks with activities from other apps are showing
as separate entries in Recents. We should only have a single Recents
entry for the host and embedded apps as per UX definition. This CL
excluded the entry from recents if the task is embedded.

Bug: 194243805
Test: atest RecentTasksTest#testVisibleEmbeddedTask_expectNotVisible
Change-Id: Ie4548ffc0175a1c331f3509fe9ded8c1a1a53196
This commit is contained in:
Jeff Chang
2021-08-03 12:19:59 +08:00
parent 244416ae3f
commit 5ecf62bd4d
2 changed files with 20 additions and 1 deletions

View File

@@ -1346,7 +1346,8 @@ class RecentTasks {
+ " activityType=" + task.getActivityType()
+ " windowingMode=" + task.getWindowingMode()
+ " isAlwaysOnTopWhenVisible=" + task.isAlwaysOnTopWhenVisible()
+ " intentFlags=" + task.getBaseIntent().getFlags());
+ " intentFlags=" + task.getBaseIntent().getFlags()
+ " isEmbedded=" + task.isEmbedded());
}
switch (task.getActivityType()) {
@@ -1392,6 +1393,11 @@ class RecentTasks {
return false;
}
// Ignore the task if it is a embedded task
if (task.isEmbedded()) {
return false;
}
return true;
}

View File

@@ -787,6 +787,19 @@ public class RecentTasksTest extends WindowTestsBase {
triggerTrimAndAssertTrimmed(mTasks.get(0), mTasks.get(1), mTasks.get(2), mTasks.get(3));
}
@Test
public void testVisibleEmbeddedTask_expectNotVisible() {
Task task = createTaskBuilder(".Task")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
.build();
doReturn(true).when(task).isEmbedded();
mRecentTasks.add(task);
assertThat(mCallbacksRecorder.mAdded).hasSize(1);
assertFalse("embedded task should not be visible recents",
mRecentTasks.isVisibleRecentTask(task));
}
@Test
public void testFreezeTaskListOrder_reorderExistingTask() {
// Add some tasks