Allow LockscreenCredential to represent any proposed credential
Currently the ChooseLockPassword activity in Settings creates a LockscreenCredential object for the text the user has entered, every time a character is added or deleted to/from the text view. It then uses this LockscreenCredential to validate that requirements such as minimum length have been met. Thus, LockscreenCredential is expected to be able to represent any proposed credential, even an invalid one. Yet, currently the constructor of LockscreenCredential throws an exception if the length is 0 and the credential type is not NONE. For the empty text case, ChooseLockPassword currently works around this by constructing a LockscreenCredential of type NONE and then actually treating it as a PIN or PASSWORD when validating it. To make it possible to fix the bug where invalid characters are being allowed in passwords, I'm adding a new validation method that operates on LockscreenCredential. For ChooseLockPassword to be converted to this, though, it needs to start constructing a LockscreenCredential with the correct type for the proposed credential. Therefore, this CL allows non-none LockscreenCredential objects to be constructed with length 0. Bug: 219511761 Bug: 232900169 Bug: 243881358 Test: atest LockscreenCredentialTest Test: atest com.android.server.locksettings Change-Id: I6b951759aa7fabacc46c20bbfd31d3a0dafa4c1c
Loading
Please register or sign in to comment