summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2014-08-12 18:29:31 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2014-08-12 18:13:56 +0000
commit7a2b9936022d6d7dc5b237a7e166e230a50df25e (patch)
tree21c348f7a1e44d551794740c78e230bd93ca09b1
parent015cb5dc71b653db9eb61aaa3798df485df47ed9 (diff)
parentfee26771cfed736d207a8ee9c97134c848be1a52 (diff)
Merge "Ensuring that we update the calling uid/package when updating a task's original intent. (Bug 16676636)" into lmp-dev
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java10
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java12
2 files changed, 15 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 4a99ef334208..3d23cb73990e 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1714,7 +1714,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// the activity based on affinity... now that we
// are actually launching it, we can assign the
// base intent.
- intentActivity.task.setIntent(intent, r.info);
+ intentActivity.task.setIntent(r);
}
// If the target task is not in the front, then we need
// to bring it to the front... except... well, with
@@ -1771,7 +1771,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// not be too hard...
reuseTask = intentActivity.task;
reuseTask.performClearTaskLocked();
- reuseTask.setIntent(r.intent, r.info);
+ reuseTask.setIntent(r);
} else if ((launchFlags&Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0
|| launchSingleInstance || launchSingleTask) {
// In this situation we want to remove all activities
@@ -1786,7 +1786,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// intents for the top activity, so make sure
// the task now has the identity of the new
// intent.
- top.task.setIntent(r.intent, r.info);
+ top.task.setIntent(r);
}
ActivityStack.logStartActivity(EventLogTags.AM_NEW_INTENT,
r, top.task);
@@ -1815,7 +1815,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
ActivityStack.logStartActivity(EventLogTags.AM_NEW_INTENT, r,
intentActivity.task);
if (intentActivity.frontOfTask) {
- intentActivity.task.setIntent(r.intent, r.info);
+ intentActivity.task.setIntent(r);
}
intentActivity.deliverNewIntentLocked(callingUid, r.intent);
} else if (!r.intent.filterEquals(intentActivity.task.intent)) {
@@ -1841,7 +1841,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// at the bottom of its stack, but that's a little hard
// to do with the current organization of the code so
// for now we'll just drop it.
- intentActivity.task.setIntent(r.intent, r.info);
+ intentActivity.task.setIntent(r);
}
if (!addingToTask && reuseTask == null) {
// We didn't do anything... but it was needed (a.k.a., client
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index d0ec106d4ddf..ccca657904e7 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -220,7 +220,15 @@ final class TaskRecord {
return System.currentTimeMillis() - lastActiveTime;
}
- void setIntent(Intent _intent, ActivityInfo info) {
+ /** Sets the original intent, and the calling uid and package. */
+ void setIntent(ActivityRecord r) {
+ setIntent(r.intent, r.info);
+ mCallingUid = r.launchedFromUid;
+ mCallingPackage = r.launchedFromPackage;
+ }
+
+ /** Sets the original intent, _without_ updating the calling uid or package. */
+ private void setIntent(Intent _intent, ActivityInfo info) {
if (intent == null) {
mNeverRelinquishIdentity =
(info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0;
@@ -723,7 +731,7 @@ final class TaskRecord {
void updateEffectiveIntent() {
final int effectiveRootIndex = findEffectiveRootIndex();
final ActivityRecord r = mActivities.get(effectiveRootIndex);
- setIntent(r.intent, r.info);
+ setIntent(r);
}
void saveTaskDescription(ActivityManager.TaskDescription taskDescription,