Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8066a758 authored by Eric Biggers's avatar Eric Biggers
Browse files

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
parent b63430f2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment