summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
diff options
context:
space:
mode:
authorRubin Xu <rubinxu@google.com>2019-09-06 20:11:48 +0100
committerRubin Xu <rubinxu@google.com>2019-10-08 17:29:47 +0100
commita58125d2a4114b8e40f82ca7c300a75144bdcdb4 (patch)
treeeb8f733f02a1633a4dc3008901371a3f65da4513 /packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
parent712d0f7dcf7a7e362e9dba10386ba8b9070e6efb (diff)
Introduce LockscreenCredential
* Wrap credential bytes and type into one single object. * Update all external APIs dealing with lockscreen passoword to use the LockscreenCredential class. Remove existing variants that handles pin/password/pattern separately. * Coerce password quality passed to LockSettingsService into one of UNSPECIFIED, PATTERN, NUMERIC or ALPHABETIC (explained below). * Update all clients & tests to interface with LockscreenCredential. Note: LockscreenCredential distinguishes between PIN and password in its public interfaces, this is to pave the way for the next patch of formally introducing a CREDENTIAL_TYPE_PIN type and getting rid of the requestedQuality being passed along (whose sole purpose nowadays is to distinguish between PIN and password) For now LockscreenCredential still uses the quality value internally to make that distinction. This does result in a change to what quality values LockSettingsService receives as part of credential change: after this CL LSS will only see the quality being one of UNSPECIFIED, PATTERN, NUMERIC or ALPHABETIC, while it used to receive other qualities (NUMERIC_COMPLEX, ALPHANUMERIC etc) if device admin sets a password policy. This shouldn't make any behaviour changes though, because the new range of values is still sufficient to distinguish between PIN/Pattern/Password, which is what the consumers of the stored quality care about. Bug: 65239740 Test: atest com.android.server.locksettings Test: atest com.android.server.devicepolicy.DevicePolicyManagerTest Test: atest com.android.internal.widget.LockPatternUtilsTest Test: atest com.android.internal.widget.LockscreenCredentialTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.password Test: atest MixedManagedProfileOwnerTest#testResetPasswordWithToken Test: atest MixedDeviceOwnerTest#testResetPasswordWithToken Test: manually set an PIN/Pattern/Password; then change to PIN/Pattern/Password; finally remove password Test: manually create a work profile; try unify and ununify work challenge. Test: manually test lockscreen FRP flow (change password via Settings / DPC) Change-Id: I04cc04057c96292a7b1b672bff2a09d594ea9b3c
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java18
1 files changed, 2 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
index 274f739d8c29..8e9df5563123 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
@@ -167,8 +167,8 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
}
@Override
- protected byte[] getPasswordText() {
- return charSequenceToByteArray(mPasswordEntry.getText());
+ protected CharSequence getPasswordText() {
+ return mPasswordEntry.getText();
}
@Override
@@ -266,18 +266,4 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
return getContext().getString(
com.android.internal.R.string.keyguard_accessibility_pin_unlock);
}
-
- /*
- * This method avoids creating a new string when getting a byte array from EditView#getText().
- */
- private static byte[] charSequenceToByteArray(CharSequence chars) {
- if (chars == null) {
- return null;
- }
- byte[] bytes = new byte[chars.length()];
- for (int i = 0; i < chars.length(); i++) {
- bytes[i] = (byte) chars.charAt(i);
- }
- return bytes;
- }
}