1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.biometrics.fingerprint2.lib.model 18 19 import android.annotation.StringRes 20 21 /** 22 * Represents a fingerprint enrollment state. See [FingerprintManager.EnrollmentCallback] for more 23 * information 24 */ 25 sealed class FingerEnrollState { 26 /** 27 * Represents an enrollment step progress. 28 * 29 * Progress is obtained by (totalStepsRequired - remainingSteps) / totalStepsRequired 30 */ 31 data class EnrollProgress(val remainingSteps: Int, val totalStepsRequired: Int) : 32 FingerEnrollState() 33 34 /** Represents that recoverable error has been encountered during enrollment. */ 35 data class EnrollHelp(@StringRes val helpMsgId: Int, val helpString: String) : 36 FingerEnrollState() 37 38 /** Represents that an unrecoverable error has been encountered and the operation is complete. */ 39 data class EnrollError( 40 @StringRes val errTitle: Int, 41 @StringRes val errString: Int, 42 val shouldRetryEnrollment: Boolean, 43 val isCancelled: Boolean, 44 ) : FingerEnrollState() 45 46 /** Indicates an acquired event has occurred */ 47 data class Acquired(val acquiredGood: Boolean) : FingerEnrollState() 48 49 /** Indicates a pointer down event has occurred */ 50 data class PointerDown(val fingerId: Int) : FingerEnrollState() 51 52 /** Indicates a pointer up event has occurred */ 53 data class PointerUp(val fingerId: Int) : FingerEnrollState() 54 55 /** Indicates the overlay has shown */ 56 data object OverlayShown : FingerEnrollState() 57 } 58