Send broadcast when changing restrict background.
When changing global restrict background status, send connectivity change broadcast, since it radically changes DISCONNECTED/BLOCKED status system-wide. Also reduce verbose stats logging. Bug: 5854466 Change-Id: I3b612c520f50cc3000a3a569b7e0ab5f691cc2bd
This commit is contained in:
parent
b3a842ef9c
commit
b1b6ccd157
1 changed files with 23 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue