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.remoteauth
18 
19 import android.content.Context
20 import android.util.FeatureFlagUtils
21 import com.android.settings.biometrics.BiometricStatusPreferenceController
22 
23 class RemoteAuthStatusPreferenceController(
24     private val context: Context,
25     key: String = KEY_REMOTE_AUTHENTICATOR_SETTINGS
26 ) : BiometricStatusPreferenceController(
27     context, key
28 ) {
isDeviceSupportednull29     override fun isDeviceSupported(): Boolean {
30         // TODO(b/290768873): Change based on RemoteAuthManager.
31         return FeatureFlagUtils.isEnabled(
32             context,
33             FeatureFlagUtils.SETTINGS_REMOTEAUTH_ENROLLMENT_SETTINGS
34         )
35     }
36 
isHardwareSupportednull37     override fun isHardwareSupported(): Boolean {
38         // TODO(b/290768873): Change based on RemoteAuthManager.
39         return FeatureFlagUtils.isEnabled(
40             context,
41             FeatureFlagUtils.SETTINGS_REMOTEAUTH_ENROLLMENT_SETTINGS
42         )
43     }
44 
getSummaryTextnull45     override fun getSummaryText() = RemoteAuthStatusUtils.getSummary(context)
46 
47     override fun getSettingsClassName() = RemoteAuthStatusUtils.getSettingsClassName()
48 
49     private companion object {
50         /**
51          * Preference key.
52          *
53          * This must match the key found in security_settings_combined_biometric.xml
54          **/
55         const val KEY_REMOTE_AUTHENTICATOR_SETTINGS = "biometric_remote_authenticator_settings"
56     }
57 }