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

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

Merge "Fix regression in recent task list replacement" into pi-dev

parents ee7bc05a b7667279
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1255,7 +1255,7 @@ class RecentTasks {
        for (int i = 0; i < recentsCount; i++) {
            final TaskRecord tr = mTasks.get(i);
            if (task != tr) {
                if (!task.hasCompatibleActivityType(tr)) {
                if (!task.hasCompatibleActivityType(tr) || task.userId != tr.userId) {
                    continue;
                }
                final Intent trIntent = tr.intent;
+27 −0
Original line number Diff line number Diff line
@@ -326,6 +326,33 @@ public class RecentTasksTest extends ActivityTestsBase {
        assertTrue(mCallbacksRecorder.removed.contains(task1));
    }

    @Test
    public void testAddTaskCompatibleActivityTypeDifferentUser_expectNoRemove() throws Exception {
        Configuration config1 = new Configuration();
        config1.windowConfiguration.setActivityType(ACTIVITY_TYPE_UNDEFINED);
        TaskRecord task1 = createTaskBuilder(".Task1")
                .setFlags(FLAG_ACTIVITY_NEW_TASK)
                .setStack(mStack)
                .setUserId(TEST_USER_0_ID)
                .build();
        task1.onConfigurationChanged(config1);
        assertTrue(task1.getActivityType() == ACTIVITY_TYPE_UNDEFINED);
        mRecentTasks.add(task1);
        mCallbacksRecorder.clear();

        TaskRecord task2 = createTaskBuilder(".Task1")
                .setFlags(FLAG_ACTIVITY_NEW_TASK)
                .setStack(mStack)
                .setUserId(TEST_USER_1_ID)
                .build();
        assertTrue(task2.getActivityType() == ACTIVITY_TYPE_STANDARD);
        mRecentTasks.add(task2);
        assertTrue(mCallbacksRecorder.added.size() == 1);
        assertTrue(mCallbacksRecorder.added.contains(task2));
        assertTrue(mCallbacksRecorder.trimmed.isEmpty());
        assertTrue(mCallbacksRecorder.removed.isEmpty());
    }

    @Test
    public void testUsersTasks() throws Exception {
        mRecentTasks.setOnlyTestVisibleRange();