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

Commit 132b7671 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

Merge "Fix returning activity that not in the task" into rvc-dev am: 3799331c am: 0871ed34

Change-Id: Ief3d405838cb17717004da984d0901462458b3bc
parents 97cac5bd 0871ed34
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -3766,11 +3766,7 @@ class Task extends WindowContainer<WindowContainer> {
        if (r == null) {
            return null;
        }
        final Task task = r.getRootTask();
        if (task != null && r.isDescendantOf(task)) {
            if (task != this) Slog.w(TAG, "Illegal state! task does not point to stack it is in. "
                    + "stack=" + this + " task=" + task + " r=" + r
                    + " callers=" + Debug.getCallers(15, "\n"));
        if (r.isDescendantOf(this)) {
            return r;
        }
        return null;
+12 −0
Original line number Diff line number Diff line
@@ -146,4 +146,16 @@ public class TaskTests extends WindowTestsBase {
        task.setBounds(bounds);
        assertEquals(new Point(bounds.left, bounds.top), task.getLastSurfacePosition());
    }

    @Test
    public void testIsInStack() {
        final Task task1 = createTaskStackOnDisplay(mDisplayContent);
        final Task task2 = createTaskStackOnDisplay(mDisplayContent);
        final ActivityRecord activity1 =
                WindowTestUtils.createActivityRecordInTask(mDisplayContent, task1);
        final ActivityRecord activity2 =
                WindowTestUtils.createActivityRecordInTask(mDisplayContent, task2);
        assertEquals(activity1, task1.isInTask(activity1));
        assertNull(task1.isInTask(activity2));
    }
}