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

Commit cdd4c3fa authored by Winson Chung's avatar Winson Chung
Browse files

Ensure that we are removing recent tasks for a user including their profiles

- Also ensure that only the recents component can freeze the task list

Bug: 130662533
Test: atest RecentTasksTest
Change-Id: I0bdebcfd03f998b5a897e7622e9207c442b05957
parent b8337e9e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2717,7 +2717,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        if (activityOptions != null) {
            activityType = activityOptions.getLaunchActivityType();
            windowingMode = activityOptions.getLaunchWindowingMode();
            if (activityOptions.freezeRecentTasksReordering()) {
            if (activityOptions.freezeRecentTasksReordering()
                    && mRecentTasks.isCallerRecents(callingUid)) {
                mRecentTasks.setFreezeTaskListReordering();
            }
        }
+3 −1
Original line number Diff line number Diff line
@@ -653,9 +653,11 @@ class RecentTasks {
    }

    void removeAllVisibleTasks(int userId) {
        Set<Integer> profileIds = getProfileIds(userId);
        for (int i = mTasks.size() - 1; i >= 0; --i) {
            final TaskRecord tr = mTasks.get(i);
            if (tr.userId == userId && isVisibleRecentTask(tr)) {
            if (!profileIds.contains(tr.userId)) continue;
            if (isVisibleRecentTask(tr)) {
                mTasks.remove(i);
                notifyTaskRemoved(tr, true /* wasTrimmed */, true /* killProcess */);
            }
+8 −3
Original line number Diff line number Diff line
@@ -860,14 +860,19 @@ public class RecentTasksTest extends ActivityTestsBase {
                .build();
        mRecentTasks.add(t1);

        TaskRecord t2 = createTaskBuilder(".Task1")
                .setUserId(TEST_USER_1_ID)
        TaskRecord t2 = createTaskBuilder(".Task2")
                .setUserId(TEST_QUIET_USER_ID)
                .build();
        mRecentTasks.add(t2);

        TaskRecord t3 = createTaskBuilder(".Task3")
                .setUserId(TEST_USER_1_ID)
                .build();
        mRecentTasks.add(t3);

        // Remove all the visible tasks and ensure that they are removed
        mRecentTasks.removeAllVisibleTasks(TEST_USER_0_ID);
        assertTrimmed(t1);
        assertTrimmed(t1, t2);
    }

    @Test