Merge "Send targeted broadcasts to prevent other apps from receiving them." into rvc-dev am: 9c8226caab
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15053177 Change-Id: Id4da32ee1585d2b747a7a0ab2188ba3304a17970
This commit is contained in:
@@ -1363,7 +1363,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
|
||||
builder.setSmallIcon(R.drawable.stat_notify_error);
|
||||
|
||||
final Intent snoozeIntent = buildSnoozeWarningIntent(policy.template);
|
||||
final Intent snoozeIntent = buildSnoozeWarningIntent(policy.template,
|
||||
mContext.getPackageName());
|
||||
builder.setDeleteIntent(PendingIntent.getBroadcast(
|
||||
mContext, 0, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
|
||||
@@ -1449,7 +1450,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
|
||||
builder.setSmallIcon(R.drawable.stat_notify_error);
|
||||
|
||||
final Intent snoozeIntent = buildSnoozeRapidIntent(policy.template);
|
||||
final Intent snoozeIntent = buildSnoozeRapidIntent(policy.template,
|
||||
mContext.getPackageName());
|
||||
builder.setDeleteIntent(PendingIntent.getBroadcast(
|
||||
mContext, 0, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
|
||||
@@ -5076,17 +5078,19 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
return new Intent(ACTION_ALLOW_BACKGROUND);
|
||||
}
|
||||
|
||||
private static Intent buildSnoozeWarningIntent(NetworkTemplate template) {
|
||||
private static Intent buildSnoozeWarningIntent(NetworkTemplate template, String targetPackage) {
|
||||
final Intent intent = new Intent(ACTION_SNOOZE_WARNING);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
intent.putExtra(EXTRA_NETWORK_TEMPLATE, template);
|
||||
intent.setPackage(targetPackage);
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static Intent buildSnoozeRapidIntent(NetworkTemplate template) {
|
||||
private static Intent buildSnoozeRapidIntent(NetworkTemplate template, String targetPackage) {
|
||||
final Intent intent = new Intent(ACTION_SNOOZE_RAPID);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
intent.putExtra(EXTRA_NETWORK_TEMPLATE, template);
|
||||
intent.setPackage(targetPackage);
|
||||
return intent;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user