Avoid reading network stats when disabled.
Bug: 5518868 Change-Id: Idb5c588b018bf735597ad7ff904ecc69224dd0a0
This commit is contained in:
@@ -268,6 +268,11 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void systemReady() {
|
public void systemReady() {
|
||||||
|
if (!isBandwidthControlEnabled()) {
|
||||||
|
Slog.w(TAG, "bandwidth controls disabled, unable to track stats");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (mStatsLock) {
|
synchronized (mStatsLock) {
|
||||||
// read historical network stats from disk, since policy service
|
// read historical network stats from disk, since policy service
|
||||||
// might need them right away. we delay loading detailed UID stats
|
// might need them right away. we delay loading detailed UID stats
|
||||||
@@ -1644,6 +1649,15 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
return telephony.getSubscriberId();
|
return telephony.getSubscriberId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isBandwidthControlEnabled() {
|
||||||
|
try {
|
||||||
|
return mNetworkManager.isBandwidthControlEnabled();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// ignored; service lives in system_server
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key uniquely identifying a {@link NetworkStatsHistory} for a UID.
|
* Key uniquely identifying a {@link NetworkStatsHistory} for a UID.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user