Merge "Add synchronized block when accessing global variables" into main

This commit is contained in:
Junyu Lai
2023-10-20 06:06:37 +00:00
committed by Gerrit Code Review

View File

@@ -517,11 +517,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
break;
}
case MSG_NOTIFY_NETWORK_STATUS: {
synchronized (mStatsLock) {
// If no cached states, ignore.
if (mLastNetworkStateSnapshots == null) break;
// TODO (b/181642673): Protect mDefaultNetworks from concurrent accessing.
handleNotifyNetworkStatus(
mDefaultNetworks, mLastNetworkStateSnapshots, mActiveIface);
}
break;
}
case MSG_PERFORM_POLL_REGISTER_ALERT: {