Merge "Fix task selection logic" into nyc-dev am: 265bd89c3c
am: f4b91fe3e1
* commit 'f4b91fe3e18b98e575cf498a5fdbcd8ad9603ce1':
Fix task selection logic
Change-Id: I4d665fad6c972bdb11a192256d21f5fb9a27c96a
This commit is contained in:
@@ -785,17 +785,8 @@ final class ActivityStack {
|
|||||||
+ taskIntent.getComponent().flattenToShortString()
|
+ taskIntent.getComponent().flattenToShortString()
|
||||||
+ "/aff=" + r.task.rootAffinity + " to new cls="
|
+ "/aff=" + r.task.rootAffinity + " to new cls="
|
||||||
+ intent.getComponent().flattenToShortString() + "/aff=" + info.taskAffinity);
|
+ intent.getComponent().flattenToShortString() + "/aff=" + info.taskAffinity);
|
||||||
if (!isDocument && !taskIsDocument
|
// TODO Refactor to remove duplications. Check if logic can be simplified.
|
||||||
&& result.r == null && task.canMatchRootAffinity()) {
|
if (taskIntent != null && taskIntent.getComponent() != null &&
|
||||||
if (task.rootAffinity.equals(target.taskAffinity)) {
|
|
||||||
if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching affinity candidate!");
|
|
||||||
// It is possible for multiple tasks to have the same root affinity especially
|
|
||||||
// if they are in separate stacks. We save off this candidate, but keep looking
|
|
||||||
// to see if there is a better candidate.
|
|
||||||
result.r = r;
|
|
||||||
result.matchedByRootAffinity = true;
|
|
||||||
}
|
|
||||||
} else if (taskIntent != null && taskIntent.getComponent() != null &&
|
|
||||||
taskIntent.getComponent().compareTo(cls) == 0 &&
|
taskIntent.getComponent().compareTo(cls) == 0 &&
|
||||||
Objects.equals(documentData, taskDocumentData)) {
|
Objects.equals(documentData, taskDocumentData)) {
|
||||||
if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching class!");
|
if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching class!");
|
||||||
@@ -815,6 +806,16 @@ final class ActivityStack {
|
|||||||
result.r = r;
|
result.r = r;
|
||||||
result.matchedByRootAffinity = false;
|
result.matchedByRootAffinity = false;
|
||||||
break;
|
break;
|
||||||
|
} else if (!isDocument && !taskIsDocument
|
||||||
|
&& result.r == null && task.canMatchRootAffinity()) {
|
||||||
|
if (task.rootAffinity.equals(target.taskAffinity)) {
|
||||||
|
if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching affinity candidate!");
|
||||||
|
// It is possible for multiple tasks to have the same root affinity especially
|
||||||
|
// if they are in separate stacks. We save off this candidate, but keep looking
|
||||||
|
// to see if there is a better candidate.
|
||||||
|
result.r = r;
|
||||||
|
result.matchedByRootAffinity = true;
|
||||||
|
}
|
||||||
} else if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Not a match: " + task);
|
} else if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Not a match: " + task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1580,7 +1580,7 @@ class ActivityStarter {
|
|||||||
}
|
}
|
||||||
intentActivity.deliverNewIntentLocked(mCallingUid, mStartActivity.intent,
|
intentActivity.deliverNewIntentLocked(mCallingUid, mStartActivity.intent,
|
||||||
mStartActivity.launchedFromPackage);
|
mStartActivity.launchedFromPackage);
|
||||||
} else if (!intentActivity.task.isSameIntentResolution(mStartActivity)) {
|
} else if (!intentActivity.task.isSameIntentFilter(mStartActivity)) {
|
||||||
// In this case we are launching the root activity of the task, but with a
|
// In this case we are launching the root activity of the task, but with a
|
||||||
// different intent. We should start a new instance on top.
|
// different intent. We should start a new instance on top.
|
||||||
mAddingToTask = true;
|
mAddingToTask = true;
|
||||||
|
|||||||
@@ -492,10 +492,10 @@ final class TaskRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the input activity has the same intent resolution as the intent this task
|
* Return true if the input activity has the same intent filter as the intent this task
|
||||||
* record is based on (normally the root activity intent).
|
* record is based on (normally the root activity intent).
|
||||||
*/
|
*/
|
||||||
boolean isSameIntentResolution(ActivityRecord r) {
|
boolean isSameIntentFilter(ActivityRecord r) {
|
||||||
final Intent intent = new Intent(r.intent);
|
final Intent intent = new Intent(r.intent);
|
||||||
// Correct the activity intent for aliasing. The task record intent will always be based on
|
// Correct the activity intent for aliasing. The task record intent will always be based on
|
||||||
// the real activity that will be launched not the alias, so we need to use an intent with
|
// the real activity that will be launched not the alias, so we need to use an intent with
|
||||||
|
|||||||
Reference in New Issue
Block a user