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

Commit 3d79cd1b authored by Eric Biggers's avatar Eric Biggers
Browse files

Fix misleading code in sendCredentialsOnUnlockIfRequired()

lockScreenSecretAvailable() takes a @NonNull credential, so the code in
sendCredentialsOnUnlockIfRequired() that conditionally passes a null
credential is incorrect.  This doesn't actually matter, since
sendCredentialsOnUnlockIfRequired() is never called with
CREDENTIAL_TYPE_NONE anyway.  But make it do the more logical thing of
skipping the call to lockScreenSecretAvailable() in this case.

Test: atest com.android.server.locksettings
Change-Id: I026f72ccaadef94a2f43cb6c2a70e8c08d21360c
parent bbc8dbe9
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1588,6 +1588,11 @@ public class LockSettingsService extends ILockSettings.Stub {
            return;
        }

        // Don't send empty credentials on unlock.
        if (credential.isNone()) {
            return;
        }

        // A profile with a unified lock screen stores a randomly generated credential, so skip it.
        // Its parent will send credentials for the profile, as it stores the unified lock
        // credential.
@@ -1595,12 +1600,10 @@ public class LockSettingsService extends ILockSettings.Stub {
            return;
        }

        // RecoverableKeyStoreManager expects null for empty credential.
        final byte[] secret = credential.isNone() ? null : credential.getCredential();
        // Send credentials for the user and any child profiles that share its lock screen.
        for (int profileId : getProfilesWithSameLockScreen(userId)) {
            mRecoverableKeyStoreManager.lockScreenSecretAvailable(
                    credential.getType(), secret, profileId);
                    credential.getType(), credential.getCredential(), profileId);
        }
    }