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

Commit 4be03859 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...

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

Change-Id: Ib3bc6b23f088fa6da47b1189b290af1f8c4c7b1b
parents d9843df6 50e93d7c
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());
    }
}