Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ecf62bd authored by Jeff Chang's avatar Jeff Chang
Browse files

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
parent 244416ae
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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;
    }

+13 −0
Original line number Diff line number Diff line
@@ -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