summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/net
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-03-06 19:59:57 -0800
committerJeff Sharkey <jsharkey@android.com>2012-03-06 19:59:57 -0800
commit6341fcecc8826924a4bb24169aaf80fec9a20894 (patch)
tree982eaad71633447618cd0dda4562498d1f8ceb2a /services/java/com/android/server/net
parent09c8f48c105c4ed299617aaa892c7f0cd891b144 (diff)
downloadframeworks_base-6341fcecc8826924a4bb24169aaf80fec9a20894.zip
frameworks_base-6341fcecc8826924a4bb24169aaf80fec9a20894.tar.gz
frameworks_base-6341fcecc8826924a4bb24169aaf80fec9a20894.tar.bz2
Avoid updating network stats after shutdown.
Bug: 6109476 Change-Id: I9a3a8b182c8fa56d83ddc755d204d5b267c9bc5d
Diffstat (limited to 'services/java/com/android/server/net')
-rw-r--r--services/java/com/android/server/net/NetworkStatsService.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index 13c0640..fd8d411 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -212,6 +212,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
private final HandlerThread mHandlerThread;
private final Handler mHandler;
+ private boolean mSystemReady;
+
public NetworkStatsService(
Context context, INetworkManagementService networkManager, IAlarmManager alarmManager) {
this(context, networkManager, alarmManager, NtpTrustedTime.getInstance(context),
@@ -250,6 +252,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
}
public void systemReady() {
+ mSystemReady = true;
+
if (!isBandwidthControlEnabled()) {
Slog.w(TAG, "bandwidth controls disabled, unable to track stats");
return;
@@ -336,6 +340,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
mUidTagRecorder = null;
mDevStatsCached = null;
+
+ mSystemReady = false;
}
private void maybeUpgradeLegacyStatsLocked() {
@@ -649,6 +655,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
* {@link NetworkIdentitySet}.
*/
private void updateIfacesLocked() {
+ if (!mSystemReady) return;
if (LOGV) Slog.v(TAG, "updateIfacesLocked()");
// take one last stats snapshot before updating iface mapping. this
@@ -737,7 +744,9 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
* {@link NetworkStatsHistory}.
*/
private void performPollLocked(int flags) {
+ if (!mSystemReady) return;
if (LOGV) Slog.v(TAG, "performPollLocked(flags=0x" + Integer.toHexString(flags) + ")");
+
final long startRealtime = SystemClock.elapsedRealtime();
final boolean persistNetwork = (flags & FLAG_PERSIST_NETWORK) != 0;