Simplify password length constraints checking

Currently minimum password length policy is queried twice:
1. When constructiong the intent in
   ChooseLockGenericFragment.getIntentForUnlockMethod and then
   passed into setPasswordLengthRange in getLockPasswordIntent
2. in ChooseLockPasswordFragment.processPasswordRequirements via
   LockPatternUtils.getRequestedMinimumPasswordLength().

These two values are then combined in processPasswordRequirements
using Math.max(), which doesn't make sense since it is the same
value.
With this CL it is only queried once in processPasswordRequirements.

+ cleaned up code filling in unused list.
+ removed unused extras, since they are never set anywhere.

Bug: 30558331
Test: atest ChooseLockPasswordTest
Test: atest SetupChooseLockPasswordTest
Test: atest ChooseLockGenericTest
Test: manual, set password policy and change password.

Change-Id: Ifc4946d5b3b26131da01178fa9c827de7a52c7c6
This commit is contained in:
Pavel Grafov
2018-05-04 17:09:28 +01:00
parent 127777b6e7
commit 5f139101e2
4 changed files with 14 additions and 89 deletions

View File

@@ -170,9 +170,9 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
}
@Override
protected Intent getLockPasswordIntent(int quality, int minLength, int maxLength) {
protected Intent getLockPasswordIntent(int quality) {
final Intent intent = SetupChooseLockPassword.modifyIntentForSetup(
getContext(), super.getLockPasswordIntent(quality, minLength, maxLength));
getContext(), super.getLockPasswordIntent(quality));
SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
return intent;
}