Merge "Use the real activity component to find reusable task" into qt-dev
This commit is contained in:
@@ -1387,13 +1387,12 @@ class ActivityStack extends ConfigurationContainer {
|
||||
}
|
||||
|
||||
if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Comparing existing cls="
|
||||
+ taskIntent.getComponent().flattenToShortString()
|
||||
+ (task.realActivity != null ? task.realActivity.flattenToShortString() : "")
|
||||
+ "/aff=" + r.getTaskRecord().rootAffinity + " to new cls="
|
||||
+ intent.getComponent().flattenToShortString() + "/aff=" + info.taskAffinity);
|
||||
// TODO Refactor to remove duplications. Check if logic can be simplified.
|
||||
if (taskIntent != null && taskIntent.getComponent() != null &&
|
||||
taskIntent.getComponent().compareTo(cls) == 0 &&
|
||||
Objects.equals(documentData, taskDocumentData)) {
|
||||
if (task.realActivity != null && task.realActivity.compareTo(cls) == 0
|
||||
&& Objects.equals(documentData, taskDocumentData)) {
|
||||
if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching class!");
|
||||
//dump();
|
||||
if (DEBUG_TASKS) Slog.d(TAG_TASKS,
|
||||
|
||||
@@ -261,6 +261,35 @@ public class ActivityStackTests extends ActivityTestsBase {
|
||||
assertNotNull(result.mRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindTaskAlias() {
|
||||
final String targetActivity = "target.activity";
|
||||
final String aliasActivity = "alias.activity";
|
||||
final ComponentName target = new ComponentName(DEFAULT_COMPONENT_PACKAGE_NAME,
|
||||
targetActivity);
|
||||
final ComponentName alias = new ComponentName(DEFAULT_COMPONENT_PACKAGE_NAME,
|
||||
aliasActivity);
|
||||
final TaskRecord task = new TaskBuilder(mService.mStackSupervisor).setStack(mStack).build();
|
||||
task.origActivity = alias;
|
||||
task.realActivity = target;
|
||||
new ActivityBuilder(mService).setComponent(target).setTask(task).setTargetActivity(
|
||||
targetActivity).build();
|
||||
|
||||
// Using target activity to find task.
|
||||
final ActivityRecord r1 = new ActivityBuilder(mService).setComponent(
|
||||
target).setTargetActivity(targetActivity).build();
|
||||
RootActivityContainer.FindTaskResult result = new RootActivityContainer.FindTaskResult();
|
||||
mStack.findTaskLocked(r1, result);
|
||||
assertThat(result.mRecord).isNotNull();
|
||||
|
||||
// Using alias activity to find task.
|
||||
final ActivityRecord r2 = new ActivityBuilder(mService).setComponent(
|
||||
alias).setTargetActivity(targetActivity).build();
|
||||
result = new RootActivityContainer.FindTaskResult();
|
||||
mStack.findTaskLocked(r2, result);
|
||||
assertThat(result.mRecord).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoveStackToBackIncludingParent() {
|
||||
final ActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
|
||||
|
||||
Reference in New Issue
Block a user