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:
@@ -1394,9 +1394,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
private INetworkPolicyListener mPolicyListener = new INetworkPolicyListener.Stub() {
|
private INetworkPolicyListener mPolicyListener = new INetworkPolicyListener.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onUidRulesChanged(int uid, int uidRules) {
|
public void onUidRulesChanged(int uid, int uidRules) {
|
||||||
// only someone like NPMS should only be calling us
|
// caller is NPMS, since we only register with them
|
||||||
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
|
||||||
|
|
||||||
if (LOGD_RULES) {
|
if (LOGD_RULES) {
|
||||||
log("onUidRulesChanged(uid=" + uid + ", uidRules=" + uidRules + ")");
|
log("onUidRulesChanged(uid=" + uid + ", uidRules=" + uidRules + ")");
|
||||||
}
|
}
|
||||||
@@ -1415,9 +1413,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMeteredIfacesChanged(String[] meteredIfaces) {
|
public void onMeteredIfacesChanged(String[] meteredIfaces) {
|
||||||
// only someone like NPMS should only be calling us
|
// caller is NPMS, since we only register with them
|
||||||
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
|
||||||
|
|
||||||
if (LOGD_RULES) {
|
if (LOGD_RULES) {
|
||||||
log("onMeteredIfacesChanged(ifaces=" + Arrays.toString(meteredIfaces) + ")");
|
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