Merge "Fix issue #38393543: Not allowed to start service Intent" into oc-dev
am: ad6dde65ff
Change-Id: Ife26f513fa6d04771148a3965171822874854828
This commit is contained in:
@@ -4719,7 +4719,9 @@ public class Activity extends ContextThemeWrapper
|
||||
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
|
||||
}
|
||||
int result = ActivityManager.getService()
|
||||
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
|
||||
.startActivityIntentSender(mMainThread.getApplicationThread(),
|
||||
intent != null ? intent.getTarget() : null,
|
||||
intent != null ? intent.getWhitelistToken() : null,
|
||||
fillInIntent, resolvedType, mToken, who,
|
||||
requestCode, flagsMask, flagsValues, options);
|
||||
if (result == ActivityManager.START_CANCELED) {
|
||||
|
||||
@@ -926,7 +926,9 @@ class ContextImpl extends Context {
|
||||
resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
|
||||
}
|
||||
int result = ActivityManager.getService()
|
||||
.startActivityIntentSender(mMainThread.getApplicationThread(), intent,
|
||||
.startActivityIntentSender(mMainThread.getApplicationThread(),
|
||||
intent != null ? intent.getTarget() : null,
|
||||
intent != null ? intent.getWhitelistToken() : null,
|
||||
fillInIntent, resolvedType, null, null,
|
||||
0, flagsMask, flagsValues, options);
|
||||
if (result == ActivityManager.START_CANCELED) {
|
||||
|
||||
@@ -236,8 +236,8 @@ interface IActivityManager {
|
||||
Debug.MemoryInfo[] getProcessMemoryInfo(in int[] pids);
|
||||
void killApplicationProcess(in String processName, int uid);
|
||||
int startActivityIntentSender(in IApplicationThread caller,
|
||||
in IntentSender intent, in Intent fillInIntent, in String resolvedType,
|
||||
in IBinder resultTo, in String resultWho, int requestCode,
|
||||
in IIntentSender target, in IBinder whitelistToken, in Intent fillInIntent,
|
||||
in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode,
|
||||
int flagsMask, int flagsValues, in Bundle options);
|
||||
void overridePendingTransition(in IBinder token, in String packageName,
|
||||
int enterAnim, int exitAnim);
|
||||
|
||||
@@ -360,6 +360,11 @@ public class IntentSender implements Parcelable {
|
||||
return mTarget;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public IBinder getWhitelistToken() {
|
||||
return mWhitelistToken;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public IntentSender(IIntentSender target) {
|
||||
mTarget = target;
|
||||
|
||||
@@ -4587,9 +4587,9 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startActivityIntentSender(IApplicationThread caller, IntentSender intent,
|
||||
Intent fillInIntent, String resolvedType, IBinder resultTo, String resultWho,
|
||||
int requestCode, int flagsMask, int flagsValues, Bundle bOptions)
|
||||
public int startActivityIntentSender(IApplicationThread caller, IIntentSender target,
|
||||
IBinder whitelistToken, Intent fillInIntent, String resolvedType, IBinder resultTo,
|
||||
String resultWho, int requestCode, int flagsMask, int flagsValues, Bundle bOptions)
|
||||
throws TransactionTooLargeException {
|
||||
enforceNotIsolatedCaller("startActivityIntentSender");
|
||||
// Refuse possible leaked file descriptors
|
||||
@@ -4597,12 +4597,11 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
throw new IllegalArgumentException("File descriptors passed in Intent");
|
||||
}
|
||||
|
||||
IIntentSender sender = intent.getTarget();
|
||||
if (!(sender instanceof PendingIntentRecord)) {
|
||||
if (!(target instanceof PendingIntentRecord)) {
|
||||
throw new IllegalArgumentException("Bad PendingIntent object");
|
||||
}
|
||||
|
||||
PendingIntentRecord pir = (PendingIntentRecord)sender;
|
||||
PendingIntentRecord pir = (PendingIntentRecord)target;
|
||||
|
||||
synchronized (this) {
|
||||
// If this is coming from the currently resumed activity, it is
|
||||
@@ -4613,7 +4612,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
mAppSwitchesAllowedTime = 0;
|
||||
}
|
||||
}
|
||||
int ret = pir.sendInner(0, fillInIntent, resolvedType, null, null, null,
|
||||
int ret = pir.sendInner(0, fillInIntent, resolvedType, whitelistToken, null, null,
|
||||
resultTo, resultWho, requestCode, flagsMask, flagsValues, bOptions, null);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user