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 18 19 import android.content.ContentProvider 20 import android.content.ContentValues 21 import android.database.Cursor 22 import android.net.Uri 23 import android.os.Bundle 24 import com.android.settings.flags.Flags 25 26 class BiometricSettingsProvider : ContentProvider() { 27 companion object { 28 const val GET_SUW_FACE_ENABLED = "getSuwFaceEnabled" 29 const val SUW_FACE_ENABLED = "suw_face_enabled" 30 } 31 deletenull32 override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int { 33 throw UnsupportedOperationException("query operation not supported currently.") 34 } 35 getTypenull36 override fun getType(uri: Uri): String? { 37 throw UnsupportedOperationException("getType not supported") 38 } 39 insertnull40 override fun insert(uri: Uri, values: ContentValues?): Uri? { 41 throw UnsupportedOperationException("insert not supported") 42 } 43 querynull44 override fun query( 45 uri: Uri, 46 projection: Array<out String>?, 47 selection: String?, 48 selectionArgs: Array<out String>?, 49 sortOrder: String? 50 ): Cursor? { 51 throw UnsupportedOperationException("query not supported") 52 } 53 updatenull54 override fun update( 55 uri: Uri, 56 values: ContentValues?, 57 selection: String?, 58 selectionArgs: Array<out String>? 59 ): Int { 60 throw UnsupportedOperationException("update not supported") 61 } 62 onCreatenull63 override fun onCreate(): Boolean = true 64 65 override fun call(method: String, arg: String?, extras: Bundle?): Bundle? { 66 val bundle = Bundle() 67 if (Flags.biometricSettingsProvider()) { 68 if (GET_SUW_FACE_ENABLED == method) { 69 val faceEnabled = 70 requireContext() 71 .resources 72 .getBoolean(com.android.settings.R.bool.config_suw_support_face_enroll) 73 bundle.putBoolean(SUW_FACE_ENABLED, faceEnabled) 74 } 75 } 76 return bundle 77 } 78 } 79