1 package com.android.systemui.qs
2 
3 import android.content.Context
4 import androidx.compose.ui.platform.ComposeView
5 import androidx.lifecycle.LifecycleOwner
6 import com.android.compose.theme.PlatformTheme
7 import com.android.internal.policy.SystemBarUtils
8 import com.android.systemui.qs.footer.ui.compose.FooterActions
9 import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsViewModel
10 import com.android.systemui.util.LargeScreenUtils.shouldUseLargeScreenShadeHeader
11 
12 object QSUtils {
13 
14     /**
15      * Gets the [R.dimen.qs_header_system_icons_area_height] unless we use large screen header.
16      *
17      * It's the same as [com.android.internal.R.dimen.quick_qs_offset_height] except for
18      * sw600dp-land.
19      */
20     @JvmStatic
getQsHeaderSystemIconsAreaHeightnull21     fun getQsHeaderSystemIconsAreaHeight(context: Context): Int {
22         return if (shouldUseLargeScreenShadeHeader(context.resources)) {
23             // value should be 0 when using large screen shade header because it's not expandable
24             0
25         } else {
26             SystemBarUtils.getQuickQsOffsetHeight(context)
27         }
28     }
29 
30     @JvmStatic
setFooterActionsViewContentnull31     fun setFooterActionsViewContent(
32         view: ComposeView,
33         viewModel: FooterActionsViewModel,
34         qsVisibilityLifecycleOwner: LifecycleOwner,
35     ) {
36         view.setContent { PlatformTheme { FooterActions(viewModel, qsVisibilityLifecycleOwner) } }
37     }
38 }
39