Merge "Disable policy when bandwidth module missing." into jb-dev
This commit is contained in:
@@ -319,6 +319,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
}
|
||||
|
||||
public void systemReady() {
|
||||
if (!isBandwidthControlEnabled()) {
|
||||
Slog.w(TAG, "bandwidth controls disabled, unable to enforce policy");
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (mRulesLock) {
|
||||
// read policy from disk
|
||||
readPolicyLocked();
|
||||
@@ -1917,6 +1922,18 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBandwidthControlEnabled() {
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
return mNetworkManager.isBandwidthControlEnabled();
|
||||
} catch (RemoteException e) {
|
||||
// ignored; service lives in system_server
|
||||
return false;
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try refreshing {@link #mTime} when stale.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user