Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b021a27 authored by Eric Biggers's avatar Eric Biggers Committed by Gerrit Code Review
Browse files

Merge "Don't show "unified challenge" for profile with non-shareable credential" into main

parents f4c7c30b f58dbdaa
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -897,12 +897,25 @@ 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.
     */
+6 −8
Original line number Diff line number Diff line
@@ -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 {
                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);