Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8252fb11 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Automerger Merge Worker
Browse files

Merge "Send targeted broadcasts to prevent other apps from receiving them."...

Merge "Send targeted broadcasts to prevent other apps from receiving them." into qt-dev am: 0925f07c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15053176

Change-Id: I09a0140925f7c851ff64a131c5ad233161b91625
parents 50c77976 0925f07c
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -1349,7 +1349,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {


                builder.setSmallIcon(R.drawable.stat_notify_error);
                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(
                builder.setDeleteIntent(PendingIntent.getBroadcast(
                        mContext, 0, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT));
                        mContext, 0, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT));


@@ -1435,7 +1436,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {


                builder.setSmallIcon(R.drawable.stat_notify_error);
                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(
                builder.setDeleteIntent(PendingIntent.getBroadcast(
                        mContext, 0, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT));
                        mContext, 0, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT));


@@ -4936,17 +4938,19 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
        return new Intent(ACTION_ALLOW_BACKGROUND);
        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);
        final Intent intent = new Intent(ACTION_SNOOZE_WARNING);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        intent.putExtra(EXTRA_NETWORK_TEMPLATE, template);
        intent.putExtra(EXTRA_NETWORK_TEMPLATE, template);
        intent.setPackage(targetPackage);
        return intent;
        return intent;
    }
    }


    private static Intent buildSnoozeRapidIntent(NetworkTemplate template) {
    private static Intent buildSnoozeRapidIntent(NetworkTemplate template, String targetPackage) {
        final Intent intent = new Intent(ACTION_SNOOZE_RAPID);
        final Intent intent = new Intent(ACTION_SNOOZE_RAPID);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        intent.putExtra(EXTRA_NETWORK_TEMPLATE, template);
        intent.putExtra(EXTRA_NETWORK_TEMPLATE, template);
        intent.setPackage(targetPackage);
        return intent;
        return intent;
    }
    }