4/n: Add basic enrollment for Face
Bug: 110589286 Test: fingerprint enrolling still works Test: enrollment flow with and without a pin set up still works properly Test: enrollment continues when configuration changes, stops otherwise Change-Id: I39f76c7f1a16e9533cef573f87cf4b81cb20cb18
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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 static com.android.settings.biometrics.BiometricSettings.RESULT_FINISHED;
|
||||
import static com.android.settings.biometrics.BiometricSettings.RESULT_TIMEOUT;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.hardware.biometrics.BiometricConstants;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
|
||||
/**
|
||||
* Abstract dialog, shown when an error occurs during biometric enrollment.
|
||||
*/
|
||||
public abstract class BiometricErrorDialog extends InstrumentedDialogFragment {
|
||||
|
||||
public static final String KEY_ERROR_MSG = "error_msg";
|
||||
public static final String KEY_ERROR_ID = "error_id";
|
||||
|
||||
public abstract int getTitleResId();
|
||||
public abstract int getOkButtonTextResId();
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
CharSequence errorString = getArguments().getCharSequence(KEY_ERROR_MSG);
|
||||
final int errMsgId = getArguments().getInt(KEY_ERROR_ID);
|
||||
|
||||
builder.setTitle(getTitleResId())
|
||||
.setMessage(errorString)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getOkButtonTextResId(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
boolean wasTimeout =
|
||||
errMsgId == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT;
|
||||
Activity activity = getActivity();
|
||||
activity.setResult(wasTimeout ?
|
||||
RESULT_TIMEOUT : RESULT_FINISHED);
|
||||
activity.finish();
|
||||
}
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user