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 package com.android.settings.biometrics2.ui.model
17 
18 
19 enum class FingerprintEnrollable {
20     // Unconfirmed case, this value is invalid, and view shall bypass this value
21     FINGERPRINT_ENROLLABLE_UNKNOWN,
22     // User is allowed to enrolled a new fingerprint
23     FINGERPRINT_ENROLLABLE_OK,
24     // User is not allowed to enroll because the number has reached maximum
25     FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX
26 }
27 
28 /**
29  * Fingerprint onboarding introduction page data, it contains following information which needs
30  * to be passed from view model to view.
31  * 1. mEnrollableStatus: User is allowed to enroll a new fingerprint or not.
32  * 2. mHasScrollToBottom: User has scrolled to the bottom of this page or not.
33  */
34 class FingerprintEnrollIntroStatus(
35     private val mHasScrollToBottom: Boolean,
36     /** Enrollable status. It means that user is allowed to enroll a new fingerprint or not. */
37     val enrollableStatus: FingerprintEnrollable
38 ) {
39     /** Get info for this onboarding introduction page has scrolled to bottom or not */
hasScrollToBottomnull40     fun hasScrollToBottom(): Boolean {
41         return mHasScrollToBottom
42     }
43 
toStringnull44     override fun toString(): String {
45         return ("${javaClass.simpleName}@${Integer.toHexString(hashCode())}"
46                 + "{scrollToBottom:$mHasScrollToBottom"
47                 + ", enrollableStatus:$enrollableStatus}")
48     }
49 }
50