Remove unused receiver and corresponding code from NPMS

While adding flags to registerReceiver calls for receivers that are
registered for unprotected broadcasts, this receiver was discovered
that is not currently in use. This commit removes the receiver
registration and all unused code for the receiver.

Bug: 161145287
Test: Build
Change-Id: Ifdf56cea108e12b40333fb4de9f0d28e0e260791
This commit is contained in:
Michael Groover
2021-10-05 19:35:37 -07:00
parent 4e67e63bc8
commit 4e23083b4a

View File

@@ -408,8 +408,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private static final String ATTR_NETWORK_TYPES = "networkTypes";
private static final String ATTR_XML_UTILS_NAME = "name";
private static final String ACTION_ALLOW_BACKGROUND =
"com.android.server.net.action.ALLOW_BACKGROUND";
private static final String ACTION_SNOOZE_WARNING =
"com.android.server.net.action.SNOOZE_WARNING";
private static final String ACTION_SNOOZE_RAPID =
@@ -974,11 +972,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
mContext.registerReceiver(
mStatsReceiver, statsFilter, READ_NETWORK_USAGE_HISTORY, mHandler);
// listen for restrict background changes from notifications
final IntentFilter allowFilter = new IntentFilter(ACTION_ALLOW_BACKGROUND);
mContext.registerReceiver(mAllowReceiver, allowFilter, MANAGE_NETWORK_POLICY, mHandler,
Context.RECEIVER_EXPORTED);
// Listen for snooze from notifications
mContext.registerReceiver(mSnoozeReceiver,
new IntentFilter(ACTION_SNOOZE_WARNING), MANAGE_NETWORK_POLICY, mHandler);
@@ -1195,20 +1188,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
};
/**
* Receiver that watches for {@link Notification} control of
* {@link #mRestrictBackground}.
*/
final private BroadcastReceiver mAllowReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// on background handler thread, and verified MANAGE_NETWORK_POLICY
// permission above.
setRestrictBackground(false);
}
};
/**
* Receiver that watches for {@link Notification} control of
* {@link NetworkPolicy#lastWarningSnooze}.
@@ -5522,10 +5501,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
}
private static Intent buildAllowBackgroundDataIntent() {
return new Intent(ACTION_ALLOW_BACKGROUND);
}
private static Intent buildSnoozeWarningIntent(NetworkTemplate template, String targetPackage) {
final Intent intent = new Intent(ACTION_SNOOZE_WARNING);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);