Loading api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -630,10 +630,10 @@ package android.app { method public android.content.Intent createConfirmFactoryResetCredentialIntent(CharSequence, CharSequence, CharSequence); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public int getMinLockLength(boolean, int); method @RequiresPermission(android.Manifest.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS) public boolean getPrivateNotificationsAllowed(); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public boolean isValidLockPasswordComplexity(int, @NonNull byte[], int); method @RequiresPermission(android.Manifest.permission.SHOW_KEYGUARD_MESSAGE) public void requestDismissKeyguard(@NonNull android.app.Activity, @Nullable CharSequence, @Nullable android.app.KeyguardManager.KeyguardDismissCallback); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public boolean setLock(int, @NonNull byte[], int); method @RequiresPermission(android.Manifest.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS) public void setPrivateNotificationsAllowed(boolean); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public boolean validateLockPasswordComplexity(boolean, @NonNull byte[], int); } public class Notification implements android.os.Parcelable { Loading core/java/android/app/KeyguardManager.java +15 −9 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager.PasswordComplexity; import android.app.admin.PasswordMetrics; import android.app.trust.ITrustManager; import android.compat.annotation.UnsupportedAppUsage; Loading Loading @@ -676,8 +677,9 @@ public class KeyguardManager { /** * Determine if a given password is valid based off its lock type and expected complexity level. * * @param isPin - whether this is a PIN-type password (only digits) * @param password - password to validate * @param lockType - type of lock as specified in {@link LockTypes} * @param password - password to validate; this has the same encoding * as the output of String#getBytes * @param complexity - complexity level imposed by the requester * as defined in {@code DevicePolicyManager.PasswordComplexity} * @return true if the password is valid, false otherwise Loading @@ -685,8 +687,8 @@ public class KeyguardManager { */ @RequiresPermission(Manifest.permission.SET_INITIAL_LOCK) @SystemApi public boolean validateLockPasswordComplexity( boolean isPin, @NonNull byte[] password, int complexity) { public boolean isValidLockPasswordComplexity(@LockTypes int lockType, @NonNull byte[] password, @PasswordComplexity int complexity) { if (!checkInitialLockMethodUsage()) { return false; } Loading @@ -696,9 +698,11 @@ public class KeyguardManager { (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE); PasswordMetrics adminMetrics = devicePolicyManager.getPasswordMinimumMetrics(mContext.getUserId()); // Check if the password fits the mold of a pin or pattern. boolean isPinOrPattern = lockType != LockTypes.PASSWORD; return PasswordMetrics.validatePassword( adminMetrics, complexity, isPin, password).size() == 0; adminMetrics, complexity, isPinOrPattern, password).size() == 0; } /** Loading @@ -712,7 +716,7 @@ public class KeyguardManager { */ @RequiresPermission(Manifest.permission.SET_INITIAL_LOCK) @SystemApi public int getMinLockLength(boolean isPin, int complexity) { public int getMinLockLength(boolean isPin, @PasswordComplexity int complexity) { if (!checkInitialLockMethodUsage()) { return -1; } Loading @@ -731,7 +735,8 @@ public class KeyguardManager { * Set the lockscreen password after validating against its expected complexity level. * * @param lockType - type of lock as specified in {@link LockTypes} * @param password - password to validate * @param password - password to validate; this has the same encoding * as the output of String#getBytes * @param complexity - complexity level imposed by the requester * as defined in {@code DevicePolicyManager.PasswordComplexity} * @return true if the lock is successfully set, false otherwise Loading @@ -739,7 +744,8 @@ public class KeyguardManager { */ @RequiresPermission(Manifest.permission.SET_INITIAL_LOCK) @SystemApi public boolean setLock(@LockTypes int lockType, @NonNull byte[] password, int complexity) { public boolean setLock(@LockTypes int lockType, @NonNull byte[] password, @PasswordComplexity int complexity) { if (!checkInitialLockMethodUsage()) { return false; } Loading @@ -750,7 +756,7 @@ public class KeyguardManager { Log.e(TAG, "Password already set, rejecting call to setLock"); return false; } if (!validateLockPasswordComplexity(lockType != LockTypes.PASSWORD, password, complexity)) { if (!isValidLockPasswordComplexity(lockType, password, complexity)) { Log.e(TAG, "Password is not valid, rejecting call to setLock"); return false; } Loading Loading
api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -630,10 +630,10 @@ package android.app { method public android.content.Intent createConfirmFactoryResetCredentialIntent(CharSequence, CharSequence, CharSequence); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public int getMinLockLength(boolean, int); method @RequiresPermission(android.Manifest.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS) public boolean getPrivateNotificationsAllowed(); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public boolean isValidLockPasswordComplexity(int, @NonNull byte[], int); method @RequiresPermission(android.Manifest.permission.SHOW_KEYGUARD_MESSAGE) public void requestDismissKeyguard(@NonNull android.app.Activity, @Nullable CharSequence, @Nullable android.app.KeyguardManager.KeyguardDismissCallback); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public boolean setLock(int, @NonNull byte[], int); method @RequiresPermission(android.Manifest.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS) public void setPrivateNotificationsAllowed(boolean); method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public boolean validateLockPasswordComplexity(boolean, @NonNull byte[], int); } public class Notification implements android.os.Parcelable { Loading
core/java/android/app/KeyguardManager.java +15 −9 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager.PasswordComplexity; import android.app.admin.PasswordMetrics; import android.app.trust.ITrustManager; import android.compat.annotation.UnsupportedAppUsage; Loading Loading @@ -676,8 +677,9 @@ public class KeyguardManager { /** * Determine if a given password is valid based off its lock type and expected complexity level. * * @param isPin - whether this is a PIN-type password (only digits) * @param password - password to validate * @param lockType - type of lock as specified in {@link LockTypes} * @param password - password to validate; this has the same encoding * as the output of String#getBytes * @param complexity - complexity level imposed by the requester * as defined in {@code DevicePolicyManager.PasswordComplexity} * @return true if the password is valid, false otherwise Loading @@ -685,8 +687,8 @@ public class KeyguardManager { */ @RequiresPermission(Manifest.permission.SET_INITIAL_LOCK) @SystemApi public boolean validateLockPasswordComplexity( boolean isPin, @NonNull byte[] password, int complexity) { public boolean isValidLockPasswordComplexity(@LockTypes int lockType, @NonNull byte[] password, @PasswordComplexity int complexity) { if (!checkInitialLockMethodUsage()) { return false; } Loading @@ -696,9 +698,11 @@ public class KeyguardManager { (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE); PasswordMetrics adminMetrics = devicePolicyManager.getPasswordMinimumMetrics(mContext.getUserId()); // Check if the password fits the mold of a pin or pattern. boolean isPinOrPattern = lockType != LockTypes.PASSWORD; return PasswordMetrics.validatePassword( adminMetrics, complexity, isPin, password).size() == 0; adminMetrics, complexity, isPinOrPattern, password).size() == 0; } /** Loading @@ -712,7 +716,7 @@ public class KeyguardManager { */ @RequiresPermission(Manifest.permission.SET_INITIAL_LOCK) @SystemApi public int getMinLockLength(boolean isPin, int complexity) { public int getMinLockLength(boolean isPin, @PasswordComplexity int complexity) { if (!checkInitialLockMethodUsage()) { return -1; } Loading @@ -731,7 +735,8 @@ public class KeyguardManager { * Set the lockscreen password after validating against its expected complexity level. * * @param lockType - type of lock as specified in {@link LockTypes} * @param password - password to validate * @param password - password to validate; this has the same encoding * as the output of String#getBytes * @param complexity - complexity level imposed by the requester * as defined in {@code DevicePolicyManager.PasswordComplexity} * @return true if the lock is successfully set, false otherwise Loading @@ -739,7 +744,8 @@ public class KeyguardManager { */ @RequiresPermission(Manifest.permission.SET_INITIAL_LOCK) @SystemApi public boolean setLock(@LockTypes int lockType, @NonNull byte[] password, int complexity) { public boolean setLock(@LockTypes int lockType, @NonNull byte[] password, @PasswordComplexity int complexity) { if (!checkInitialLockMethodUsage()) { return false; } Loading @@ -750,7 +756,7 @@ public class KeyguardManager { Log.e(TAG, "Password already set, rejecting call to setLock"); return false; } if (!validateLockPasswordComplexity(lockType != LockTypes.PASSWORD, password, complexity)) { if (!isValidLockPasswordComplexity(lockType, password, complexity)) { Log.e(TAG, "Password is not valid, rejecting call to setLock"); return false; } Loading