1 /*
2  * Copyright (C) 2022 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 
18 package com.android.systemui.keyguard.data.quickaffordance
19 
20 import kotlinx.coroutines.flow.Flow
21 
22 /**
23  * Defines interface for classes that manage and provide access to the current "selections" of
24  * keyguard quick affordances, answering the question "which affordances should the keyguard show?".
25  */
26 interface KeyguardQuickAffordanceSelectionManager {
27 
28     /** IDs of affordances to show, indexed by slot ID, and sorted in descending priority order. */
29     val selections: Flow<Map<String, List<String>>>
30 
31     /**
32      * Returns a snapshot of the IDs of affordances to show, indexed by slot ID, and sorted in
33      * descending priority order.
34      */
getSelectionsnull35     fun getSelections(): Map<String, List<String>>
36 
37     /**
38      * Updates the IDs of affordances to show at the slot with the given ID. The order of affordance
39      * IDs should be descending priority order.
40      */
41     fun setSelections(
42         slotId: String,
43         affordanceIds: List<String>,
44     )
45 
46     companion object {
47         const val FILE_NAME = "quick_affordance_selections"
48     }
49 }
50