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

Commit 85787007 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

Change-Id: I39e4676c3d9722a4c6c52cc1859a17ff57159370
parents de9025c9 7fe02e32
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -1373,6 +1373,9 @@ class Task extends WindowContainer<WindowContainer> {
    void addChild(WindowContainer child, int index) {
    void addChild(WindowContainer child, int index) {
        // If this task had any child before we added this one.
        // If this task had any child before we added this one.
        boolean hadChild = hasChild();
        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);
        index = getAdjustedChildPosition(child, index);
        super.addChild(child, index);
        super.addChild(child, index);
@@ -1413,7 +1416,7 @@ class Task extends WindowContainer<WindowContainer> {
                    ActivityTaskManager.getMaxAppRecentsLimitStatic());
                    ActivityTaskManager.getMaxAppRecentsLimitStatic());
        } else {
        } else {
            // Otherwise make all added activities match this one.
            // Otherwise make all added activities match this one.
            r.setActivityType(getActivityType());
            r.setActivityType(activityType);
        }
        }


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