Ack, wrap advisePersistThreshold() in lock.
Bug: 6449725
Change-Id: I702dc2ff9d4b237c46d89bcae41289bc3e9ef2f8
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index a9d4b59..1a56b80 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -616,10 +616,12 @@
// persist if beyond new thresholds
final long currentTime = mTime.hasCache() ? mTime.currentTimeMillis()
: System.currentTimeMillis();
- mDevRecorder.maybePersistLocked(currentTime);
- mXtRecorder.maybePersistLocked(currentTime);
- mUidRecorder.maybePersistLocked(currentTime);
- mUidTagRecorder.maybePersistLocked(currentTime);
+ synchronized (mStatsLock) {
+ mDevRecorder.maybePersistLocked(currentTime);
+ mXtRecorder.maybePersistLocked(currentTime);
+ mUidRecorder.maybePersistLocked(currentTime);
+ mUidTagRecorder.maybePersistLocked(currentTime);
+ }
// re-arm global alert
registerGlobalAlert();