Merge "Assign original activityType of Task to new undefined activity." into rvc-dev am: fb9a191710
Change-Id: I23faafece5c0ff3070b2200263bbbb78bf3d7a26
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user