Merge "Use TaskFactory to create ActivityStack." into rvc-dev am: 967943d31f
Change-Id: I127f8180ac66dfe13b3a9179e592305490e5df46
This commit is contained in:
@@ -556,9 +556,9 @@ class ActivityStack extends Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityStack(DisplayContent display, int id, ActivityStackSupervisor supervisor,
|
ActivityStack(ActivityTaskManagerService atmService, int id, int activityType,
|
||||||
int activityType, ActivityInfo info, Intent intent) {
|
ActivityInfo info, Intent intent) {
|
||||||
this(supervisor.mService, id, info, intent, null /*voiceSession*/, null /*voiceInteractor*/,
|
this(atmService, id, info, intent, null /*voiceSession*/, null /*voiceInteractor*/,
|
||||||
null /*taskDescription*/, null /*stack*/);
|
null /*taskDescription*/, null /*stack*/);
|
||||||
|
|
||||||
setActivityType(activityType);
|
setActivityType(activityType);
|
||||||
|
|||||||
@@ -5874,8 +5874,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
// Since this stack will be put into a tile, its windowingMode will be inherited.
|
// Since this stack will be put into a tile, its windowingMode will be inherited.
|
||||||
windowingMode = WINDOWING_MODE_UNDEFINED;
|
windowingMode = WINDOWING_MODE_UNDEFINED;
|
||||||
}
|
}
|
||||||
final ActivityStack stack = new ActivityStack(this, stackId,
|
final ActivityStack stack = (ActivityStack) Task.create(mAtmService, stackId, activityType,
|
||||||
mRootWindowContainer.mStackSupervisor, activityType, info, intent);
|
info, intent);
|
||||||
addStack(stack, onTop ? POSITION_TOP : POSITION_BOTTOM);
|
addStack(stack, onTop ? POSITION_TOP : POSITION_BOTTOM);
|
||||||
stack.setWindowingMode(windowingMode, false /* animate */, false /* showRecents */,
|
stack.setWindowingMode(windowingMode, false /* animate */, false /* showRecents */,
|
||||||
false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
|
false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
|
||||||
|
|||||||
@@ -3636,6 +3636,11 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
sTaskFactory = factory;
|
sTaskFactory = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Task create(ActivityTaskManagerService service, int taskId, int activityType,
|
||||||
|
ActivityInfo info, Intent intent) {
|
||||||
|
return getTaskFactory().create(service, taskId, activityType, info, intent);
|
||||||
|
}
|
||||||
|
|
||||||
static Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
static Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||||
Intent intent, IVoiceInteractionSession voiceSession,
|
Intent intent, IVoiceInteractionSession voiceSession,
|
||||||
IVoiceInteractor voiceInteractor, ActivityStack stack) {
|
IVoiceInteractor voiceInteractor, ActivityStack stack) {
|
||||||
@@ -3643,11 +3648,6 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
service, taskId, info, intent, voiceSession, voiceInteractor, stack);
|
service, taskId, info, intent, voiceSession, voiceInteractor, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
|
||||||
Intent intent, TaskDescription taskDescription, ActivityStack stack) {
|
|
||||||
return getTaskFactory().create(service, taskId, info, intent, taskDescription, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Task restoreFromXml(XmlPullParser in, ActivityStackSupervisor stackSupervisor)
|
static Task restoreFromXml(XmlPullParser in, ActivityStackSupervisor stackSupervisor)
|
||||||
throws IOException, XmlPullParserException {
|
throws IOException, XmlPullParserException {
|
||||||
return getTaskFactory().restoreFromXml(in, stackSupervisor);
|
return getTaskFactory().restoreFromXml(in, stackSupervisor);
|
||||||
@@ -3659,6 +3659,10 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
* {@link #setTaskFactory(TaskFactory)}.
|
* {@link #setTaskFactory(TaskFactory)}.
|
||||||
*/
|
*/
|
||||||
static class TaskFactory {
|
static class TaskFactory {
|
||||||
|
Task create(ActivityTaskManagerService service, int taskId, int activityType,
|
||||||
|
ActivityInfo info, Intent intent) {
|
||||||
|
return new ActivityStack(service, taskId, activityType, info, intent);
|
||||||
|
}
|
||||||
|
|
||||||
Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||||
Intent intent, IVoiceInteractionSession voiceSession,
|
Intent intent, IVoiceInteractionSession voiceSession,
|
||||||
@@ -3667,12 +3671,6 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
null /*taskDescription*/, stack);
|
null /*taskDescription*/, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
|
||||||
Intent intent, TaskDescription taskDescription, ActivityStack stack) {
|
|
||||||
return new ActivityStack(service, taskId, info, intent, null /*voiceSession*/,
|
|
||||||
null /*voiceInteractor*/, taskDescription, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should only be used when we're restoring {@link Task} from storage.
|
* Should only be used when we're restoring {@link Task} from storage.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ public class TaskRecordTests extends ActivityTestsBase {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
Task.setTaskFactory(null);
|
|
||||||
mParentBounds = new Rect(10 /*left*/, 30 /*top*/, 80 /*right*/, 60 /*bottom*/);
|
mParentBounds = new Rect(10 /*left*/, 30 /*top*/, 80 /*right*/, 60 /*bottom*/);
|
||||||
removeGlobalMinSizeRestriction();
|
removeGlobalMinSizeRestriction();
|
||||||
}
|
}
|
||||||
@@ -148,11 +147,16 @@ public class TaskRecordTests extends ActivityTestsBase {
|
|||||||
TestTaskFactory factory = new TestTaskFactory();
|
TestTaskFactory factory = new TestTaskFactory();
|
||||||
Task.setTaskFactory(factory);
|
Task.setTaskFactory(factory);
|
||||||
|
|
||||||
assertFalse(factory.mCreated);
|
try {
|
||||||
|
assertFalse(factory.mCreated);
|
||||||
|
|
||||||
Task.create(null, 0, null, null, null, null);
|
Task.create(mService, 0 /*taskId*/, 0 /*activityType*/,
|
||||||
|
new ActivityInfo(), new Intent());
|
||||||
|
|
||||||
assertTrue(factory.mCreated);
|
assertTrue(factory.mCreated);
|
||||||
|
} finally {
|
||||||
|
Task.setTaskFactory(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -509,7 +513,7 @@ public class TaskRecordTests extends ActivityTestsBase {
|
|||||||
info.targetActivity = targetClassName;
|
info.targetActivity = targetClassName;
|
||||||
|
|
||||||
final Task task = Task.create(mService, 1 /* taskId */, info, intent,
|
final Task task = Task.create(mService, 1 /* taskId */, info, intent,
|
||||||
null /* taskDescription */, null /*stack*/);
|
null /* voiceSession */, null /* voiceInteractor */, null /*stack*/);
|
||||||
assertEquals("The alias activity component should be saved in task intent.", aliasClassName,
|
assertEquals("The alias activity component should be saved in task intent.", aliasClassName,
|
||||||
task.intent.getComponent().getClassName());
|
task.intent.getComponent().getClassName());
|
||||||
|
|
||||||
@@ -997,17 +1001,16 @@ public class TaskRecordTests extends ActivityTestsBase {
|
|||||||
private boolean mCreated = false;
|
private boolean mCreated = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
Task create(ActivityTaskManagerService service, int taskId, int activityType,
|
||||||
Intent intent, IVoiceInteractionSession voiceSession,
|
ActivityInfo info, Intent intent) {
|
||||||
IVoiceInteractor voiceInteractor, ActivityStack stack) {
|
|
||||||
mCreated = true;
|
mCreated = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
Task create(ActivityTaskManagerService service, int taskId, ActivityInfo info,
|
||||||
Intent intent, ActivityManager.TaskDescription taskDescription,
|
Intent intent, IVoiceInteractionSession voiceSession,
|
||||||
ActivityStack stack) {
|
IVoiceInteractor voiceInteractor, ActivityStack stack) {
|
||||||
mCreated = true;
|
mCreated = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user