Biometric enrollment will not request a Gatekeeper HAT during initial credential setup or credential confirmation anymore. Instead, it is broken down into the following steps now. Bug: 161765592 1) Request credential setup / confirmation to return a Gatekeeper Password 2) Biometric enrollment will generate a challenge 3) Biometric enrollment will request LockSettingsService to verify(GatekeeperPassword, challenge), and upon verification, the Gatekeeper HAT will be returned. Since both LockSettingsService and Biometric enroll/settings make use of biometric challenges, this allows us to make the challenge ownership/lifecycle clear (vs. previously, where LockSettingsService has no idea who the challenge belongs to). Exempt-From-Owner-Approval:For files not owned by our team, (StorageWizard), this change is just a method rename Test: RunSettingsRoboTests Run the following on face/fingerprint devices Test: Remove credential adb shell am start -a android.app.action.SET_NEW_PASSWORD Set up credential + fingerprint Test: Remove credential, adb shell am start -a android.settings.FINGERPRINT_SETTINGS This tests the ChooseLock* logic in FingerprintSettings Test: Set up credential, adb shell am start -a android.settings.FINGERPRINT_SETTINGS This tests the ConfirmLock* logic in FingerprintSettings Test: Remove device credential, enroll fingerprint/face. Succeeds. This tests the ChooseLock* returning SP path from BiometricEnrollIntro Test: With credential and fingerprint/face enrolled, go to fingerprint/face settings and enroll. This tests the ConfirmLock* path in Fingerprint/FaceSettings Test: Remove device credential, enroll credential-only, enroll fingerprint/face separately. Succeeds. This tests the ConfirmLock* returning SP path in BiometricEnrollIntro Test: In SUW, set up credential, then biometric. This tests the ChooseLock* path in SUW Test: In SUW, set up credential, go back, then set up biometric. This tests the ConfirmLock* path in SUW Change-Id: Idf6fcb43f7497323d089eb9c37125294e7a7f5dc
59 lines
2.2 KiB
Java
59 lines
2.2 KiB
Java
/*
|
|
* Copyright (C) 2020 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.settings.biometrics;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
|
|
import com.android.internal.widget.LockPatternUtils;
|
|
import com.android.settings.password.ChooseLockSettingsHelper;
|
|
|
|
/**
|
|
* Common biometric utilities.
|
|
*/
|
|
public class BiometricUtils {
|
|
/**
|
|
* Given the result from confirming or choosing a credential, request Gatekeeper to generate
|
|
* a HardwareAuthToken with the Gatekeeper Password together with a biometric challenge.
|
|
*
|
|
* @param context Caller's context
|
|
* @param result The onActivityResult intent from ChooseLock* or ConfirmLock*
|
|
* @param userId User ID that the credential/biometric operation applies to
|
|
* @param challenge Unique biometric challenge from FingerprintManager/FaceManager
|
|
* @return
|
|
*/
|
|
public static byte[] requestGatekeeperHat(Context context, Intent result, int userId,
|
|
long challenge) {
|
|
final byte[] gkPassword = result.getByteArrayExtra(
|
|
ChooseLockSettingsHelper.EXTRA_KEY_GK_PW);
|
|
if (gkPassword == null) {
|
|
throw new IllegalStateException("Gatekeeper Password is null!!");
|
|
}
|
|
|
|
final LockPatternUtils utils = new LockPatternUtils(context);
|
|
return utils.verifyGatekeeperPassword(gkPassword, challenge, userId).getGatekeeperHAT();
|
|
}
|
|
|
|
public static boolean containsGatekeeperPassword(Intent data) {
|
|
if (data == null) {
|
|
return false;
|
|
}
|
|
return data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW) != null;
|
|
}
|
|
}
|