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

Commit 5f529246 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:...

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

Change-Id: I30910b28d007afd16bcc42951095195e89604feb
parents 46141093 132b7671
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));
    }
}