OSDN Git Service

Simplify password length constraints checking
authorPavel Grafov <pgrafov@google.com>
Fri, 4 May 2018 16:09:28 +0000 (17:09 +0100)
committerPavel Grafov <pgrafov@google.com>
Mon, 14 May 2018 11:09:15 +0000 (12:09 +0100)
commit5f139101e28ef975ef1e1a4a9193d5eb7392bc92
tree65f7ce328e8626c25cf0823929444b44479995b8
parent127777b6e776015e45466046b79f31ed4c240c6c
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
src/com/android/settings/password/ChooseLockGeneric.java
src/com/android/settings/password/ChooseLockPassword.java
src/com/android/settings/password/SetupChooseLockGeneric.java
tests/robotests/src/com/android/settings/password/ChooseLockPasswordTest.java