summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wale Ogunwale <ogunwale@google.com> 2016-02-29 14:27:32 -0800
committer Wale Ogunwale <ogunwale@google.com> 2016-02-29 14:27:32 -0800
commit715a1dcffd06e7d27a6c980a0ac8ca935362f08b (patch)
treeb2f7f201e9246bdb1f155fdadd428e4e4c891872
parent3f3d42e0d40c423bf932d16bb10892d16d35c641 (diff)
Use realActivity name when comparing if intents are the same
The TaskRecord intent (usually the intent of the root activity) component names are based on the realActivity (the activity we are actually launching and not the input alias) and the ActivityRecord intent is based on the input component name which can be an alias. This leads to issues when we are trying to compare the intent of a task and an activity to see if they resolve to the same thing since the component names will be different in the case of aliasing. We know base the activity intent component name on the realActivity before comparing with the task record intent. Bug: 27403679 Bug: 27112965 Change-Id: I196e03bb018582cbac977fb3ad45354f00f51578
-rw-r--r--services/core/java/com/android/server/am/ActivityStarter.java2
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java13
2 files changed, 14 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index 018164028fd0..bcdc800c5857 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -1416,7 +1416,7 @@ class ActivityStarter {
}
intentActivity.deliverNewIntentLocked(mCallingUid, mStartActivity.intent,
mStartActivity.launchedFromPackage);
- } else if (!mStartActivity.intent.filterEquals(intentActivity.intent)) {
+ } else if (!intentActivity.task.isSameIntentResolution(mStartActivity)) {
// 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.
mAddingToTask = true;
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 37a549a960a7..62275a98aba1 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -469,6 +469,19 @@ final class TaskRecord {
setLockTaskAuth();
}
+ /**
+ * Return true if the input activity has the same intent resolution as the intent this task
+ * record is based on (normally the root activity intent).
+ */
+ boolean isSameIntentResolution(ActivityRecord r) {
+ final Intent intent = new Intent(r.intent);
+ // 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 component name pointing to the real activity not the alias in the activity record.
+ intent.setComponent(r.realActivity);
+ return this.intent.filterEquals(intent);
+ }
+
void setTaskToReturnTo(int taskToReturnTo) {
mTaskToReturnTo = (taskToReturnTo == RECENTS_ACTIVITY_TYPE)
? HOME_ACTIVITY_TYPE : taskToReturnTo;