diff options
| author | 2023-12-13 02:47:08 +0000 | |
|---|---|---|
| committer | 2023-12-13 03:06:31 +0000 | |
| commit | f58dbdaa7388ad7158f595b053a33d7618ae2a18 (patch) | |
| tree | 974570783bf3f631e9ccf04d4bec6ec866534e1a | |
| parent | 91755c24d0d4f74a8a86a6614b2136c4eb42111c (diff) | |
Don't show "unified challenge" for profile with non-shareable credential
The terms "unified challenge" and "separate challenge" apply only in the
context of a profile whose credential is shareable with its parent. It
is possible for a profile's credential to not be shareable with its
parent. Update TrustManagerService's dump method to not show "profile
with unified challenge" for such profiles. To make this possible, also
add a new method LockPatternUtils#isProfileWithUnifiedChallenge().
Bug: 296464083
Test: dumpsys trust
Flag: exempt, just changes dumpsys
Change-Id: I52a5c68633b3be969863c10cd1740f700af9cc07
| -rw-r--r-- | core/java/com/android/internal/widget/LockPatternUtils.java | 15 | ||||
| -rw-r--r-- | services/core/java/com/android/server/trust/TrustManagerService.java | 14 |
2 files changed, 20 insertions, 9 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 28fd2b488426..bf8e6135fd01 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -897,13 +897,26 @@ public class LockPatternUtils { } /** - * Returns true if {@code userHandle} is a managed profile with separate challenge. + * Returns true if {@code userHandle} is a profile with separate challenge. + * <p> + * Returns false if {@code userHandle} is a profile with unified challenge, a profile whose + * credential is not shareable with its parent, or a non-profile user. */ public boolean isSeparateProfileChallengeEnabled(int userHandle) { return isCredentialSharableWithParent(userHandle) && hasSeparateChallenge(userHandle); } /** + * Returns true if {@code userHandle} is a profile with unified challenge. + * <p> + * Returns false if {@code userHandle} is a profile with separate challenge, a profile whose + * credential is not shareable with its parent, or a non-profile user. + */ + public boolean isProfileWithUnifiedChallenge(int userHandle) { + return isCredentialSharableWithParent(userHandle) && !hasSeparateChallenge(userHandle); + } + + /** * Returns true if {@code userHandle} is a managed profile with unified challenge. */ public boolean isManagedProfileWithUnifiedChallenge(int userHandle) { diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java index 327f74f081da..1ebad9bfbc8b 100644 --- a/services/core/java/com/android/server/trust/TrustManagerService.java +++ b/services/core/java/com/android/server/trust/TrustManagerService.java @@ -1657,14 +1657,12 @@ public class TrustManagerService extends SystemService { user.name, user.id, user.flags); if (!user.supportsSwitchToByUser()) { final boolean locked; - if (user.isProfile()) { - if (mLockPatternUtils.isSeparateProfileChallengeEnabled(user.id)) { - fout.print(" (profile with separate challenge)"); - locked = isDeviceLockedInner(user.id); - } else { - fout.print(" (profile with unified challenge)"); - locked = isDeviceLockedInner(resolveProfileParent(user.id)); - } + if (mLockPatternUtils.isProfileWithUnifiedChallenge(user.id)) { + fout.print(" (profile with unified challenge)"); + locked = isDeviceLockedInner(resolveProfileParent(user.id)); + } else if (mLockPatternUtils.isSeparateProfileChallengeEnabled(user.id)) { + fout.print(" (profile with separate challenge)"); + locked = isDeviceLockedInner(user.id); } else { fout.println(" (user that cannot be switched to)"); locked = isDeviceLockedInner(user.id); |