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
This commit is contained in:
Lee Shombert
2020-05-27 13:46:46 -07:00
parent d53625f660
commit 5473e17736
2 changed files with 2 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);