summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jigar Thakkar <jigarthakkar@google.com> 2024-04-10 14:14:05 +0000
committer Jigar Thakkar <jigarthakkar@google.com> 2024-04-10 15:48:28 +0000
commit443f8c42909a89cf269f664afca86d37df59d21a (patch)
treef9cdef68df3bc790ef290f964961c96cb91c853f
parentf27ffc65f25eb9acee4a0e5f8a273f763fb2b82e (diff)
Ignore storage lock events if user does not exist
Storage lock events are relayed whenever CE storage corresponding to a user is locked. If a user is removed immediately after locking the storage, the storage events may be processed by LockSettingsService after the user has been removed. With this change, we add a logic to catch the IllegalArgumentExceptions sent by UserManager.getUserProperties whenever it does not recognize the user id (or the user id has been removed), and ignores the storage lock event in such cases. Bug: 333615708 Test: atest CtsDevicePolicyTestCases Ignore-AOSP-First: This change fixes a bug caused by a change that was merged internally. Change-Id: I75d7192b42cce62327edadc52af5f47c4e045945
-rw-r--r--services/core/java/com/android/server/locksettings/LockSettingsService.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index 19562ef79fbb..dbdb155eb2e3 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -950,13 +950,18 @@ public class LockSettingsService extends ILockSettings.Stub {
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()) {
mHandler.post(() -> {
- UserProperties userProperties =
- mUserManager.getUserProperties(UserHandle.of(userId));
- if (userProperties != null
- && userProperties.getAllowStoppingUserWithDelayedLocking()) {
- int strongAuthRequired = LockPatternUtils.StrongAuthTracker
- .getDefaultFlags(mContext);
- requireStrongAuth(strongAuthRequired, userId);
+ try {
+ UserProperties userProperties =
+ mUserManager.getUserProperties(UserHandle.of(userId));
+ if (userProperties != null && userProperties
+ .getAllowStoppingUserWithDelayedLocking()) {
+ int strongAuthRequired = LockPatternUtils.StrongAuthTracker
+ .getDefaultFlags(mContext);
+ requireStrongAuth(strongAuthRequired, userId);
+ }
+ } catch (IllegalArgumentException e) {
+ Slogf.d(TAG, "User %d does not exist or has been removed",
+ userId);
}
});
}