Send broadcast when changing restrict background. am: b1b6ccd157
Original change: undetermined Change-Id: I811cfe65d6e58a9f411ae09223a69c00952933df
This commit is contained in:
@@ -1394,9 +1394,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
||||
private INetworkPolicyListener mPolicyListener = new INetworkPolicyListener.Stub() {
|
||||
@Override
|
||||
public void onUidRulesChanged(int uid, int uidRules) {
|
||||
// only someone like NPMS should only be calling us
|
||||
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
||||
|
||||
// caller is NPMS, since we only register with them
|
||||
if (LOGD_RULES) {
|
||||
log("onUidRulesChanged(uid=" + uid + ", uidRules=" + uidRules + ")");
|
||||
}
|
||||
@@ -1415,9 +1413,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
||||
|
||||
@Override
|
||||
public void onMeteredIfacesChanged(String[] meteredIfaces) {
|
||||
// only someone like NPMS should only be calling us
|
||||
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
||||
|
||||
// caller is NPMS, since we only register with them
|
||||
if (LOGD_RULES) {
|
||||
log("onMeteredIfacesChanged(ifaces=" + Arrays.toString(meteredIfaces) + ")");
|
||||
}
|
||||
@@ -1429,6 +1425,27 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestrictBackgroundChanged(boolean restrictBackground) {
|
||||
// caller is NPMS, since we only register with them
|
||||
if (LOGD_RULES) {
|
||||
log("onRestrictBackgroundChanged(restrictBackground=" + restrictBackground + ")");
|
||||
}
|
||||
|
||||
// kick off connectivity change broadcast for active network, since
|
||||
// global background policy change is radical.
|
||||
final int networkType = mActiveDefaultNetwork;
|
||||
if (isNetworkTypeValid(networkType)) {
|
||||
final NetworkStateTracker tracker = mNetTrackers[networkType];
|
||||
if (tracker != null) {
|
||||
final NetworkInfo info = tracker.getNetworkInfo();
|
||||
if (info != null && info.isConnected()) {
|
||||
sendConnectedBroadcast(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user