Merge "Fix another issue with constructing SafeActivityOptions" into pi-dev
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user