From 5473e177368153ff172e248decc84599d3e57270 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Wed, 27 May 2020 13:46:46 -0700 Subject: [PATCH] Binder cache for isUserUnlocked update Bug: 154434809 This change ensures that the isUserUnlocked binder cache will be invalidated when a new UserManagerService or StorageManagerService is created. Note that the bug cannot be reproduced at will so it is not known if this change actually fixes the bug (which has multiple potential root causes). However, by inspection, this change is desirable. Test: Run tests with an instrumented build. No cache inconsistencies were found: * UserManagerServiceCreateProfileTest * UserSystemPackageInstallerTest * UserManagerServiceUserInfoTest * UserManagerServiceIdRecyclingTest * PtsChreTestCases * UserLifecycleTests Change-Id: Ibc1204ccc1458028d94f2a64cbdc8ec1234b1ef3 --- services/core/java/com/android/server/StorageManagerService.java | 1 + services/core/java/com/android/server/pm/UserManagerService.java | 1 + 2 files changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index b3e28cb946a90..b5aec8e401eb4 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -376,6 +376,7 @@ class StorageManagerService extends IStorageManager.Stub private class WatchedLockedUsers { private int[] users = EmptyArray.INT; public WatchedLockedUsers() { + invalidateIsUserUnlockedCache(); } public void append(int userId) { users = ArrayUtils.appendInt(users, userId); diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index b0e3ecb6d17b2..d5c9424528bdc 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -491,6 +491,7 @@ public class UserManagerService extends IUserManager.Stub { final SparseIntArray states; public WatchedUserStates() { states = new SparseIntArray(); + invalidateIsUserUnlockedCache(); } public int get(int userId) { return states.get(userId);