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.systemui.shared.settings.data.repository 18 19 import android.provider.Settings 20 import kotlinx.coroutines.flow.Flow 21 22 /** Defines interface for classes that can provide access to data from [Settings.Secure]. */ 23 interface SecureSettingsRepository { 24 25 /** Returns a [Flow] tracking the value of a setting as an [Int]. */ intSettingnull26 fun intSetting(name: String, defaultValue: Int = 0): Flow<Int> 27 28 /** Returns a [Flow] tracking the value of a setting as a [Boolean]. */ 29 fun boolSetting(name: String, defaultValue: Boolean = false): Flow<Boolean> 30 31 /** Updates the value of the setting with the given name. */ 32 suspend fun setInt(name: String, value: Int) 33 34 suspend fun getInt(name: String, defaultValue: Int = 0): Int 35 36 suspend fun getString(name: String): String? 37 } 38