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

Commit 0871ed34 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

Change-Id: I05d7bfcfe1f8a0e200029e8e3e635717566bab21
parents 78a51131 3799331c
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));
    }
}