Merge "Disable PendingIntent background activity launch" into tm-dev
This commit is contained in:
commit
05494c71f8
1 changed files with 9 additions and 1 deletions
|
|
@ -8349,7 +8349,15 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
mPendingIntentWakeLock.acquire();
|
||||
try {
|
||||
if (DBG) log("Sending " + pendingIntent);
|
||||
pendingIntent.send(mContext, 0, intent, this /* onFinished */, null /* Handler */);
|
||||
final BroadcastOptions options = BroadcastOptions.makeBasic();
|
||||
if (SdkLevel.isAtLeastT()) {
|
||||
// Explicitly disallow the receiver from starting activities, to prevent apps from
|
||||
// utilizing the PendingIntent as a backdoor to do this.
|
||||
options.setPendingIntentBackgroundActivityLaunchAllowed(false);
|
||||
}
|
||||
pendingIntent.send(mContext, 0, intent, this /* onFinished */, null /* Handler */,
|
||||
null /* requiredPermission */,
|
||||
SdkLevel.isAtLeastT() ? options.toBundle() : null);
|
||||
} catch (PendingIntent.CanceledException e) {
|
||||
if (DBG) log(pendingIntent + " was not sent, it had been canceled.");
|
||||
mPendingIntentWakeLock.release();
|
||||
|
|
|
|||
Loading…
Reference in a new issue