Skip to content

Commit 20f5c3d

Browse files
committed
Avoid updating thresholds during shutdown.
Bug: 6472388 Change-Id: I70e1ed5dc75056840f2f0b130ce0dfecb06f385e
1 parent 6de357e commit 20f5c3d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

services/java/com/android/server/net/NetworkStatsService.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,17 +608,19 @@ public void advisePersistThreshold(long thresholdBytes) {
608608

609609
// clamp threshold into safe range
610610
mPersistThreshold = MathUtils.constrain(thresholdBytes, 128 * KB_IN_BYTES, 2 * MB_IN_BYTES);
611-
updatePersistThresholds();
612-
613611
if (LOGV) {
614612
Slog.v(TAG, "advisePersistThreshold() given " + thresholdBytes + ", clamped to "
615613
+ mPersistThreshold);
616614
}
617615

618-
// persist if beyond new thresholds
616+
// update and persist if beyond new thresholds
619617
final long currentTime = mTime.hasCache() ? mTime.currentTimeMillis()
620618
: System.currentTimeMillis();
621619
synchronized (mStatsLock) {
620+
if (!mSystemReady) return;
621+
622+
updatePersistThresholds();
623+
622624
mDevRecorder.maybePersistLocked(currentTime);
623625
mXtRecorder.maybePersistLocked(currentTime);
624626
mUidRecorder.maybePersistLocked(currentTime);

0 commit comments

Comments
 (0)