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

Commit a5f08d34 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clear Gatekeeper state before a new enrollment" into oc-dev

parents 5a421ad0 6b59ccc9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -346,11 +346,14 @@ public class SyntheticPasswordManager {
        PasswordData pwd = PasswordData.create(credentialType);
        byte[] pwdToken = computePasswordToken(credential, pwd);

        // In case GK enrollment leaves persistent state around (in RPMB), this will nuke them
        // to prevent them from accumulating and causing problems.
        gatekeeper.clearSecureUserId(fakeUid(userId));
        GateKeeperResponse response = gatekeeper.enroll(fakeUid(userId), null, null,
                passwordTokenToGkInput(pwdToken));
        if (response.getResponseCode() != GateKeeperResponse.RESPONSE_OK) {
            Log.e(TAG, "Fail to enroll user password when creating SP for user " + userId);
            return 0;
            return DEFAULT_HANDLE;
        }
        pwd.passwordHandle = response.getPayload();
        long sid = sidFromPasswordHandle(pwd.passwordHandle);