Normalize empty credential into null

Test: runtest frameworks-services -c com.android.server.LockSettingsServiceTests
Bug: 31000522
Change-Id: I2f804a5790449f0d2d4d57fe6e34be03a84fb805
This commit is contained in:
Rubin Xu
2017-02-16 16:49:43 +00:00
parent e0da063b8d
commit df406d802e

View File

@@ -1064,6 +1064,14 @@ public class LockSettingsService extends ILockSettings.Stub {
private void setLockCredentialInternal(String credential, int credentialType,
String savedCredential, int userId) throws RemoteException {
// Normalize savedCredential and credential such that empty string is always represented
// as null.
if (TextUtils.isEmpty(savedCredential)) {
savedCredential = null;
}
if (TextUtils.isEmpty(credential)) {
credential = null;
}
synchronized (mSpManager) {
if (isSyntheticPasswordBasedCredentialLocked(userId)) {
spBasedSetLockCredentialInternalLocked(credential, credentialType, savedCredential,