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

Commit 4ace8366 authored by Ricky Wai's avatar Ricky Wai Committed by Android (Google) Code Review
Browse files

Merge "Make "work mode on dialog" show personal challenge in unified work lock" into nyc-dev

parents 90edb46d 7881cf8f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1685,6 +1685,7 @@ public class UserManager {

    /**
     * Returns whether the given profile is in quiet mode or not.
     * Notes: Quiet mode is only supported for managed profiles.
     *
     * @param userHandle The user handle of the profile to be queried.
     * @return true if the profile is in quiet mode, false otherwise.
+4 −3
Original line number Diff line number Diff line
@@ -705,9 +705,9 @@ public class LockSettingsService extends ILockSettings.Stub {
            }
        };

        // Check if the user is currently in quiet mode and start it otherwise
        if (mUserManager.isQuietModeEnabled(new UserHandle(userId))
                && mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
        // Turn off quite mode if it's enabled, only managed profile can return true for now, it
        // will return false if it is not a managed profile.
        if (mUserManager.isQuietModeEnabled(new UserHandle(userId))) {
            mUserManager.setQuietModeEnabled(userId, false);
        }

@@ -729,6 +729,7 @@ public class LockSettingsService extends ILockSettings.Stub {
                    // Unlock managed profile with unified lock
                    if (pi.isManagedProfile()
                            && !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id)
                            && !pi.isQuietModeEnabled()
                            && mStorage.hasChildProfileLock(pi.id)) {
                        unlockChildProfile(pi.id);
                    }
+5 −2
Original line number Diff line number Diff line
@@ -691,9 +691,9 @@ public class UserManagerService extends IUserManager.Stub {

    @Override
    public boolean trySetQuietModeDisabled(int userHandle, IntentSender target) {
        final int credentialOwnerUserId = getCredentialOwnerProfile(userHandle);
        if (mContext.getSystemService(StorageManager.class).isUserKeyUnlocked(userHandle)
                || !mLockPatternUtils.isSecure(userHandle)
                || !mLockPatternUtils.isSeparateProfileChallengeEnabled(userHandle)) {
                || !mLockPatternUtils.isSecure(credentialOwnerUserId)) {
            // if the user is already unlocked, no need to show a profile challenge
            setQuietModeEnabled(userHandle, false);
            return true;
@@ -704,6 +704,9 @@ public class UserManagerService extends IUserManager.Stub {
            // otherwise, we show a profile challenge to trigger decryption of the user
            final KeyguardManager km = (KeyguardManager) mContext.getSystemService(
                    Context.KEYGUARD_SERVICE);
            // We should use userHandle not credentialOwnerUserId here, as even if it is unified
            // lock, confirm screenlock page will know and show personal challenge, and unlock
            // work profile when personal challenge is correct
            final Intent unlockIntent = km.createConfirmDeviceCredentialIntent(null, null,
                    userHandle);
            if (unlockIntent == null) {