Test: Verified that Unicorn SUW flows can now enroll a face. Test: Verified normal SUW flow works as expected. Fixes: 237088482 Fixes: 234663447 Change-Id: I9c4100f61b5e7d40fc9ed67c6918ec7bf31fc30a
148 lines
4.8 KiB
Java
148 lines
4.8 KiB
Java
/*
|
|
* Copyright (C) 2021 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.face;
|
|
|
|
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
|
|
|
import android.app.settings.SettingsEnums;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.StringRes;
|
|
|
|
import com.android.settings.R;
|
|
|
|
/**
|
|
* Displays parental consent information for face authentication.
|
|
*/
|
|
public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
|
|
|
|
/**
|
|
* List of string resources to log when recording the result of this activity in gms.
|
|
* This must be updated when any strings are added/removed.
|
|
*/
|
|
public static final int[] CONSENT_STRING_RESOURCES = new int[] {
|
|
R.string.security_settings_face_enroll_consent_introduction_title,
|
|
R.string.security_settings_face_enroll_introduction_consent_message,
|
|
R.string.security_settings_face_enroll_introduction_info_consent_glasses,
|
|
R.string.security_settings_face_enroll_introduction_info_consent_looking,
|
|
R.string.security_settings_face_enroll_introduction_info_consent_gaze,
|
|
R.string.security_settings_face_enroll_introduction_how_consent_message,
|
|
R.string.security_settings_face_enroll_introduction_control_consent_title,
|
|
R.string.security_settings_face_enroll_introduction_control_consent_message,
|
|
R.string.security_settings_face_enroll_introduction_consent_message_0,
|
|
R.string.security_settings_face_enroll_introduction_info_consent_less_secure
|
|
};
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setDescriptionText(R.string.security_settings_face_enroll_introduction_consent_message_0);
|
|
}
|
|
|
|
@Override
|
|
protected void onNextButtonClick(View view) {
|
|
onConsentResult(true /* granted */);
|
|
}
|
|
|
|
@Override
|
|
protected void onSkipButtonClick(View view) {
|
|
onConsentResult(false /* granted */);
|
|
}
|
|
|
|
@Override
|
|
protected void onEnrollmentSkipped(@Nullable Intent data) {
|
|
onConsentResult(false /* granted */);
|
|
}
|
|
|
|
@Override
|
|
protected void onFinishedEnrolling(@Nullable Intent data) {
|
|
onConsentResult(true /* granted */);
|
|
}
|
|
|
|
private void onConsentResult(boolean granted) {
|
|
final Intent result = new Intent();
|
|
result.putExtra(EXTRA_KEY_MODALITY, TYPE_FACE);
|
|
setResult(granted ? RESULT_CONSENT_GRANTED : RESULT_CONSENT_DENIED, result);
|
|
finish();
|
|
}
|
|
|
|
@Override
|
|
protected boolean onSetOrConfirmCredentials(@Nullable Intent data) {
|
|
// prevent challenge from being generated by default
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
protected boolean generateChallengeOnCreate() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
@StringRes
|
|
protected int getInfoMessageGlasses() {
|
|
return R.string.security_settings_face_enroll_introduction_info_consent_glasses;
|
|
}
|
|
|
|
@Override
|
|
@StringRes
|
|
protected int getInfoMessageLooking() {
|
|
return R.string.security_settings_face_enroll_introduction_info_consent_looking;
|
|
}
|
|
|
|
@Override
|
|
@StringRes
|
|
protected int getInfoMessageRequireEyes() {
|
|
return R.string.security_settings_face_enroll_introduction_info_consent_gaze;
|
|
}
|
|
|
|
@Override
|
|
@StringRes
|
|
protected int getHowMessage() {
|
|
return R.string.security_settings_face_enroll_introduction_how_consent_message;
|
|
}
|
|
|
|
@Override
|
|
@StringRes
|
|
protected int getInControlTitle() {
|
|
return R.string.security_settings_face_enroll_introduction_control_consent_title;
|
|
}
|
|
|
|
@Override
|
|
@StringRes
|
|
protected int getInControlMessage() {
|
|
return R.string.security_settings_face_enroll_introduction_control_consent_message;
|
|
}
|
|
|
|
@Override
|
|
protected int getHeaderResDefault() {
|
|
return R.string.security_settings_face_enroll_consent_introduction_title;
|
|
}
|
|
|
|
@Override
|
|
protected int getLessSecureMessage() {
|
|
return R.string.security_settings_face_enroll_introduction_info_consent_less_secure;
|
|
}
|
|
|
|
@Override
|
|
public int getMetricsCategory() {
|
|
return SettingsEnums.FACE_PARENTAL_CONSENT;
|
|
}
|
|
}
|