summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Coco Duan <cocod@google.com> 2024-03-11 07:55:19 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-03-11 07:55:19 +0000
commitcb2fd331c72f93f7bdd8a40e9bd28529324ffcf8 (patch)
tree9f8290419406c9b8d89faae083fcf7f87ff34d4f
parent9dc33861b7018c8b84ca8cd7bc491ea41dff338d (diff)
parentd66833e3fb0a483492bcee1f5ab77d1bda8c6e9d (diff)
Merge "Show a dialog after clicking on disabled widgets" into main
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt9
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt33
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalScene.kt4
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt72
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt19
-rw-r--r--packages/SystemUI/res/values/strings.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt16
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt20
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt11
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt4
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalInteractorKosmos.kt2
12 files changed, 187 insertions, 9 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
index 9ee69bc065f6..a3372e3e83da 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
@@ -28,6 +28,7 @@ import com.android.systemui.communal.ui.compose.extensions.allowGestures
import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.res.R
+import com.android.systemui.statusbar.phone.SystemUIDialogFactory
object Communal {
object Elements {
@@ -63,6 +64,7 @@ val sceneTransitions = transitions {
fun CommunalContainer(
modifier: Modifier = Modifier,
viewModel: CommunalViewModel,
+ dialogFactory: SystemUIDialogFactory,
) {
val currentScene: SceneKey by viewModel.currentScene.collectAsState(CommunalScenes.Blank)
val sceneTransitionLayoutState =
@@ -104,7 +106,7 @@ fun CommunalContainer(
userActions =
mapOf(Swipe(SwipeDirection.Right, fromSource = Edge.Left) to CommunalScenes.Blank),
) {
- CommunalScene(viewModel, modifier = modifier)
+ CommunalScene(viewModel, dialogFactory, modifier = modifier)
}
}
}
@@ -113,6 +115,7 @@ fun CommunalContainer(
@Composable
private fun SceneScope.CommunalScene(
viewModel: BaseCommunalViewModel,
+ dialogFactory: SystemUIDialogFactory,
modifier: Modifier = Modifier,
) {
Box(
@@ -121,5 +124,7 @@ private fun SceneScope.CommunalScene(
.fillMaxSize()
.background(LocalAndroidColorScheme.current.outlineVariant),
)
- Box(modifier.element(Communal.Elements.Content)) { CommunalHub(viewModel = viewModel) }
+ Box(modifier.element(Communal.Elements.Content)) {
+ CommunalHub(viewModel = viewModel, dialogFactory = dialogFactory)
+ }
}
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
index 3050f7ac3099..54237bbe498b 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt
@@ -29,6 +29,7 @@ import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
@@ -124,6 +125,7 @@ import com.android.systemui.communal.ui.viewmodel.CommunalEditModeViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.communal.widgets.WidgetConfigurator
import com.android.systemui.res.R
+import com.android.systemui.statusbar.phone.SystemUIDialogFactory
import kotlinx.coroutines.launch
@OptIn(ExperimentalComposeUiApi::class)
@@ -131,6 +133,7 @@ import kotlinx.coroutines.launch
fun CommunalHub(
modifier: Modifier = Modifier,
viewModel: BaseCommunalViewModel,
+ dialogFactory: SystemUIDialogFactory? = null,
widgetConfigurator: WidgetConfigurator? = null,
onOpenWidgetPicker: (() -> Unit)? = null,
onEditDone: (() -> Unit)? = null,
@@ -271,6 +274,18 @@ fun CommunalHub(
)
}
+ if (viewModel is CommunalViewModel && dialogFactory != null) {
+ val isEnableWidgetDialogShowing by
+ viewModel.isEnableWidgetDialogShowing.collectAsState(false)
+
+ EnableWidgetDialog(
+ isEnableWidgetDialogVisible = isEnableWidgetDialogShowing,
+ dialogFactory = dialogFactory,
+ onConfirm = viewModel::onEnableWidgetDialogConfirm,
+ onCancel = viewModel::onEnableWidgetDialogCancel
+ )
+ }
+
// This spacer covers the edge of the LazyHorizontalGrid and prevents it from receiving
// touches, so that the SceneTransitionLayout can intercept the touches and allow an edge
// swipe back to the blank scene.
@@ -616,7 +631,7 @@ private fun CommunalContent(
WidgetContent(viewModel, model, size, selected, widgetConfigurator, modifier)
is CommunalContentModel.WidgetPlaceholder -> HighlightedItem(modifier)
is CommunalContentModel.WidgetContent.DisabledWidget ->
- DisabledWidgetPlaceholder(model, modifier)
+ DisabledWidgetPlaceholder(model, viewModel, modifier)
is CommunalContentModel.CtaTileInViewMode -> CtaTileInViewModeContent(viewModel, modifier)
is CommunalContentModel.CtaTileInEditMode ->
CtaTileInEditModeContent(modifier, onOpenWidgetPicker)
@@ -826,6 +841,7 @@ fun WidgetConfigureButton(
@Composable
fun DisabledWidgetPlaceholder(
model: CommunalContentModel.WidgetContent.DisabledWidget,
+ viewModel: BaseCommunalViewModel,
modifier: Modifier = Modifier,
) {
val context = LocalContext.current
@@ -839,10 +855,17 @@ fun DisabledWidgetPlaceholder(
Column(
modifier =
- modifier.background(
- MaterialTheme.colorScheme.surfaceVariant,
- RoundedCornerShape(dimensionResource(system_app_widget_background_radius))
- ),
+ modifier
+ .background(
+ MaterialTheme.colorScheme.surfaceVariant,
+ RoundedCornerShape(dimensionResource(system_app_widget_background_radius))
+ )
+ .clickable(
+ enabled = !viewModel.isEditMode,
+ interactionSource = null,
+ indication = null,
+ onClick = viewModel::onOpenEnableWidgetDialog
+ ),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalScene.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalScene.kt
index 3d88ad53685e..9e905ac11b1e 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalScene.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalScene.kt
@@ -27,6 +27,7 @@ import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.ui.composable.ComposableScene
+import com.android.systemui.statusbar.phone.SystemUIDialogFactory
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@@ -38,6 +39,7 @@ class CommunalScene
@Inject
constructor(
private val viewModel: CommunalViewModel,
+ private val dialogFactory: SystemUIDialogFactory,
) : ComposableScene {
override val key = Scenes.Communal
@@ -51,6 +53,6 @@ constructor(
@Composable
override fun SceneScope.Content(modifier: Modifier) {
- CommunalHub(modifier, viewModel)
+ CommunalHub(modifier, viewModel, dialogFactory)
}
}
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt
new file mode 100644
index 000000000000..976a01d85037
--- /dev/null
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.communal.ui.compose
+
+import android.app.Dialog
+import android.content.DialogInterface
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.platform.LocalView
+import com.android.systemui.res.R
+import com.android.systemui.statusbar.phone.SystemUIDialogFactory
+
+/**
+ * Dialog shown upon tapping a disabled widget. It enables users to navigate to settings and modify
+ * allowed widget categories.
+ */
+@Composable
+fun EnableWidgetDialog(
+ isEnableWidgetDialogVisible: Boolean,
+ dialogFactory: SystemUIDialogFactory,
+ onConfirm: () -> Unit,
+ onCancel: () -> Unit
+) {
+ var dialog: Dialog? by remember { mutableStateOf(null) }
+ val context = LocalView.current.context
+
+ DisposableEffect(isEnableWidgetDialogVisible) {
+ if (isEnableWidgetDialogVisible) {
+ dialog =
+ dialogFactory.create(context = context).apply {
+ setTitle(context.getString(R.string.dialog_title_to_allow_any_widget))
+ setButton(
+ DialogInterface.BUTTON_NEGATIVE,
+ context.getString(R.string.cancel)
+ ) { _, _ ->
+ onCancel()
+ }
+ setButton(
+ DialogInterface.BUTTON_POSITIVE,
+ context.getString(R.string.button_text_to_open_settings)
+ ) { _, _ ->
+ onConfirm()
+ }
+ setCancelable(false)
+ show()
+ }
+ }
+
+ onDispose {
+ dialog?.dismiss()
+ dialog = null
+ }
+ }
+}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
index eafd5038759c..1a4f61e36b36 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
@@ -19,8 +19,10 @@ package com.android.systemui.communal.domain.interactor
import android.app.smartspace.SmartspaceTarget
import android.appwidget.AppWidgetProviderInfo
+import android.content.Intent
import android.content.pm.UserInfo
import android.os.UserHandle
+import android.provider.Settings
import android.provider.Settings.Secure.HUB_MODE_TUTORIAL_COMPLETED
import android.widget.RemoteViews
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -50,6 +52,8 @@ import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.kosmos.testScope
+import com.android.systemui.plugins.ActivityStarter
+import com.android.systemui.plugins.activityStarter
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags
@@ -61,6 +65,8 @@ import com.android.systemui.smartspace.data.repository.fakeSmartspaceRepository
import com.android.systemui.testKosmos
import com.android.systemui.user.data.repository.FakeUserRepository
import com.android.systemui.user.data.repository.fakeUserRepository
+import com.android.systemui.util.mockito.argumentCaptor
+import com.android.systemui.util.mockito.capture
import com.android.systemui.util.mockito.mock
import com.android.systemui.util.mockito.whenever
import com.android.systemui.util.settings.fakeSettings
@@ -73,6 +79,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
+import org.mockito.ArgumentMatchers.eq
import org.mockito.Mock
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
@@ -103,6 +110,7 @@ class CommunalInteractorTest : SysuiTestCase() {
private lateinit var editWidgetsActivityStarter: EditWidgetsActivityStarter
private lateinit var sceneInteractor: SceneInteractor
private lateinit var userTracker: FakeUserTracker
+ private lateinit var activityStarter: ActivityStarter
private lateinit var underTest: CommunalInteractor
@@ -121,6 +129,7 @@ class CommunalInteractorTest : SysuiTestCase() {
communalPrefsRepository = kosmos.fakeCommunalPrefsRepository
sceneInteractor = kosmos.sceneInteractor
userTracker = kosmos.fakeUserTracker
+ activityStarter = kosmos.activityStarter
whenever(mainUser.isMain).thenReturn(true)
whenever(secondaryUser.isMain).thenReturn(false)
@@ -800,6 +809,16 @@ class CommunalInteractorTest : SysuiTestCase() {
}
@Test
+ fun navigateToCommunalWidgetSettings_startsActivity() =
+ testScope.runTest {
+ underTest.navigateToCommunalWidgetSettings()
+ val intentCaptor = argumentCaptor<Intent>()
+ verify(activityStarter)
+ .postStartActivityDismissingKeyguard(capture(intentCaptor), eq(0))
+ assertThat(intentCaptor.value.action).isEqualTo(Settings.ACTION_COMMUNAL_SETTING)
+ }
+
+ @Test
fun filterWidgets_whenUserProfileRemoved() =
testScope.runTest {
// Keyguard showing, and tutorial completed.
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 517f88b7f571..d8e68f2d5fe7 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1135,6 +1135,10 @@
<string name="hub_mode_add_widget_button_text">Add widget</string>
<!-- Text for the button that exits the hub mode editing mode. [CHAR LIMIT=50] -->
<string name="hub_mode_editing_exit_button_text">Done</string>
+ <!-- Title for the dialog that redirects users to change allowed widget category in settings. [CHAR LIMIT=NONE] -->
+ <string name="dialog_title_to_allow_any_widget">Allow any widget on lock screen?</string>
+ <!-- Text for the button in the dialog that opens when tapping on disabled widgets. [CHAR LIMIT=NONE] -->
+ <string name="button_text_to_open_settings">Open settings</string>
<!-- Related to user switcher --><skip/>
diff --git a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt
index 814295787b6c..fa10d85caf18 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt
@@ -18,7 +18,9 @@ package com.android.systemui.communal.domain.interactor
import android.app.smartspace.SmartspaceTarget
import android.content.ComponentName
+import android.content.Intent
import android.os.UserHandle
+import android.provider.Settings
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.SceneKey
import com.android.systemui.communal.data.repository.CommunalMediaRepository
@@ -45,6 +47,7 @@ import com.android.systemui.log.dagger.CommunalLog
import com.android.systemui.log.dagger.CommunalTableLog
import com.android.systemui.log.table.TableLogBuffer
import com.android.systemui.log.table.logDiffsForTable
+import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlags
import com.android.systemui.scene.shared.model.Scenes
@@ -88,6 +91,7 @@ constructor(
private val appWidgetHost: CommunalAppWidgetHost,
private val editWidgetsActivityStarter: EditWidgetsActivityStarter,
private val userTracker: UserTracker,
+ private val activityStarter: ActivityStarter,
sceneInteractor: SceneInteractor,
sceneContainerFlags: SceneContainerFlags,
@CommunalLog logBuffer: LogBuffer,
@@ -247,6 +251,18 @@ constructor(
editWidgetsActivityStarter.startActivity(preselectedKey)
}
+ /**
+ * Navigates to communal widget setting after user has unlocked the device. Currently, this
+ * setting resides within the Hub Mode settings screen.
+ */
+ fun navigateToCommunalWidgetSettings() {
+ activityStarter.postStartActivityDismissingKeyguard(
+ Intent(Settings.ACTION_COMMUNAL_SETTING)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP),
+ /* delay= */ 0,
+ )
+ }
+
/** Dismiss the CTA tile from the hub in view mode. */
suspend fun dismissCtaTile() = communalPrefsRepository.setCtaDismissedForCurrentUser()
diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt
index 35372cd28c15..feb506aaa527 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt
@@ -70,6 +70,8 @@ abstract class BaseCommunalViewModel(
communalInteractor.addWidget(componentName, user, priority, configurator)
}
+ open fun onOpenEnableWidgetDialog() {}
+
/** A list of all the communal content to be displayed in the communal hub. */
abstract val communalContent: Flow<List<CommunalContentModel>>
diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt
index 35b27aaeb6bc..0c332f52ba06 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt
@@ -87,6 +87,9 @@ constructor(
override val isPopupOnDismissCtaShowing: Flow<Boolean> =
_isPopupOnDismissCtaShowing.asStateFlow()
+ private val _isEnableWidgetDialogShowing: MutableStateFlow<Boolean> = MutableStateFlow(false)
+ val isEnableWidgetDialogShowing: Flow<Boolean> = _isEnableWidgetDialogShowing.asStateFlow()
+
/** Whether touches should be disabled in communal */
val touchesAllowed: Flow<Boolean> = not(shadeInteractor.isAnyFullyExpanded)
@@ -120,6 +123,23 @@ constructor(
setPopupOnDismissCtaVisibility(false)
}
+ override fun onOpenEnableWidgetDialog() {
+ setIsEnableWidgetDialogShowing(true)
+ }
+
+ fun onEnableWidgetDialogConfirm() {
+ communalInteractor.navigateToCommunalWidgetSettings()
+ setIsEnableWidgetDialogShowing(false)
+ }
+
+ fun onEnableWidgetDialogCancel() {
+ setIsEnableWidgetDialogShowing(false)
+ }
+
+ private fun setIsEnableWidgetDialogShowing(isVisible: Boolean) {
+ _isEnableWidgetDialogShowing.value = isVisible
+ }
+
private fun setPopupOnDismissCtaVisibility(isVisible: Boolean) {
_isPopupOnDismissCtaShowing.value = isVisible
}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt b/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt
index d3869baf16a2..3169e9ccbbcb 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt
@@ -33,6 +33,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.res.R
import com.android.systemui.shade.domain.interactor.ShadeInteractor
+import com.android.systemui.statusbar.phone.SystemUIDialogFactory
import com.android.systemui.util.kotlin.collectFlow
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
@@ -47,6 +48,7 @@ class GlanceableHubContainerController
constructor(
private val communalInteractor: CommunalInteractor,
private val communalViewModel: CommunalViewModel,
+ private val dialogFactory: SystemUIDialogFactory,
private val keyguardTransitionInteractor: KeyguardTransitionInteractor,
private val shadeInteractor: ShadeInteractor,
private val powerManager: PowerManager,
@@ -119,7 +121,14 @@ constructor(
): View {
return initView(
ComposeView(context).apply {
- setContent { PlatformTheme { CommunalContainer(viewModel = communalViewModel) } }
+ setContent {
+ PlatformTheme {
+ CommunalContainer(
+ viewModel = communalViewModel,
+ dialogFactory = dialogFactory,
+ )
+ }
+ }
}
)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt
index 62d2d0efe24c..07d93508228e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt
@@ -42,6 +42,7 @@ import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
import com.android.systemui.shade.domain.interactor.ShadeInteractor
+import com.android.systemui.statusbar.phone.SystemUIDialogFactory
import com.android.systemui.testKosmos
import com.android.systemui.util.mockito.any
import com.android.systemui.util.mockito.whenever
@@ -76,6 +77,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
@Mock private lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor
@Mock private lateinit var shadeInteractor: ShadeInteractor
@Mock private lateinit var powerManager: PowerManager
+ @Mock private lateinit var dialogFactory: SystemUIDialogFactory
private lateinit var parentView: FrameLayout
private lateinit var containerView: View
@@ -99,6 +101,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
GlanceableHubContainerController(
communalInteractor,
communalViewModel,
+ dialogFactory,
keyguardTransitionInteractor,
shadeInteractor,
powerManager
@@ -138,6 +141,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
GlanceableHubContainerController(
communalInteractor,
communalViewModel,
+ dialogFactory,
keyguardTransitionInteractor,
shadeInteractor,
powerManager,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalInteractorKosmos.kt
index 6ac702eb2446..161c6fb9f134 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalInteractorKosmos.kt
@@ -29,6 +29,7 @@ import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.log.logcatLogBuffer
+import com.android.systemui.plugins.activityStarter
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags
import com.android.systemui.settings.userTracker
@@ -48,6 +49,7 @@ val Kosmos.communalInteractor by Fixture {
keyguardInteractor = keyguardInteractor,
editWidgetsActivityStarter = editWidgetsActivityStarter,
userTracker = userTracker,
+ activityStarter = activityStarter,
logBuffer = logcatLogBuffer("CommunalInteractor"),
tableLogBuffer = mock(),
communalSettingsInteractor = communalSettingsInteractor,