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

Commit 3da53d52 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure that we are removing recent tasks for a user including their profiles" into qt-dev

parents 1b92e904 cdd4c3fa
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