summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/am/PendingIntentRecord.java15
-rw-r--r--services/core/java/com/android/server/am/SafeActivityOptions.java7
2 files changed, 15 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java
index 483fec67a429..e0aa2a261b3c 100644
--- a/services/core/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/core/java/com/android/server/am/PendingIntentRecord.java
@@ -283,6 +283,14 @@ final class PendingIntentRecord extends IIntentSender.Stub {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
+ // Extract options before clearing calling identity
+ SafeActivityOptions mergedOptions = key.options;
+ if (mergedOptions == null) {
+ mergedOptions = SafeActivityOptions.fromBundle(options);
+ } else {
+ mergedOptions.setCallerOptions(ActivityOptions.fromBundle(options));
+ }
+
final long origId = Binder.clearCallingIdentity();
if (whitelistDuration != null) {
@@ -319,13 +327,6 @@ final class PendingIntentRecord extends IIntentSender.Stub {
switch (key.type) {
case ActivityManager.INTENT_SENDER_ACTIVITY:
try {
- SafeActivityOptions mergedOptions = key.options;
- if (mergedOptions == null) {
- mergedOptions = SafeActivityOptions.fromBundle(options);
- } else {
- mergedOptions.setCallerOptions(ActivityOptions.fromBundle(options));
- }
-
// Note when someone has a pending intent, even from different
// users, then there's no need to ensure the calling user matches
// the target user, so validateIncomingUser is always false below.
diff --git a/services/core/java/com/android/server/am/SafeActivityOptions.java b/services/core/java/com/android/server/am/SafeActivityOptions.java
index 2de752731ab6..0fb69e777ecc 100644
--- a/services/core/java/com/android/server/am/SafeActivityOptions.java
+++ b/services/core/java/com/android/server/am/SafeActivityOptions.java
@@ -32,6 +32,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Binder;
import android.os.Bundle;
+import android.os.Process;
import android.os.UserHandle;
import android.util.Slog;
import android.view.RemoteAnimationAdapter;
@@ -78,6 +79,9 @@ class SafeActivityOptions {
mOriginalCallingPid = Binder.getCallingPid();
mOriginalCallingUid = Binder.getCallingUid();
mOriginalOptions = options;
+ if (mOriginalCallingPid == Process.myPid()) {
+ Slog.wtf(TAG, "Safe activity options constructed after clearing calling id");
+ }
}
/**
@@ -89,6 +93,9 @@ class SafeActivityOptions {
mRealCallingPid = Binder.getCallingPid();
mRealCallingUid = Binder.getCallingUid();
mCallerOptions = options;
+ if (mRealCallingPid == Process.myPid()) {
+ Slog.wtf(TAG, "setCallerOptions called after clearing calling id");
+ }
}
/**