From 53ba8ca01cd465789a4eaaeb24a9813ec5dd5cd8 Mon Sep 17 00:00:00 2001 From: Varun Shah Date: Thu, 7 Oct 2021 22:16:18 +0000 Subject: [PATCH] Update mUserUnlockedStates locking and docs. Bug: n/a Change-Id: If210e0012ebc838183c3ca6b82ded9aae21f62b2 Test: atest UsageStatsTest --- .../java/com/android/server/usage/UsageStatsService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index cf4ef58696538..f0ceff15c763b 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -381,8 +381,8 @@ public class UsageStatsService extends SystemService implements UsageStatsIdleService.scheduleUpdateMappingsJob(getContext()); } synchronized (mLock) { - // This should be safe to add this early. Other than reportEventOrAddToQueue, every - // other user grabs the lock before accessing + // This should be safe to add this early. Other than reportEventOrAddToQueue and + // getBackupPayload, every other user grabs the lock before accessing // mUserUnlockedStates. reportEventOrAddToQueue does not depend on anything other than // mUserUnlockedStates, and the lock will protect the handler. mUserUnlockedStates.add(userId); @@ -1438,8 +1438,8 @@ public class UsageStatsService extends SystemService implements } } else if ("mappings".equals(arg)) { final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); - final int userId = parseUserIdFromArgs(args, i, ipw); synchronized (mLock) { + final int userId = parseUserIdFromArgs(args, i, ipw); if (userId != UserHandle.USER_NULL) { mUserState.get(userId).dumpMappings(ipw); }