summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java21
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java3
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java22
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java4
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java6
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java13
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java8
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java32
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java6
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java52
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java28
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java8
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TaskDisplayAreaTests.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java16
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java12
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java228
20 files changed, 220 insertions, 249 deletions
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
index 1eb45d587d33..cf07183a007d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
@@ -67,7 +67,7 @@ public class ActivityDisplayTests extends WindowTestsBase {
final TaskDisplayArea taskDisplayAreas =
mRootWindowContainer.getDefaultDisplay().getDefaultTaskDisplayArea();
final Task stack =
- new StackBuilder(mRootWindowContainer).setOnTop(!ON_TOP).build();
+ new TaskBuilder(mSupervisor).setOnTop(!ON_TOP).setCreateActivity(true).build();
final Task prevFocusedStack = taskDisplayAreas.getFocusedStack();
stack.moveToFront("moveStackToFront");
@@ -90,7 +90,7 @@ public class ActivityDisplayTests extends WindowTestsBase {
final Task pinnedStack = mRootWindowContainer.getDefaultTaskDisplayArea()
.createStack(WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD, ON_TOP);
final Task pinnedTask = new TaskBuilder(mAtm.mStackSupervisor)
- .setStack(pinnedStack).build();
+ .setParentTask(pinnedStack).build();
new ActivityBuilder(mAtm).setActivityFlags(FLAG_ALWAYS_FOCUSABLE)
.setTask(pinnedTask).build();
pinnedStack.moveToFront("movePinnedStackToFront");
@@ -144,7 +144,7 @@ public class ActivityDisplayTests extends WindowTestsBase {
doReturn(false).when(display).shouldDestroyContentOnRemove();
// Put home stack on the display.
- final Task homeStack = new StackBuilder(mRootWindowContainer)
+ final Task homeStack = new TaskBuilder(mSupervisor)
.setDisplay(display).setActivityType(ACTIVITY_TYPE_HOME).build();
// Put a finishing standard activity which will be reparented.
@@ -163,7 +163,7 @@ public class ActivityDisplayTests extends WindowTestsBase {
final Task fullscreenStack = display.getDefaultTaskDisplayArea().createStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, ON_TOP);
final Task fullscreenTask = new TaskBuilder(mAtm.mStackSupervisor)
- .setStack(fullscreenStack).build();
+ .setParentTask(fullscreenStack).build();
new ActivityBuilder(mAtm).setTask(fullscreenTask).build();
return fullscreenStack;
}
@@ -175,12 +175,11 @@ public class ActivityDisplayTests extends WindowTestsBase {
public void testTopRunningActivity() {
final DisplayContent display = mRootWindowContainer.getDefaultDisplay();
final KeyguardController keyguard = mSupervisor.getKeyguardController();
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord activity = stack.getTopNonFinishingActivity();
// Create empty stack on top.
- final Task emptyStack =
- new StackBuilder(mRootWindowContainer).setCreateActivity(false).build();
+ final Task emptyStack = new TaskBuilder(mSupervisor).build();
// Make sure the top running activity is not affected when keyguard is not locked.
assertTopRunningActivity(activity, display);
@@ -322,10 +321,10 @@ public class ActivityDisplayTests extends WindowTestsBase {
ACTIVITY_TYPE_STANDARD, ON_TOP);
final Task stack4 = taskDisplayArea.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, ON_TOP);
- final Task task1 = new TaskBuilder(mAtm.mStackSupervisor).setStack(stack1).build();
- final Task task2 = new TaskBuilder(mAtm.mStackSupervisor).setStack(stack2).build();
- final Task task3 = new TaskBuilder(mAtm.mStackSupervisor).setStack(stack3).build();
- final Task task4 = new TaskBuilder(mAtm.mStackSupervisor).setStack(stack4).build();
+ final Task task1 = new TaskBuilder(mAtm.mStackSupervisor).setParentTask(stack1).build();
+ final Task task2 = new TaskBuilder(mAtm.mStackSupervisor).setParentTask(stack2).build();
+ final Task task3 = new TaskBuilder(mAtm.mStackSupervisor).setParentTask(stack3).build();
+ final Task task4 = new TaskBuilder(mAtm.mStackSupervisor).setParentTask(stack4).build();
// Reordering stacks while removing stacks.
doAnswer(invocation -> {
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
index eb78172cd562..e860f2508983 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
@@ -341,9 +341,8 @@ public class ActivityMetricsLaunchObserverTests extends WindowTestsBase {
public void testConsecutiveLaunchOnDifferentDisplay() {
onActivityLaunched(mTopActivity);
- final Task stack = new StackBuilder(mRootWindowContainer)
+ final Task stack = new TaskBuilder(mSupervisor)
.setDisplay(addNewDisplayContentAt(DisplayContent.POSITION_BOTTOM))
- .setCreateActivity(false)
.build();
final ActivityRecord activityOnNewDisplay = new ActivityBuilder(mAtm)
.setStack(stack)
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index bca990c659ae..09375db01888 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -131,7 +131,7 @@ public class ActivityRecordTests extends WindowTestsBase {
@Before
public void setUp() throws Exception {
- mStack = new StackBuilder(mRootWindowContainer).build();
+ mStack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
mTask = mStack.getBottomMostTask();
mActivity = mTask.getTopNonFinishingActivity();
@@ -172,7 +172,7 @@ public class ActivityRecordTests extends WindowTestsBase {
@Test
public void testNoCleanupMovingActivityInSameStack() {
- final Task newTask = new TaskBuilder(mAtm.mStackSupervisor).setStack(mStack).build();
+ final Task newTask = new TaskBuilder(mAtm.mStackSupervisor).setParentTask(mStack).build();
mActivity.reparent(newTask, 0, null /*reason*/);
verify(mStack, times(0)).cleanUpActivityReferences(any());
}
@@ -262,7 +262,7 @@ public class ActivityRecordTests extends WindowTestsBase {
// Set options for two ActivityRecords in separate Tasks. Apply one ActivityRecord options.
// Pending options should be cleared for only ActivityRecord that was applied
- Task task2 = new TaskBuilder(mAtm.mStackSupervisor).setStack(mStack).build();
+ Task task2 = new TaskBuilder(mAtm.mStackSupervisor).setParentTask(mStack).build();
activity2 = new ActivityBuilder(mAtm).setTask(task2).build();
activity2.updateOptionsLocked(activityOptions);
mActivity.updateOptionsLocked(activityOptions);
@@ -548,7 +548,7 @@ public class ActivityRecordTests extends WindowTestsBase {
.build();
mActivity.setState(Task.ActivityState.STOPPED, "Testing");
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
try {
doReturn(false).when(stack).isTranslucent(any());
assertFalse(mStack.shouldBeVisible(null /* starting */));
@@ -756,14 +756,14 @@ public class ActivityRecordTests extends WindowTestsBase {
@Test
public void testFinishActivityIfPossible_adjustStackOrder() {
// Prepare the stacks with order (top to bottom): mStack, stack1, stack2.
- final Task stack1 = new StackBuilder(mRootWindowContainer).build();
+ final Task stack1 = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
mStack.moveToFront("test");
// The stack2 is needed here for moving back to simulate the
// {@link DisplayContent#mPreferredTopFocusableStack} is cleared, so
// {@link DisplayContent#getFocusedStack} will rely on the order of focusable-and-visible
// stacks. Then when mActivity is finishing, its stack will be invisible (no running
// activities in the stack) that is the key condition to verify.
- final Task stack2 = new StackBuilder(mRootWindowContainer).build();
+ final Task stack2 = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
stack2.moveToBack("test", stack2.getBottomMostTask());
assertTrue(mStack.isTopStackInDisplayArea());
@@ -973,7 +973,7 @@ public class ActivityRecordTests extends WindowTestsBase {
// Simulates that {@code currentTop} starts an existing activity from background (so its
// state is stopped) and the starting flow just goes to place it at top.
- final Task nextStack = new StackBuilder(mRootWindowContainer).build();
+ final Task nextStack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord nextTop = nextStack.getTopNonFinishingActivity();
nextTop.setState(STOPPED, "test");
@@ -1095,7 +1095,7 @@ public class ActivityRecordTests extends WindowTestsBase {
// Add another stack to become focused and make the activity there visible. This way it
// simulates finishing in non-focused stack in split-screen.
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord focusedActivity = stack.getTopMostActivity();
focusedActivity.nowVisible = true;
focusedActivity.mVisibleRequested = true;
@@ -1581,7 +1581,7 @@ public class ActivityRecordTests extends WindowTestsBase {
// Create a new task with custom config to reparent the activity to.
final Task newTask =
- new TaskBuilder(mSupervisor).setStack(initialTask.getRootTask()).build();
+ new TaskBuilder(mSupervisor).setParentTask(initialTask.getRootTask()).build();
final Configuration newConfig = newTask.getConfiguration();
newConfig.densityDpi += 100;
newTask.onRequestedOverrideConfigurationChanged(newConfig);
@@ -1613,7 +1613,7 @@ public class ActivityRecordTests extends WindowTestsBase {
// Create a new task with custom config to reparent the second activity to.
final Task newTask =
- new TaskBuilder(mSupervisor).setStack(initialTask.getRootTask()).build();
+ new TaskBuilder(mSupervisor).setParentTask(initialTask.getRootTask()).build();
final Configuration newConfig = newTask.getConfiguration();
newConfig.densityDpi += 100;
newTask.onRequestedOverrideConfigurationChanged(newConfig);
@@ -1750,7 +1750,7 @@ public class ActivityRecordTests extends WindowTestsBase {
}
final Task stack = display.getDefaultTaskDisplayArea()
.createStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_STANDARD, true /* onTop */);
- final Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(stack).build();
return new ActivityBuilder(mAtm).setTask(task).setUseProcess(process).build();
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java
index 27e2d1370fae..f9ad49bb5034 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java
@@ -115,8 +115,8 @@ public class ActivityStackSupervisorTests extends WindowTestsBase {
public void testHandleNonResizableTaskOnSecondaryDisplay() {
// Create an unresizable task on secondary display.
final DisplayContent newDisplay = addNewDisplayContentAt(DisplayContent.POSITION_TOP);
- final Task stack = new StackBuilder(mRootWindowContainer)
- .setDisplay(newDisplay).build();
+ final Task stack = new TaskBuilder(mSupervisor)
+ .setDisplay(newDisplay).setCreateActivity(true).build();
final ActivityRecord unresizableActivity = stack.getTopNonFinishingActivity();
final Task task = unresizableActivity.getTask();
unresizableActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
index 524f32deb864..4951658bbd78 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
@@ -100,7 +100,7 @@ public class ActivityStackTests extends WindowTestsBase {
mStack = mDefaultTaskDisplayArea.createStack(WINDOWING_MODE_UNDEFINED,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
spyOn(mStack);
- mTask = new TaskBuilder(mSupervisor).setStack(mStack).build();
+ mTask = new TaskBuilder(mSupervisor).setParentTask(mStack).build();
}
@Test
@@ -330,7 +330,7 @@ public class ActivityStackTests extends WindowTestsBase {
targetActivity);
final ComponentName alias = new ComponentName(DEFAULT_COMPONENT_PACKAGE_NAME,
aliasActivity);
- final Task task = new TaskBuilder(mAtm.mStackSupervisor).setStack(mStack).build();
+ final Task task = new TaskBuilder(mAtm.mStackSupervisor).setParentTask(mStack).build();
task.origActivity = alias;
task.realActivity = target;
new ActivityBuilder(mAtm).setComponent(target).setTask(task).setTargetActivity(
@@ -995,7 +995,7 @@ public class ActivityStackTests extends WindowTestsBase {
mDefaultTaskDisplayArea.positionChildAt(onTop ? POSITION_TOP : POSITION_BOTTOM, task,
false /* includingParents */);
} else {
- task = new StackBuilder(mRootWindowContainer)
+ task = new TaskBuilder(mSupervisor)
.setTaskDisplayArea(taskDisplayArea)
.setWindowingMode(windowingMode)
.setActivityType(activityType)
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
index e537b7c204cc..076047b35604 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
@@ -217,7 +217,10 @@ public class ActivityStarterTests extends WindowTestsBase {
// Create source token
final ActivityBuilder builder = new ActivityBuilder(service).setTask(
- new TaskBuilder(service.mStackSupervisor).setVoiceSession(voiceSession).build());
+ new TaskBuilder(service.mStackSupervisor)
+ .setVoiceSession(voiceSession)
+ .setCreateParentTask(true)
+ .build());
if (aInfo != null) {
aInfo.applicationInfo = new ApplicationInfo();
@@ -706,7 +709,9 @@ public class ActivityStarterTests extends WindowTestsBase {
@Test
public void testBringTaskToFrontWhenFocusedStackIsFinising() {
// Put 2 tasks in the same stack (simulate the behavior of home stack).
+ final Task rootTask = new TaskBuilder(mSupervisor).build();
final ActivityRecord activity = new ActivityBuilder(mAtm)
+ .setStack(rootTask)
.setCreateTask(true).build();
new ActivityBuilder(mAtm)
.setStack(activity.getRootTask())
@@ -792,7 +797,7 @@ public class ActivityStarterTests extends WindowTestsBase {
// Create another activity on top of the secondary display.
final Task topStack = secondaryTaskContainer.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
- final Task topTask = new TaskBuilder(mSupervisor).setStack(topStack).build();
+ final Task topTask = new TaskBuilder(mSupervisor).setParentTask(topStack).build();
new ActivityBuilder(mAtm).setTask(topTask).build();
// Start activity with the same intent as {@code singleTaskActivity} on secondary display.
@@ -851,7 +856,7 @@ public class ActivityStarterTests extends WindowTestsBase {
DEFAULT_COMPONENT_PACKAGE_NAME + ".SingleTaskActivity");
final Task task = new TaskBuilder(mSupervisor)
.setComponent(componentName)
- .setStack(stack)
+ .setParentTask(stack)
.build();
return new ActivityBuilder(mAtm)
.setComponent(componentName)
@@ -987,7 +992,7 @@ public class ActivityStarterTests extends WindowTestsBase {
final ActivityStarter starter = prepareStarter(0 /* flags */);
starter.mStartActivity = new ActivityBuilder(mAtm).build();
final Task task = new TaskBuilder(mAtm.mStackSupervisor)
- .setStack(mAtm.mRootWindowContainer.getDefaultTaskDisplayArea().createStack(
+ .setParentTask(mAtm.mRootWindowContainer.getDefaultTaskDisplayArea().createStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */))
.setUserId(10)
.build();
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
index 567610018fc1..031165727207 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
@@ -73,7 +73,7 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
/** Verify that activity is finished correctly upon request. */
@Test
public void testActivityFinish() {
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord activity = stack.getBottomMostTask().getTopNonFinishingActivity();
assertTrue("Activity must be finished", mAtm.finishActivity(activity.appToken,
0 /* resultCode */, null /* resultData */,
@@ -87,7 +87,7 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
@Test
public void testOnPictureInPictureRequested() throws RemoteException {
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord activity = stack.getBottomMostTask().getTopNonFinishingActivity();
final ClientLifecycleManager mockLifecycleManager = mock(ClientLifecycleManager.class);
doReturn(mockLifecycleManager).when(mAtm).getLifecycleManager();
@@ -106,7 +106,7 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
@Test(expected = IllegalStateException.class)
public void testOnPictureInPictureRequested_cannotEnterPip() throws RemoteException {
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord activity = stack.getBottomMostTask().getTopNonFinishingActivity();
ClientLifecycleManager lifecycleManager = mAtm.getLifecycleManager();
doReturn(false).when(activity).inPinnedWindowingMode();
@@ -120,7 +120,7 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
@Test(expected = IllegalStateException.class)
public void testOnPictureInPictureRequested_alreadyInPIPMode() throws RemoteException {
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord activity = stack.getBottomMostTask().getTopNonFinishingActivity();
ClientLifecycleManager lifecycleManager = mAtm.getLifecycleManager();
doReturn(true).when(activity).inPinnedWindowingMode();
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
index f8baf8497069..3cfda8df7d5c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
@@ -847,17 +847,17 @@ public class DisplayContentTests extends WindowTestsBase {
dc.getDisplayRotation().setFixedToUserRotation(
IWindowManager.FIXED_TO_USER_ROTATION_DISABLED);
- final Task stack =
- new StackBuilder(mWm.mAtmService.mRootWindowContainer)
- .setDisplay(dc)
- .build();
+ final Task stack = new TaskBuilder(mSupervisor)
+ .setDisplay(dc)
+ .setCreateActivity(true)
+ .build();
doReturn(true).when(stack).isVisible();
- final Task freeformStack =
- new StackBuilder(mWm.mAtmService.mRootWindowContainer)
- .setDisplay(dc)
- .setWindowingMode(WINDOWING_MODE_FREEFORM)
- .build();
+ final Task freeformStack = new TaskBuilder(mSupervisor)
+ .setDisplay(dc)
+ .setCreateActivity(true)
+ .setWindowingMode(WINDOWING_MODE_FREEFORM)
+ .build();
doReturn(true).when(freeformStack).isVisible();
freeformStack.getTopChild().setBounds(100, 100, 300, 400);
@@ -879,8 +879,8 @@ public class DisplayContentTests extends WindowTestsBase {
IWindowManager.FIXED_TO_USER_ROTATION_DISABLED);
final int newOrientation = getRotatedOrientation(dc);
- final Task stack = new StackBuilder(mWm.mAtmService.mRootWindowContainer)
- .setDisplay(dc).build();
+ final Task stack = new TaskBuilder(mSupervisor)
+ .setDisplay(dc).setCreateActivity(true).build();
final ActivityRecord activity = stack.getTopMostTask().getTopNonFinishingActivity();
activity.setRequestedOrientation(newOrientation);
@@ -898,8 +898,8 @@ public class DisplayContentTests extends WindowTestsBase {
IWindowManager.FIXED_TO_USER_ROTATION_ENABLED);
final int newOrientation = getRotatedOrientation(dc);
- final Task stack = new StackBuilder(mWm.mAtmService.mRootWindowContainer)
- .setDisplay(dc).build();
+ final Task stack = new TaskBuilder(mSupervisor)
+ .setDisplay(dc).setCreateActivity(true).build();
final ActivityRecord activity = stack.getTopMostTask().getTopNonFinishingActivity();
activity.setRequestedOrientation(newOrientation);
@@ -1209,8 +1209,8 @@ public class DisplayContentTests extends WindowTestsBase {
verify(t, never()).setPosition(any(), eq(0), eq(0));
// Launch another activity before the transition is finished.
- final ActivityRecord app2 = new StackBuilder(mWm.mRoot)
- .setDisplay(mDisplayContent).build().getTopMostActivity();
+ final ActivityRecord app2 = new TaskBuilder(mSupervisor)
+ .setDisplay(mDisplayContent).setCreateActivity(true).build().getTopMostActivity();
app2.setVisible(false);
mDisplayContent.mOpeningApps.add(app2);
app2.setRequestedOrientation(newOrientation);
@@ -1508,7 +1508,7 @@ public class DisplayContentTests extends WindowTestsBase {
@Test
public void testSetWindowingModeAtomicallyUpdatesWindoingModeAndDisplayWindowingMode() {
final DisplayContent dc = createNewDisplay();
- final Task stack = new StackBuilder(mWm.mAtmService.mRootWindowContainer)
+ final Task stack = new TaskBuilder(mSupervisor)
.setDisplay(dc)
.build();
doAnswer(invocation -> {
diff --git a/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java b/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java
index 18a2d1337d4b..d701a9df7cb8 100644
--- a/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java
@@ -116,7 +116,7 @@ public class LaunchParamsPersisterTests extends WindowTestsBase {
Task stack = mTestDisplay.getDefaultTaskDisplayArea()
.createStack(TEST_WINDOWING_MODE, ACTIVITY_TYPE_STANDARD, /* onTop */ true);
- mTestTask = new TaskBuilder(mSupervisor).setComponent(TEST_COMPONENT).setStack(stack)
+ mTestTask = new TaskBuilder(mSupervisor).setComponent(TEST_COMPONENT).setParentTask(stack)
.build();
mTestTask.mUserId = TEST_USER_ID;
mTestTask.mLastNonFullscreenBounds = TEST_BOUNDS;
@@ -342,7 +342,7 @@ public class LaunchParamsPersisterTests extends WindowTestsBase {
final Task anotherTaskOfTheSameUser = new TaskBuilder(mSupervisor)
.setComponent(ALTERNATIVE_COMPONENT)
.setUserId(TEST_USER_ID)
- .setStack(stack)
+ .setParentTask(stack)
.build();
anotherTaskOfTheSameUser.setWindowingMode(WINDOWING_MODE_FREEFORM);
anotherTaskOfTheSameUser.setBounds(200, 300, 400, 500);
@@ -354,7 +354,7 @@ public class LaunchParamsPersisterTests extends WindowTestsBase {
final Task anotherTaskOfDifferentUser = new TaskBuilder(mSupervisor)
.setComponent(TEST_COMPONENT)
.setUserId(ALTERNATIVE_USER_ID)
- .setStack(stack)
+ .setParentTask(stack)
.build();
anotherTaskOfDifferentUser.setWindowingMode(WINDOWING_MODE_FREEFORM);
anotherTaskOfDifferentUser.setBounds(300, 400, 500, 600);
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
index 9954f484f0a6..253fbae4579b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
@@ -333,10 +333,10 @@ public class RecentTasksTest extends WindowTestsBase {
// other task
Task task1 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
- .setStack(mTaskContainer.getRootHomeTask()).build();
+ .setParentTask(mTaskContainer.getRootHomeTask()).build();
Task task2 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
- .setStack(mStack).build();
+ .setParentTask(mStack).build();
mRecentTasks.add(task1);
mRecentTasks.add(task2);
assertThat(mCallbacksRecorder.mAdded).hasSize(2);
@@ -352,7 +352,7 @@ public class RecentTasksTest extends WindowTestsBase {
// and we want to ensure that a new task will match a restored task
Task task1 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.build();
setTaskActivityType(task1, ACTIVITY_TYPE_UNDEFINED);
assertThat(task1.getActivityType()).isEqualTo(ACTIVITY_TYPE_UNDEFINED);
@@ -361,7 +361,7 @@ public class RecentTasksTest extends WindowTestsBase {
Task task2 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.build();
assertEquals(ACTIVITY_TYPE_STANDARD, task2.getActivityType());
mRecentTasks.add(task2);
@@ -376,7 +376,7 @@ public class RecentTasksTest extends WindowTestsBase {
public void testAddTaskCompatibleActivityTypeDifferentUser_expectNoRemove() {
Task task1 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.setUserId(TEST_USER_0_ID)
.build();
setTaskActivityType(task1, ACTIVITY_TYPE_UNDEFINED);
@@ -386,7 +386,7 @@ public class RecentTasksTest extends WindowTestsBase {
Task task2 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.setUserId(TEST_USER_1_ID)
.build();
assertEquals(ACTIVITY_TYPE_STANDARD, task2.getActivityType());
@@ -401,7 +401,7 @@ public class RecentTasksTest extends WindowTestsBase {
public void testAddTaskCompatibleWindowingMode_expectRemove() {
Task task1 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.build();
setTaskWindowingMode(task1, WINDOWING_MODE_UNDEFINED);
assertEquals(WINDOWING_MODE_UNDEFINED, task1.getWindowingMode());
@@ -410,7 +410,7 @@ public class RecentTasksTest extends WindowTestsBase {
Task task2 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.build();
setTaskWindowingMode(task2, WINDOWING_MODE_FULLSCREEN);
assertEquals(WINDOWING_MODE_FULLSCREEN, task2.getWindowingMode());
@@ -427,7 +427,7 @@ public class RecentTasksTest extends WindowTestsBase {
public void testAddTaskIncompatibleWindowingMode_expectNoRemove() {
Task task1 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.build();
setTaskWindowingMode(task1, WINDOWING_MODE_FULLSCREEN);
assertEquals(WINDOWING_MODE_FULLSCREEN, task1.getWindowingMode());
@@ -435,7 +435,7 @@ public class RecentTasksTest extends WindowTestsBase {
Task task2 = createTaskBuilder(".Task1")
.setFlags(FLAG_ACTIVITY_NEW_TASK)
- .setStack(mStack)
+ .setParentTask(mStack)
.build();
setTaskWindowingMode(task2, WINDOWING_MODE_PINNED);
assertEquals(WINDOWING_MODE_PINNED, task2.getWindowingMode());
@@ -453,19 +453,19 @@ public class RecentTasksTest extends WindowTestsBase {
// Add task to recents
final String taskAffinity = "affinity";
final int uid = 10123;
- final Task task1 = createTaskBuilder(".Task1").setStack(mStack).build();
+ final Task task1 = createTaskBuilder(".Task1").setParentTask(mStack).build();
task1.affinity = ActivityRecord.computeTaskAffinity(taskAffinity, uid, LAUNCH_MULTIPLE);
mRecentTasks.add(task1);
// Add another task to recents, and make sure the previous task was removed.
- final Task task2 = createTaskBuilder(".Task2").setStack(mStack).build();
+ final Task task2 = createTaskBuilder(".Task2").setParentTask(mStack).build();
task2.affinity = ActivityRecord.computeTaskAffinity(taskAffinity, uid, LAUNCH_MULTIPLE);
mRecentTasks.add(task2);
assertEquals(1, mRecentTasks.getRecentTasks(MAX_VALUE, 0 /* flags */,
true /* getTasksAllowed */, TEST_USER_0_ID, 0).getList().size());
// Add another single-instance task to recents, and make sure no task is removed.
- final Task task3 = createTaskBuilder(".Task3").setStack(mStack).build();
+ final Task task3 = createTaskBuilder(".Task3").setParentTask(mStack).build();
task3.affinity = ActivityRecord.computeTaskAffinity(taskAffinity, uid,
LAUNCH_SINGLE_INSTANCE);
mRecentTasks.add(task3);
@@ -497,7 +497,7 @@ public class RecentTasksTest extends WindowTestsBase {
// tasks because their intents are identical.
mRecentTasks.add(task1);
// Go home to trigger the removal of untracked tasks.
- mRecentTasks.add(createTaskBuilder(".Home").setStack(mTaskContainer.getRootHomeTask())
+ mRecentTasks.add(createTaskBuilder(".Home").setParentTask(mTaskContainer.getRootHomeTask())
.build());
// The task was added into recents again so it is not hidden and shouldn't be removed.
@@ -883,10 +883,10 @@ public class RecentTasksTest extends WindowTestsBase {
// Add a number of tasks (beyond the max) but ensure that nothing is trimmed because all
// the tasks belong in stacks above the home stack
- mRecentTasks.add(createTaskBuilder(".HomeTask1").setStack(homeStack).build());
- mRecentTasks.add(createTaskBuilder(".Task1").setStack(aboveHomeStack).build());
- mRecentTasks.add(createTaskBuilder(".Task2").setStack(aboveHomeStack).build());
- mRecentTasks.add(createTaskBuilder(".Task3").setStack(aboveHomeStack).build());
+ mRecentTasks.add(createTaskBuilder(".HomeTask1").setParentTask(homeStack).build());
+ mRecentTasks.add(createTaskBuilder(".Task1").setParentTask(aboveHomeStack).build());
+ mRecentTasks.add(createTaskBuilder(".Task2").setParentTask(aboveHomeStack).build());
+ mRecentTasks.add(createTaskBuilder(".Task3").setParentTask(aboveHomeStack).build());
assertNoTasksTrimmed();
}
@@ -904,11 +904,11 @@ public class RecentTasksTest extends WindowTestsBase {
// Add a number of tasks (beyond the max) but ensure that only the task in the stack behind
// the home stack is trimmed once a new task is added
final Task behindHomeTask = createTaskBuilder(".Task1")
- .setStack(behindHomeStack)
+ .setParentTask(behindHomeStack)
.build();
mRecentTasks.add(behindHomeTask);
- mRecentTasks.add(createTaskBuilder(".HomeTask1").setStack(homeStack).build());
- mRecentTasks.add(createTaskBuilder(".Task2").setStack(aboveHomeStack).build());
+ mRecentTasks.add(createTaskBuilder(".HomeTask1").setParentTask(homeStack).build());
+ mRecentTasks.add(createTaskBuilder(".Task2").setParentTask(aboveHomeStack).build());
assertTrimmed(behindHomeTask);
}
@@ -924,10 +924,10 @@ public class RecentTasksTest extends WindowTestsBase {
// Add a number of tasks (beyond the max) on each display, ensure that the tasks are not
// removed
- mRecentTasks.add(createTaskBuilder(".HomeTask1").setStack(homeStack).build());
- mRecentTasks.add(createTaskBuilder(".Task1").setStack(otherDisplayStack).build());
- mRecentTasks.add(createTaskBuilder(".Task2").setStack(otherDisplayStack).build());
- mRecentTasks.add(createTaskBuilder(".HomeTask2").setStack(homeStack).build());
+ mRecentTasks.add(createTaskBuilder(".HomeTask1").setParentTask(homeStack).build());
+ mRecentTasks.add(createTaskBuilder(".Task1").setParentTask(otherDisplayStack).build());
+ mRecentTasks.add(createTaskBuilder(".Task2").setParentTask(otherDisplayStack).build());
+ mRecentTasks.add(createTaskBuilder(".HomeTask2").setParentTask(homeStack).build());
assertNoTasksTrimmed();
}
@@ -1214,7 +1214,7 @@ public class RecentTasksTest extends WindowTestsBase {
private TaskBuilder createTaskBuilder(String packageName, String className) {
return new TaskBuilder(mAtm.mStackSupervisor)
.setComponent(new ComponentName(packageName, className))
- .setStack(mStack)
+ .setParentTask(mStack)
.setUserId(TEST_USER_0_ID);
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java
index 26b0bfb1dd7c..901ed36254ea 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java
@@ -195,8 +195,7 @@ public class RootActivityContainerTests extends WindowTestsBase {
public void testApplySleepTokens() {
final DisplayContent display = mRootWindowContainer.getDefaultDisplay();
final KeyguardController keyguard = mSupervisor.getKeyguardController();
- final Task stack = new StackBuilder(mRootWindowContainer)
- .setCreateActivity(false)
+ final Task stack = new TaskBuilder(mSupervisor)
.setDisplay(display)
.setOnTop(false)
.build();
@@ -384,7 +383,7 @@ public class RootActivityContainerTests extends WindowTestsBase {
final Task primaryStack = mRootWindowContainer.getDefaultTaskDisplayArea()
.createStack(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD,
true /* onTop */);
- final Task task = new TaskBuilder(mSupervisor).setStack(primaryStack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(primaryStack).build();
final ActivityRecord r = new ActivityBuilder(mAtm).setTask(task).build();
// Find a launch stack for the top activity in split-screen primary, while requesting
@@ -404,14 +403,17 @@ public class RootActivityContainerTests extends WindowTestsBase {
@Test
public void testFindTaskToMoveToFrontWhenRecentsOnTop() {
// Create stack/task on default display.
- final Task targetStack = new StackBuilder(mRootWindowContainer)
+ final Task targetStack = new TaskBuilder(mSupervisor)
+ .setCreateActivity(true)
.setOnTop(false)
.build();
final Task targetTask = targetStack.getBottomMostTask();
// Create Recents on top of the display.
- final Task stack = new StackBuilder(mRootWindowContainer).setActivityType(
- ACTIVITY_TYPE_RECENTS).build();
+ final Task stack = new TaskBuilder(mSupervisor)
+ .setCreateActivity(true)
+ .setActivityType(ACTIVITY_TYPE_RECENTS)
+ .build();
final String reason = "findTaskToMoveToFront";
mSupervisor.findTaskToMoveToFront(targetTask, 0, ActivityOptions.makeBasic(), reason,
@@ -431,14 +433,14 @@ public class RootActivityContainerTests extends WindowTestsBase {
final TaskDisplayArea taskDisplayArea = mRootWindowContainer.getDefaultTaskDisplayArea();
final Task targetStack = taskDisplayArea.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */);
- final Task targetTask = new TaskBuilder(mSupervisor).setStack(targetStack).build();
+ final Task targetTask = new TaskBuilder(mSupervisor).setParentTask(targetStack).build();
// Create Recents on secondary display.
final TestDisplayContent secondDisplay = addNewDisplayContentAt(
DisplayContent.POSITION_TOP);
final Task stack = secondDisplay.getDefaultTaskDisplayArea()
.createStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_RECENTS, true /* onTop */);
- final Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(stack).build();
new ActivityBuilder(mAtm).setTask(task).build();
final String reason = "findTaskToMoveToFront";
@@ -458,7 +460,7 @@ public class RootActivityContainerTests extends WindowTestsBase {
final TaskDisplayArea taskDisplayArea = mRootWindowContainer.getDefaultTaskDisplayArea();
final Task targetStack = spy(taskDisplayArea.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */));
- final Task task = new TaskBuilder(mSupervisor).setStack(targetStack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(targetStack).build();
final ActivityRecord activity = new ActivityBuilder(mAtm).setTask(task).build();
taskDisplayArea.positionChildAt(POSITION_BOTTOM, targetStack, false /*includingParents*/);
@@ -514,7 +516,7 @@ public class RootActivityContainerTests extends WindowTestsBase {
DisplayContent.POSITION_TOP);
final Task stack = secondDisplay.getDefaultTaskDisplayArea()
.createStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
- final Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(stack).build();
new ActivityBuilder(mAtm).setTask(task).build();
doReturn(true).when(mRootWindowContainer).resumeHomeActivity(any(), any(), any());
@@ -538,7 +540,7 @@ public class RootActivityContainerTests extends WindowTestsBase {
final TaskDisplayArea taskDisplayArea = mRootWindowContainer.getDefaultTaskDisplayArea();
final Task targetStack = spy(taskDisplayArea.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */));
- final Task task = new TaskBuilder(mSupervisor).setStack(targetStack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(targetStack).build();
final ActivityRecord activity = new ActivityBuilder(mAtm).setTask(task).build();
activity.setState(ActivityState.RESUMED, "test");
@@ -558,7 +560,7 @@ public class RootActivityContainerTests extends WindowTestsBase {
final TaskDisplayArea taskDisplayArea = mRootWindowContainer.getDefaultTaskDisplayArea();
final Task targetStack = spy(taskDisplayArea.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */));
- final Task task = new TaskBuilder(mSupervisor).setStack(targetStack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(targetStack).build();
final ActivityRecord activity = new ActivityBuilder(mAtm).setTask(task).build();
activity.setState(ActivityState.RESUMED, "test");
taskDisplayArea.positionChildAt(POSITION_BOTTOM, targetStack, false /*includingParents*/);
@@ -884,7 +886,7 @@ public class RootActivityContainerTests extends WindowTestsBase {
// Create a root task with an activity on secondary display.
final TestDisplayContent secondaryDisplay = new TestDisplayContent.Builder(mAtm, 300,
600).build();
- final Task task = new StackBuilder(mRootWindowContainer)
+ final Task task = new TaskBuilder(mSupervisor)
.setDisplay(secondaryDisplay).build();
final ActivityRecord activity = new ActivityBuilder(mAtm).setTask(task).build();
diff --git a/services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java
index 191c33c61aca..3053fe6ec55f 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java
@@ -174,7 +174,7 @@ public class RootWindowContainerTests extends WindowTestsBase {
@Test
public void testForceStopPackage() {
- final Task task = new StackBuilder(mWm.mRoot).build();
+ final Task task = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord activity = task.getTopMostActivity();
final WindowProcessController wpc = activity.app;
final ActivityRecord[] activities = {
diff --git a/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java
index 341509310e26..8a5b13c0bdce 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java
@@ -62,8 +62,7 @@ public class RunningTasksTest extends WindowTestsBase {
final int numStacks = 2;
for (int stackIndex = 0; stackIndex < numStacks; stackIndex++) {
- final Task stack = new StackBuilder(mRootWindowContainer)
- .setCreateActivity(false)
+ final Task stack = new TaskBuilder(mSupervisor)
.setDisplay(display)
.setOnTop(false)
.build();
@@ -104,8 +103,7 @@ public class RunningTasksTest extends WindowTestsBase {
final DisplayContent display = new TestDisplayContent.Builder(mAtm, 1000, 2500).build();
final int numTasks = 10;
for (int i = 0; i < numTasks; i++) {
- final Task stack = new StackBuilder(mRootWindowContainer)
- .setCreateActivity(false)
+ final Task stack = new TaskBuilder(mSupervisor)
.setDisplay(display)
.setOnTop(true)
.build();
@@ -135,7 +133,7 @@ public class RunningTasksTest extends WindowTestsBase {
final Task task = new TaskBuilder(mAtm.mStackSupervisor)
.setComponent(new ComponentName(mContext.getPackageName(), className))
.setTaskId(taskId)
- .setStack(stack)
+ .setParentTask(stack)
.build();
task.lastActiveTime = lastActiveTime;
final ActivityRecord activity = new ActivityBuilder(mAtm)
diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
index 468b2c35ffc2..29081d389225 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
@@ -72,7 +72,7 @@ public class SizeCompatTests extends WindowTestsBase {
private ActivityRecord mActivity;
private void setUpApp(DisplayContent display) {
- mStack = new StackBuilder(mRootWindowContainer).setDisplay(display).build();
+ mStack = new TaskBuilder(mSupervisor).setDisplay(display).setCreateActivity(true).build();
mTask = mStack.getBottomMostTask();
mActivity = mTask.getTopNonFinishingActivity();
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskDisplayAreaTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskDisplayAreaTests.java
index 260f1e9a9259..bc3b3a4d7ad1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskDisplayAreaTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskDisplayAreaTests.java
@@ -218,7 +218,7 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
final Task rootHomeTask = defaultTaskDisplayArea.getRootHomeTask();
rootHomeTask.mResizeMode = RESIZE_MODE_UNRESIZEABLE;
- final Task primarySplitTask = new StackBuilder(rootWindowContainer)
+ final Task primarySplitTask = new TaskBuilder(mSupervisor)
.setTaskDisplayArea(defaultTaskDisplayArea)
.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY)
.setActivityType(ACTIVITY_TYPE_STANDARD)
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
index 42de5e6b429d..1d32e17dd5e1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -1358,7 +1358,7 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase {
final Task stack = display.getDefaultTaskDisplayArea()
.createStack(display.getWindowingMode(), ACTIVITY_TYPE_STANDARD, true);
stack.setWindowingMode(WINDOWING_MODE_FREEFORM);
- final Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(stack).build();
// Just work around the unnecessary adjustments for bounds.
task.getWindowConfiguration().setBounds(bounds);
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
index 08537a4ea9c1..a908bfef98de 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
@@ -176,7 +176,7 @@ public class TaskRecordTests extends WindowTestsBase {
TaskDisplayArea taskDisplayArea = mAtm.mRootWindowContainer.getDefaultTaskDisplayArea();
Task stack = taskDisplayArea.createStack(WINDOWING_MODE_FREEFORM,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
- Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ Task task = new TaskBuilder(mSupervisor).setParentTask(stack).build();
final Configuration parentConfig = stack.getConfiguration();
parentConfig.windowConfiguration.setBounds(parentBounds);
parentConfig.densityDpi = DisplayMetrics.DENSITY_DEFAULT;
@@ -212,7 +212,7 @@ public class TaskRecordTests extends WindowTestsBase {
@Test
public void testBoundsOnModeChangeFreeformToFullscreen() {
DisplayContent display = mAtm.mRootWindowContainer.getDefaultDisplay();
- Task stack = new StackBuilder(mRootWindowContainer).setDisplay(display)
+ Task stack = new TaskBuilder(mSupervisor).setDisplay(display).setCreateActivity(true)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
Task task = stack.getBottomMostTask();
task.getRootActivity().setOrientation(SCREEN_ORIENTATION_UNSPECIFIED);
@@ -253,7 +253,7 @@ public class TaskRecordTests extends WindowTestsBase {
dr.setFixedToUserRotation(FIXED_TO_USER_ROTATION_ENABLED);
dr.setUserRotation(USER_ROTATION_FREE, ROTATION_0);
- final Task stack = new StackBuilder(mRootWindowContainer)
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true)
.setWindowingMode(WINDOWING_MODE_FULLSCREEN).setDisplay(display).build();
final Task task = stack.getBottomMostTask();
final ActivityRecord root = task.getTopNonFinishingActivity();
@@ -317,7 +317,7 @@ public class TaskRecordTests extends WindowTestsBase {
dr.setFixedToUserRotation(FIXED_TO_USER_ROTATION_ENABLED);
dr.setUserRotation(USER_ROTATION_FREE, ROTATION_0);
- final Task stack = new StackBuilder(mRootWindowContainer)
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true)
.setWindowingMode(WINDOWING_MODE_FULLSCREEN).setDisplay(display).build();
final Task task = stack.getBottomMostTask();
ActivityRecord root = task.getTopNonFinishingActivity();
@@ -341,7 +341,7 @@ public class TaskRecordTests extends WindowTestsBase {
Configuration.ORIENTATION_LANDSCAPE;
display.onRequestedOverrideConfigurationChanged(
display.getRequestedOverrideConfiguration());
- Task stack = new StackBuilder(mRootWindowContainer)
+ Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true)
.setWindowingMode(WINDOWING_MODE_FULLSCREEN).setDisplay(display).build();
Task task = stack.getBottomMostTask();
ActivityRecord root = task.getTopNonFinishingActivity();
@@ -497,7 +497,7 @@ public class TaskRecordTests extends WindowTestsBase {
DisplayInfo displayInfo = new DisplayInfo();
mAtm.mContext.getDisplay().getDisplayInfo(displayInfo);
final int displayHeight = displayInfo.logicalHeight;
- final Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ final Task task = new TaskBuilder(mSupervisor).setParentTask(stack).build();
final Configuration inOutConfig = new Configuration();
final Configuration parentConfig = new Configuration();
final int longSide = 1200;
@@ -1029,7 +1029,7 @@ public class TaskRecordTests extends WindowTestsBase {
}
private Task getTestTask() {
- final Task stack = new StackBuilder(mRootWindowContainer).build();
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
return stack.getBottomMostTask();
}
@@ -1039,7 +1039,7 @@ public class TaskRecordTests extends WindowTestsBase {
TaskDisplayArea taskDisplayArea = mAtm.mRootWindowContainer.getDefaultTaskDisplayArea();
Task stack = taskDisplayArea.createStack(windowingMode, ACTIVITY_TYPE_STANDARD,
true /* onTop */);
- Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ Task task = new TaskBuilder(mSupervisor).setParentTask(stack).build();
final Configuration parentConfig = stack.getConfiguration();
parentConfig.windowConfiguration.setAppBounds(parentBounds);
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java
index 4163a9a546a0..36f3a21e38f1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java
@@ -829,7 +829,7 @@ public class WindowContainerTests extends WindowTestsBase {
final DisplayContent displayContent = createNewDisplay();
// Do not reparent activity to default display when removing the display.
doReturn(true).when(displayContent).shouldDestroyContentOnRemove();
- final ActivityRecord r = new StackBuilder(mWm.mRoot)
+ final ActivityRecord r = new TaskBuilder(mSupervisor).setCreateActivity(true)
.setDisplay(displayContent).build().getTopMostActivity();
// Add a window and make the activity animating so the removal of activity is deferred.
createWindow(null, TYPE_BASE_APPLICATION, r, "win");
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java
index 46a6a82faba5..38909f6a28d4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowOrganizerTests.java
@@ -290,7 +290,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
@Test
public void testTaskTransaction() {
removeGlobalMinSizeRestriction();
- final Task stack = new StackBuilder(mWm.mRoot)
+ final Task stack = new TaskBuilder(mSupervisor)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
final Task task = stack.getTopMostTask();
testTransaction(task);
@@ -299,7 +299,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
@Test
public void testStackTransaction() {
removeGlobalMinSizeRestriction();
- final Task stack = new StackBuilder(mWm.mRoot)
+ final Task stack = new TaskBuilder(mSupervisor)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
StackInfo info =
mWm.mAtmService.getStackInfo(WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD);
@@ -324,7 +324,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
@Test
public void testSetWindowingMode() {
- final Task stack = new StackBuilder(mWm.mRoot)
+ final Task stack = new TaskBuilder(mSupervisor)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
testSetWindowingMode(stack);
@@ -358,7 +358,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
@Test
public void testContainerFocusableChanges() {
removeGlobalMinSizeRestriction();
- final Task stack = new StackBuilder(mWm.mRoot)
+ final Task stack = new TaskBuilder(mSupervisor)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
final Task task = stack.getTopMostTask();
WindowContainerTransaction t = new WindowContainerTransaction();
@@ -374,7 +374,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
@Test
public void testContainerHiddenChanges() {
removeGlobalMinSizeRestriction();
- final Task stack = new StackBuilder(mWm.mRoot)
+ final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
WindowContainerTransaction t = new WindowContainerTransaction();
assertTrue(stack.shouldBeVisible(null));
@@ -389,7 +389,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
@Test
public void testOverrideConfigSize() {
removeGlobalMinSizeRestriction();
- final Task stack = new StackBuilder(mWm.mRoot)
+ final Task stack = new TaskBuilder(mSupervisor)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
final Task task = stack.getTopMostTask();
WindowContainerTransaction t = new WindowContainerTransaction();
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index 38c4e0a7de02..7daddd8720ab 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -90,6 +90,7 @@ import com.android.server.AttributeCache;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.Description;
+import org.mockito.Mockito;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -398,22 +399,20 @@ class WindowTestsBase extends SystemServiceTestsBase {
}
Task createTaskStackOnDisplay(int windowingMode, int activityType, DisplayContent dc) {
- return new StackBuilder(dc.mWmService.mRoot)
+ return new TaskBuilder(dc.mAtmService.mStackSupervisor)
.setDisplay(dc)
.setWindowingMode(windowingMode)
.setActivityType(activityType)
- .setCreateActivity(false)
.setIntent(new Intent())
.build();
}
Task createTaskStackOnTaskDisplayArea(int windowingMode, int activityType,
TaskDisplayArea tda) {
- return new StackBuilder(tda.mWmService.mRoot)
+ return new TaskBuilder(tda.mDisplayContent.mAtmService.mStackSupervisor)
.setTaskDisplayArea(tda)
.setWindowingMode(windowingMode)
.setActivityType(activityType)
- .setCreateActivity(false)
.setIntent(new Intent())
.build();
}
@@ -422,7 +421,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
Task createTaskInStack(Task stack, int userId) {
final Task task = new TaskBuilder(stack.mStackSupervisor)
.setUserId(userId)
- .setStack(stack)
+ .setParentTask(stack)
.build();
return task;
}
@@ -733,7 +732,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
if (mCreateTask) {
mTask = new TaskBuilder(mService.mStackSupervisor)
.setComponent(mComponent)
- .setStack(mStack).build();
+ .setParentTask(mStack).build();
} else if (mTask == null && mStack != null && DisplayContent.alwaysCreateStack(
mStack.getWindowingMode(), mStack.getActivityType())) {
// The stack can be the task root.
@@ -813,43 +812,51 @@ class WindowTestsBase extends SystemServiceTestsBase {
protected static class TaskBuilder {
private final ActivityStackSupervisor mSupervisor;
+ private TaskDisplayArea mTaskDisplayArea;
private ComponentName mComponent;
private String mPackage;
private int mFlags = 0;
- // Task id 0 is reserved in ARC for the home app.
- private int mTaskId = SystemServicesTestRule.sNextTaskId++;
+ private int mTaskId = -1;
private int mUserId = 0;
+ private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
+ private int mActivityType = ACTIVITY_TYPE_STANDARD;
+ private ActivityInfo mActivityInfo;
+ private Intent mIntent;
+ private boolean mOnTop = true;
private IVoiceInteractionSession mVoiceSession;
- private boolean mCreateStack = true;
- private Task mStack;
- private TaskDisplayArea mTaskDisplayArea;
+ private boolean mCreateParentTask = false;
+ private Task mParentTask;
+
+ private boolean mCreateActivity = false;
TaskBuilder(ActivityStackSupervisor supervisor) {
mSupervisor = supervisor;
+ mTaskDisplayArea = mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea();
}
- TaskBuilder setComponent(ComponentName component) {
- mComponent = component;
+ /**
+ * Set the parent {@link DisplayContent} and use the default task display area. Overrides
+ * the task display area, if was set before.
+ */
+ TaskBuilder setDisplay(DisplayContent display) {
+ mTaskDisplayArea = display.getDefaultTaskDisplayArea();
return this;
}
- TaskBuilder setPackage(String packageName) {
- mPackage = packageName;
+ /** Set the parent {@link TaskDisplayArea}. Overrides the display, if was set before. */
+ TaskBuilder setTaskDisplayArea(TaskDisplayArea taskDisplayArea) {
+ mTaskDisplayArea = taskDisplayArea;
return this;
}
- /**
- * Set to {@code true} by default, set to {@code false} to prevent the task from
- * automatically creating a parent stack.
- */
- TaskBuilder setCreateStack(boolean createStack) {
- mCreateStack = createStack;
+ TaskBuilder setComponent(ComponentName component) {
+ mComponent = component;
return this;
}
- TaskBuilder setVoiceSession(IVoiceInteractionSession session) {
- mVoiceSession = session;
+ TaskBuilder setPackage(String packageName) {
+ mPackage = packageName;
return this;
}
@@ -868,156 +875,117 @@ class WindowTestsBase extends SystemServiceTestsBase {
return this;
}
- TaskBuilder setStack(Task stack) {
- mStack = stack;
- return this;
- }
-
- TaskBuilder setDisplay(DisplayContent display) {
- mTaskDisplayArea = display.getDefaultTaskDisplayArea();
- return this;
- }
-
- Task build() {
- SystemServicesTestRule.checkHoldsLock(mSupervisor.mService.mGlobalLock);
-
- if (mStack == null && mCreateStack) {
- TaskDisplayArea displayArea = mTaskDisplayArea != null ? mTaskDisplayArea
- : mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea();
- mStack = displayArea.createStack(
- WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
- spyOn(mStack);
- }
-
- final ActivityInfo aInfo = new ActivityInfo();
- aInfo.applicationInfo = new ApplicationInfo();
- aInfo.applicationInfo.packageName = mPackage;
-
- Intent intent = new Intent();
- if (mComponent == null) {
- mComponent = ComponentName.createRelative(DEFAULT_COMPONENT_PACKAGE_NAME,
- DEFAULT_COMPONENT_CLASS_NAME);
- }
-
- intent.setComponent(mComponent);
- intent.setFlags(mFlags);
-
- final Task task = new Task(mSupervisor.mService, mTaskId, aInfo,
- intent /*intent*/, mVoiceSession, null /*_voiceInteractor*/,
- null /*taskDescription*/, mStack);
- spyOn(task);
- task.mUserId = mUserId;
-
- if (mStack != null) {
- mStack.moveToFront("test");
- mStack.addChild(task, true, true);
- }
-
- return task;
- }
- }
-
- static class StackBuilder {
- private final RootWindowContainer mRootWindowContainer;
- private DisplayContent mDisplay;
- private TaskDisplayArea mTaskDisplayArea;
- private int mStackId = -1;
- private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
- private int mActivityType = ACTIVITY_TYPE_STANDARD;
- private boolean mOnTop = true;
- private boolean mCreateActivity = true;
- private ActivityInfo mInfo;
- private Intent mIntent;
-
- StackBuilder(RootWindowContainer root) {
- mRootWindowContainer = root;
- mDisplay = mRootWindowContainer.getDefaultDisplay();
- mTaskDisplayArea = mDisplay.getDefaultTaskDisplayArea();
- }
-
- StackBuilder setWindowingMode(int windowingMode) {
+ TaskBuilder setWindowingMode(int windowingMode) {
mWindowingMode = windowingMode;
return this;
}
- StackBuilder setActivityType(int activityType) {
+ TaskBuilder setActivityType(int activityType) {
mActivityType = activityType;
return this;
}
- StackBuilder setStackId(int stackId) {
- mStackId = stackId;
+ TaskBuilder setActivityInfo(ActivityInfo info) {
+ mActivityInfo = info;
return this;
}
- /**
- * Set the parent {@link DisplayContent} and use the default task display area. Overrides
- * the task display area, if was set before.
- */
- StackBuilder setDisplay(DisplayContent display) {
- mDisplay = display;
- mTaskDisplayArea = mDisplay.getDefaultTaskDisplayArea();
+ TaskBuilder setIntent(Intent intent) {
+ mIntent = intent;
return this;
}
- /** Set the parent {@link TaskDisplayArea}. Overrides the display, if was set before. */
- StackBuilder setTaskDisplayArea(TaskDisplayArea taskDisplayArea) {
- mTaskDisplayArea = taskDisplayArea;
- mDisplay = mTaskDisplayArea.mDisplayContent;
+ TaskBuilder setOnTop(boolean onTop) {
+ mOnTop = onTop;
return this;
}
- StackBuilder setOnTop(boolean onTop) {
- mOnTop = onTop;
+ TaskBuilder setVoiceSession(IVoiceInteractionSession session) {
+ mVoiceSession = session;
return this;
}
- StackBuilder setCreateActivity(boolean createActivity) {
- mCreateActivity = createActivity;
+ TaskBuilder setCreateParentTask(boolean createParentTask) {
+ mCreateParentTask = createParentTask;
return this;
}
- StackBuilder setActivityInfo(ActivityInfo info) {
- mInfo = info;
+ TaskBuilder setParentTask(Task parentTask) {
+ mParentTask = parentTask;
return this;
}
- StackBuilder setIntent(Intent intent) {
- mIntent = intent;
+ TaskBuilder setCreateActivity(boolean createActivity) {
+ mCreateActivity = createActivity;
return this;
}
Task build() {
- SystemServicesTestRule.checkHoldsLock(mRootWindowContainer.mWmService.mGlobalLock);
+ SystemServicesTestRule.checkHoldsLock(mSupervisor.mService.mGlobalLock);
+
+ // Create parent task.
+ if (mParentTask == null && mCreateParentTask) {
+ mParentTask = mTaskDisplayArea.createStack(
+ WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
+ }
+ if (mParentTask != null && !Mockito.mockingDetails(mParentTask).isSpy()) {
+ spyOn(mParentTask);
+ }
+
+ // Create task.
+ if (mActivityInfo == null) {
+ mActivityInfo = new ActivityInfo();
+ mActivityInfo.applicationInfo = new ApplicationInfo();
+ mActivityInfo.applicationInfo.packageName = mPackage;
+ }
- final int stackId = mStackId >= 0 ? mStackId : mTaskDisplayArea.getNextStackId();
- final Task stack = mTaskDisplayArea.createStackUnchecked(
- mWindowingMode, mActivityType, stackId, mOnTop, mInfo, mIntent,
- false /* createdByOrganizer */);
- final ActivityStackSupervisor supervisor = mRootWindowContainer.mStackSupervisor;
+ if (mIntent == null) {
+ mIntent = new Intent();
+ if (mComponent == null) {
+ mComponent = ComponentName.createRelative(DEFAULT_COMPONENT_PACKAGE_NAME,
+ DEFAULT_COMPONENT_CLASS_NAME);
+ }
+ mIntent.setComponent(mComponent);
+ mIntent.setFlags(mFlags);
+ }
+ Task task;
+ final int taskId = mTaskId >= 0 ? mTaskId : mTaskDisplayArea.getNextStackId();
+ if (mParentTask == null) {
+ task = mTaskDisplayArea.createStackUnchecked(
+ mWindowingMode, mActivityType, taskId, mOnTop, mActivityInfo,
+ mIntent, false /* createdByOrganizer */);
+ } else {
+ task = new Task(mSupervisor.mService, taskId, mActivityInfo,
+ mIntent /*intent*/, mVoiceSession, null /*_voiceInteractor*/,
+ null /*taskDescription*/, mParentTask);
+ mParentTask.moveToFront("build-task");
+ mParentTask.addChild(task, true, true);
+ }
+ spyOn(task);
+ task.mUserId = mUserId;
+ Task rootTask = task.getRootTask();
+ doNothing().when(rootTask).startActivityLocked(
+ any(), any(), anyBoolean(), anyBoolean(), any());
+
+ // Create child task with activity.
if (mCreateActivity) {
- new ActivityBuilder(supervisor.mService)
+ new ActivityBuilder(mSupervisor.mService)
.setCreateTask(true)
- .setStack(stack)
+ .setStack(task)
.build();
if (mOnTop) {
// We move the task to front again in order to regain focus after activity
- // added to the stack. Or {@link DisplayContent#mPreferredTopFocusableStack}
+ // added to the stack. Or {@link TaskDisplayArea#mPreferredTopFocusableStack}
// could be other stacks (e.g. home stack).
- stack.moveToFront("createActivityStack");
+ task.moveToFront("createActivityTask");
} else {
- stack.moveToBack("createActivityStack", null);
+ task.moveToBack("createActivityTask", null);
}
}
- spyOn(stack);
-
- doNothing().when(stack).startActivityLocked(
- any(), any(), anyBoolean(), anyBoolean(), any());
- return stack;
+ return task;
}
-
}
static class TestSplitOrganizer extends ITaskOrganizer.Stub {