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

Commit 995d629c authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Assign original activityType of Task to new undefined activity." into rvc-dev am: fb9a1917

Change-Id: I813889d226945da5a3d9ad76bff221c487e2f21a
parents 39ee7b7e fb9a1917
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1373,6 +1373,9 @@ class Task extends WindowContainer<WindowContainer> {
    void addChild(WindowContainer child, int index) {
        // If this task had any child before we added this one.
        boolean hadChild = hasChild();
        // getActivityType() looks at the top child, so we need to read the type before adding
        // a new child in case the new child is on top and UNDEFINED.
        final int activityType = getActivityType();

        index = getAdjustedChildPosition(child, index);
        super.addChild(child, index);
@@ -1413,7 +1416,7 @@ class Task extends WindowContainer<WindowContainer> {
                    ActivityTaskManager.getMaxAppRecentsLimitStatic());
        } else {
            // Otherwise make all added activities match this one.
            r.setActivityType(getActivityType());
            r.setActivityType(activityType);
        }

        updateEffectiveIntent();
+18 −0
Original line number Diff line number Diff line
@@ -208,4 +208,22 @@ public class TaskStackTests extends WindowTestsBase {
        assertEquals(stackBounds.left - stackOutset, stack.getLastSurfacePosition().x);
        assertEquals(stackBounds.top - stackOutset, stack.getLastSurfacePosition().y);
    }

    @Test
    public void testActivityAndTaskGetsProperType() {
        final ActivityStack stack = createTaskStackOnDisplay(mDisplayContent);
        final Task task1 = createTaskInStack(stack, 0 /* userId */);
        ActivityRecord activity1 = WindowTestUtils.createTestActivityRecord(mDisplayContent);

        // First activity should become standard
        task1.addChild(activity1, 0);
        assertEquals(WindowConfiguration.ACTIVITY_TYPE_STANDARD, activity1.getActivityType());
        assertEquals(WindowConfiguration.ACTIVITY_TYPE_STANDARD, task1.getActivityType());

        // Second activity should also become standard
        ActivityRecord activity2 = WindowTestUtils.createTestActivityRecord(mDisplayContent);
        task1.addChild(activity2, WindowContainer.POSITION_TOP);
        assertEquals(WindowConfiguration.ACTIVITY_TYPE_STANDARD, activity2.getActivityType());
        assertEquals(WindowConfiguration.ACTIVITY_TYPE_STANDARD, task1.getActivityType());
    }
}