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

Commit df406d80 authored by Rubin Xu's avatar Rubin Xu
Browse files

Normalize empty credential into null

Test: runtest frameworks-services -c com.android.server.LockSettingsServiceTests
Bug: 31000522
Change-Id: I2f804a5790449f0d2d4d57fe6e34be03a84fb805
parent e0da063b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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,