• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.compose
19 
20 import android.content.Context
21 import android.view.View
22 import androidx.activity.ComponentActivity
23 import androidx.lifecycle.LifecycleOwner
24 import com.android.systemui.people.ui.viewmodel.PeopleViewModel
25 import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsViewModel
26 
27 /**
28  * A facade to interact with Compose, when it is available.
29  *
30  * You should access this facade by calling the static methods on
31  * [com.android.systemui.compose.ComposeFacade] directly.
32  */
33 interface BaseComposeFacade {
34     /**
35      * Whether Compose is currently available. This function should be checked before calling any
36      * other functions on this facade.
37      *
38      * This value will never change at runtime.
39      */
isComposeAvailablenull40     fun isComposeAvailable(): Boolean
41 
42     /**
43      * Return the [ComposeInitializer] to make Compose usable in windows outside normal activities.
44      */
45     fun composeInitializer(): ComposeInitializer
46 
47     /** Bind the content of [activity] to [viewModel]. */
48     fun setPeopleSpaceActivityContent(
49         activity: ComponentActivity,
50         viewModel: PeopleViewModel,
51         onResult: (PeopleViewModel.Result) -> Unit,
52     )
53 
54     /** Create a [View] to represent [viewModel] on screen. */
55     fun createFooterActionsView(
56         context: Context,
57         viewModel: FooterActionsViewModel,
58         qsVisibilityLifecycleOwner: LifecycleOwner,
59     ): View
60 }
61