Fix race condition in MetricsLoggerService

Bug: 28204408
Change-Id: I7e0577d2161f6083ae84ab29db24f23415d145be
This commit is contained in:
Pavel Zhamaitsiak
2016-05-03 09:18:00 -07:00
parent beb3d2990b
commit e8fc84b449

View File

@@ -106,11 +106,13 @@ public class MetricsLoggerService extends SystemService {
}
private void resetThrottlingCounters(long currentTimeMillis) {
for (int i = 0; i < mThrottlingCounters.length; i++) {
mThrottlingCounters[i] = 0;
synchronized (mThrottlingCounters) {
for (int i = 0; i < mThrottlingCounters.length; i++) {
mThrottlingCounters[i] = 0;
}
mThrottlingIntervalBoundaryMillis =
currentTimeMillis + THROTTLING_TIME_INTERVAL_MILLIS;
}
mThrottlingIntervalBoundaryMillis =
currentTimeMillis + THROTTLING_TIME_INTERVAL_MILLIS;
}
private void addEvent(ConnectivityMetricsEvent e) {