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 import com.android.systemui.scene.shared.model.Scene 27 import com.android.systemui.scene.shared.model.SceneKey 28 import com.android.systemui.scene.ui.viewmodel.SceneContainerViewModel 29 30 /** 31 * A facade to interact with Compose, when it is available. 32 * 33 * You should access this facade by calling the static methods on 34 * [com.android.systemui.compose.ComposeFacade] directly. 35 */ 36 interface BaseComposeFacade { 37 /** 38 * Whether Compose is currently available. This function should be checked before calling any 39 * other functions on this facade. 40 * 41 * This value will never change at runtime. 42 */ 43 fun isComposeAvailable(): Boolean 44 45 /** 46 * Return the [ComposeInitializer] to make Compose usable in windows outside normal activities. 47 */ 48 fun composeInitializer(): ComposeInitializer 49 50 /** Bind the content of [activity] to [viewModel]. */ 51 fun setPeopleSpaceActivityContent( 52 activity: ComponentActivity, 53 viewModel: PeopleViewModel, 54 onResult: (PeopleViewModel.Result) -> Unit, 55 ) 56 57 /** Create a [View] to represent [viewModel] on screen. */ 58 fun createFooterActionsView( 59 context: Context, 60 viewModel: FooterActionsViewModel, 61 qsVisibilityLifecycleOwner: LifecycleOwner, 62 ): View 63 64 /** Create a [View] to represent [viewModel] on screen. */ 65 fun createSceneContainerView( 66 context: Context, 67 viewModel: SceneContainerViewModel, 68 sceneByKey: Map<SceneKey, Scene>, 69 ): View 70 } 71