Loading core/java/com/android/internal/widget/LockPatternUtils.java +35 −26 Original line number Diff line number Diff line Loading @@ -909,8 +909,9 @@ public class LockPatternUtils { */ public void setSeparateProfileChallengeEnabled(int userHandle, boolean enabled, String managedUserPassword) { UserInfo info = getUserManager().getUserInfo(userHandle); if (info.isManagedProfile()) { if (!isManagedProfile(userHandle)) { return; } try { getLockSettings().setSeparateProfileChallengeEnabled(userHandle, enabled, managedUserPassword); Loading @@ -919,34 +920,27 @@ public class LockPatternUtils { Log.e(TAG, "Couldn't update work profile challenge enabled"); } } } /** * Retrieves whether the Separate Profile Challenge is enabled for this {@param userHandle}. * Returns true if {@param userHandle} is a managed profile with separate challenge. */ public boolean isSeparateProfileChallengeEnabled(int userHandle) { UserInfo info = getUserManager().getUserInfo(userHandle); if (info == null || !info.isManagedProfile()) { return false; } try { return getLockSettings().getSeparateProfileChallengeEnabled(userHandle); } catch (RemoteException e) { Log.e(TAG, "Couldn't get separate profile challenge enabled"); // Default value is false return false; return isManagedProfile(userHandle) && hasSeparateChallenge(userHandle); } /** * Returns true if {@param userHandle} is a managed profile with unified challenge. */ public boolean isManagedProfileWithUnifiedChallenge(int userHandle) { return isManagedProfile(userHandle) && !hasSeparateChallenge(userHandle); } /** * Retrieves whether the current DPM allows use of the Profile Challenge. */ public boolean isSeparateProfileChallengeAllowed(int userHandle) { UserInfo info = getUserManager().getUserInfo(userHandle); if (info == null || !info.isManagedProfile()) { return false; } return getDevicePolicyManager().isSeparateProfileChallengeAllowed(userHandle); return isManagedProfile(userHandle) && getDevicePolicyManager().isSeparateProfileChallengeAllowed(userHandle); } /** Loading @@ -956,6 +950,21 @@ public class LockPatternUtils { return getDevicePolicyManager().isProfileActivePasswordSufficientForParent(userHandle); } private boolean hasSeparateChallenge(int userHandle) { try { return getLockSettings().getSeparateProfileChallengeEnabled(userHandle); } catch (RemoteException e) { Log.e(TAG, "Couldn't get separate profile challenge enabled"); // Default value is false return false; } } private boolean isManagedProfile(int userHandle) { final UserInfo info = getUserManager().getUserInfo(userHandle); return info != null && info.isManagedProfile(); } /** * Deserialize a pattern. * @param string The pattern serialized with {@link #patternToString} Loading services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java +3 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,9 @@ class LockSettingsShellCommand extends ShellCommand { result = mLockPatternUtils.checkPattern(stringToPattern(mOld), mCurrentUserId); } if (!result) { if (!mLockPatternUtils.isManagedProfileWithUnifiedChallenge(mCurrentUserId)) { mLockPatternUtils.reportFailedPasswordAttempt(mCurrentUserId); } getOutPrintWriter().println("Old password '" + mOld + "' didn't match"); } return result; Loading Loading
core/java/com/android/internal/widget/LockPatternUtils.java +35 −26 Original line number Diff line number Diff line Loading @@ -909,8 +909,9 @@ public class LockPatternUtils { */ public void setSeparateProfileChallengeEnabled(int userHandle, boolean enabled, String managedUserPassword) { UserInfo info = getUserManager().getUserInfo(userHandle); if (info.isManagedProfile()) { if (!isManagedProfile(userHandle)) { return; } try { getLockSettings().setSeparateProfileChallengeEnabled(userHandle, enabled, managedUserPassword); Loading @@ -919,34 +920,27 @@ public class LockPatternUtils { Log.e(TAG, "Couldn't update work profile challenge enabled"); } } } /** * Retrieves whether the Separate Profile Challenge is enabled for this {@param userHandle}. * Returns true if {@param userHandle} is a managed profile with separate challenge. */ public boolean isSeparateProfileChallengeEnabled(int userHandle) { UserInfo info = getUserManager().getUserInfo(userHandle); if (info == null || !info.isManagedProfile()) { return false; } try { return getLockSettings().getSeparateProfileChallengeEnabled(userHandle); } catch (RemoteException e) { Log.e(TAG, "Couldn't get separate profile challenge enabled"); // Default value is false return false; return isManagedProfile(userHandle) && hasSeparateChallenge(userHandle); } /** * Returns true if {@param userHandle} is a managed profile with unified challenge. */ public boolean isManagedProfileWithUnifiedChallenge(int userHandle) { return isManagedProfile(userHandle) && !hasSeparateChallenge(userHandle); } /** * Retrieves whether the current DPM allows use of the Profile Challenge. */ public boolean isSeparateProfileChallengeAllowed(int userHandle) { UserInfo info = getUserManager().getUserInfo(userHandle); if (info == null || !info.isManagedProfile()) { return false; } return getDevicePolicyManager().isSeparateProfileChallengeAllowed(userHandle); return isManagedProfile(userHandle) && getDevicePolicyManager().isSeparateProfileChallengeAllowed(userHandle); } /** Loading @@ -956,6 +950,21 @@ public class LockPatternUtils { return getDevicePolicyManager().isProfileActivePasswordSufficientForParent(userHandle); } private boolean hasSeparateChallenge(int userHandle) { try { return getLockSettings().getSeparateProfileChallengeEnabled(userHandle); } catch (RemoteException e) { Log.e(TAG, "Couldn't get separate profile challenge enabled"); // Default value is false return false; } } private boolean isManagedProfile(int userHandle) { final UserInfo info = getUserManager().getUserInfo(userHandle); return info != null && info.isManagedProfile(); } /** * Deserialize a pattern. * @param string The pattern serialized with {@link #patternToString} Loading
services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java +3 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,9 @@ class LockSettingsShellCommand extends ShellCommand { result = mLockPatternUtils.checkPattern(stringToPattern(mOld), mCurrentUserId); } if (!result) { if (!mLockPatternUtils.isManagedProfileWithUnifiedChallenge(mCurrentUserId)) { mLockPatternUtils.reportFailedPasswordAttempt(mCurrentUserId); } getOutPrintWriter().println("Old password '" + mOld + "' didn't match"); } return result; Loading