Skip to content

Commit ca90d6d

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Avoid updating thresholds during shutdown." into jb-dev
2 parents 421dceb + 20f5c3d commit ca90d6d

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)