1 /*
2  * Copyright (C) 2020 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.controls.ui
18 
19 import android.content.ComponentName
20 import android.content.Context
21 import android.service.controls.Control
22 import android.service.controls.actions.ControlAction
23 import android.view.ViewGroup
24 import com.android.systemui.controls.controller.StructureInfo
25 
26 interface ControlsUiController {
27     companion object {
28         public const val TAG = "ControlsUiController"
29         public const val EXTRA_ANIMATE = "extra_animate"
30     }
31 
32     fun show(parent: ViewGroup, onDismiss: Runnable, activityContext: Context)
33     fun hide()
34 
35     /**
36      * Request all open dialogs be closed. Set [immediately] to true to dismiss without
37      * animations.
38      */
39     fun closeDialogs(immediately: Boolean)
40 
41     fun onRefreshState(componentName: ComponentName, controls: List<Control>)
42     fun onActionResponse(
43         componentName: ComponentName,
44         controlId: String,
45         @ControlAction.ResponseResult response: Int
46     )
47 
48     /**
49      * Returns the structure that is currently preferred by the user.
50      *
51      * This structure will be the one that appears when the user first opens the controls activity.
52      */
53     fun getPreferredStructure(structures: List<StructureInfo>): StructureInfo
54 }
55