Loading packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +23 −56 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer Loading Loading @@ -93,7 +93,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId Loading @@ -119,7 +118,6 @@ import com.android.systemui.communal.ui.compose.extensions.firstItemAtOffset import com.android.systemui.communal.ui.compose.extensions.observeTapsWithoutConsuming import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel 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 kotlinx.coroutines.launch Loading Loading @@ -199,7 +197,6 @@ fun CommunalHub( } }, ) { Column(Modifier.align(Alignment.TopStart)) { CommunalHubLazyGrid( communalContent = communalContent, viewModel = viewModel, Loading @@ -220,16 +217,6 @@ fun CommunalHub( selectedKey = selectedKey, widgetConfigurator = widgetConfigurator, ) // TODO(b/326060686): Remove this once keyguard indication area can persist over hub if (viewModel is CommunalViewModel) { val isUnlocked by viewModel.deviceUnlocked.collectAsState(initial = false) Spacer(Modifier.height(24.dp)) LockStateIcon( isUnlocked = isUnlocked, modifier = Modifier.align(Alignment.CenterHorizontally), ) } } if (viewModel.isEditMode && onOpenWidgetPicker != null && onEditDone != null) { Toolbar( Loading Loading @@ -281,7 +268,7 @@ fun CommunalHub( @OptIn(ExperimentalFoundationApi::class) @Composable private fun ColumnScope.CommunalHubLazyGrid( private fun BoxScope.CommunalHubLazyGrid( communalContent: List<CommunalContentModel>, viewModel: BaseCommunalViewModel, contentPadding: PaddingValues, Loading @@ -295,7 +282,7 @@ private fun ColumnScope.CommunalHubLazyGrid( widgetConfigurator: WidgetConfigurator?, ) { var gridModifier = Modifier.align(Alignment.Start).onGloballyPositioned { setGridCoordinates(it) } Modifier.align(Alignment.TopStart).onGloballyPositioned { setGridCoordinates(it) } var list = communalContent var dragDropState: GridDragDropState? = null if (viewModel.isEditMode && viewModel is CommunalEditModeViewModel) { Loading Loading @@ -377,26 +364,6 @@ private fun ColumnScope.CommunalHubLazyGrid( } } @Composable private fun LockStateIcon( isUnlocked: Boolean, modifier: Modifier = Modifier, ) { val colors = LocalAndroidColorScheme.current val resource = if (isUnlocked) { R.drawable.ic_unlocked } else { R.drawable.ic_lock } Icon( painter = painterResource(id = resource), contentDescription = null, tint = colors.onPrimaryContainer, modifier = modifier.size(52.dp) ) } /** * Toolbar that contains action buttons to * 1) open the widget picker Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt +0 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import com.android.systemui.communal.shared.model.CommunalWidgetContentModel import com.android.systemui.communal.ui.viewmodel.CommunalViewModel import com.android.systemui.communal.ui.viewmodel.CommunalViewModel.Companion.POPUP_AUTO_HIDE_TIMEOUT_MS import com.android.systemui.coroutines.collectLastValue import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository Loading Loading @@ -114,7 +113,6 @@ class CommunalViewModelTest : SysuiTestCase() { kosmos.communalInteractor, kosmos.communalTutorialInteractor, kosmos.shadeInteractor, kosmos.deviceEntryInteractor, mediaHost, logcatLogBuffer("CommunalViewModelTest"), ) Loading packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt +0 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import com.android.systemui.communal.domain.interactor.CommunalTutorialInteracto import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.Logger import com.android.systemui.log.dagger.CommunalLog Loading @@ -47,7 +46,6 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch /** The default view model used for showing the communal hub. */ @OptIn(ExperimentalCoroutinesApi::class) @SysUISingleton class CommunalViewModel @Inject Loading @@ -56,7 +54,6 @@ constructor( private val communalInteractor: CommunalInteractor, tutorialInteractor: CommunalTutorialInteractor, shadeInteractor: ShadeInteractor, deviceEntryInteractor: DeviceEntryInteractor, @Named(MediaModule.COMMUNAL_HUB) mediaHost: MediaHost, @CommunalLog logBuffer: LogBuffer, ) : BaseCommunalViewModel(communalInteractor, mediaHost) { Loading Loading @@ -90,8 +87,6 @@ constructor( /** Whether touches should be disabled in communal */ val touchesAllowed: Flow<Boolean> = not(shadeInteractor.isAnyFullyExpanded) val deviceUnlocked: Flow<Boolean> = deviceEntryInteractor.isUnlocked init { // Initialize our media host for the UMO. This only needs to happen once and must be done // before the MediaHierarchyManager attempts to move the UMO to the hub. Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +23 −56 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer Loading Loading @@ -93,7 +93,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId Loading @@ -119,7 +118,6 @@ import com.android.systemui.communal.ui.compose.extensions.firstItemAtOffset import com.android.systemui.communal.ui.compose.extensions.observeTapsWithoutConsuming import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel 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 kotlinx.coroutines.launch Loading Loading @@ -199,7 +197,6 @@ fun CommunalHub( } }, ) { Column(Modifier.align(Alignment.TopStart)) { CommunalHubLazyGrid( communalContent = communalContent, viewModel = viewModel, Loading @@ -220,16 +217,6 @@ fun CommunalHub( selectedKey = selectedKey, widgetConfigurator = widgetConfigurator, ) // TODO(b/326060686): Remove this once keyguard indication area can persist over hub if (viewModel is CommunalViewModel) { val isUnlocked by viewModel.deviceUnlocked.collectAsState(initial = false) Spacer(Modifier.height(24.dp)) LockStateIcon( isUnlocked = isUnlocked, modifier = Modifier.align(Alignment.CenterHorizontally), ) } } if (viewModel.isEditMode && onOpenWidgetPicker != null && onEditDone != null) { Toolbar( Loading Loading @@ -281,7 +268,7 @@ fun CommunalHub( @OptIn(ExperimentalFoundationApi::class) @Composable private fun ColumnScope.CommunalHubLazyGrid( private fun BoxScope.CommunalHubLazyGrid( communalContent: List<CommunalContentModel>, viewModel: BaseCommunalViewModel, contentPadding: PaddingValues, Loading @@ -295,7 +282,7 @@ private fun ColumnScope.CommunalHubLazyGrid( widgetConfigurator: WidgetConfigurator?, ) { var gridModifier = Modifier.align(Alignment.Start).onGloballyPositioned { setGridCoordinates(it) } Modifier.align(Alignment.TopStart).onGloballyPositioned { setGridCoordinates(it) } var list = communalContent var dragDropState: GridDragDropState? = null if (viewModel.isEditMode && viewModel is CommunalEditModeViewModel) { Loading Loading @@ -377,26 +364,6 @@ private fun ColumnScope.CommunalHubLazyGrid( } } @Composable private fun LockStateIcon( isUnlocked: Boolean, modifier: Modifier = Modifier, ) { val colors = LocalAndroidColorScheme.current val resource = if (isUnlocked) { R.drawable.ic_unlocked } else { R.drawable.ic_lock } Icon( painter = painterResource(id = resource), contentDescription = null, tint = colors.onPrimaryContainer, modifier = modifier.size(52.dp) ) } /** * Toolbar that contains action buttons to * 1) open the widget picker Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalViewModelTest.kt +0 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import com.android.systemui.communal.shared.model.CommunalWidgetContentModel import com.android.systemui.communal.ui.viewmodel.CommunalViewModel import com.android.systemui.communal.ui.viewmodel.CommunalViewModel.Companion.POPUP_AUTO_HIDE_TIMEOUT_MS import com.android.systemui.coroutines.collectLastValue import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository Loading Loading @@ -114,7 +113,6 @@ class CommunalViewModelTest : SysuiTestCase() { kosmos.communalInteractor, kosmos.communalTutorialInteractor, kosmos.shadeInteractor, kosmos.deviceEntryInteractor, mediaHost, logcatLogBuffer("CommunalViewModelTest"), ) Loading
packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalViewModel.kt +0 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import com.android.systemui.communal.domain.interactor.CommunalTutorialInteracto import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.Logger import com.android.systemui.log.dagger.CommunalLog Loading @@ -47,7 +46,6 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch /** The default view model used for showing the communal hub. */ @OptIn(ExperimentalCoroutinesApi::class) @SysUISingleton class CommunalViewModel @Inject Loading @@ -56,7 +54,6 @@ constructor( private val communalInteractor: CommunalInteractor, tutorialInteractor: CommunalTutorialInteractor, shadeInteractor: ShadeInteractor, deviceEntryInteractor: DeviceEntryInteractor, @Named(MediaModule.COMMUNAL_HUB) mediaHost: MediaHost, @CommunalLog logBuffer: LogBuffer, ) : BaseCommunalViewModel(communalInteractor, mediaHost) { Loading Loading @@ -90,8 +87,6 @@ constructor( /** Whether touches should be disabled in communal */ val touchesAllowed: Flow<Boolean> = not(shadeInteractor.isAnyFullyExpanded) val deviceUnlocked: Flow<Boolean> = deviceEntryInteractor.isUnlocked init { // Initialize our media host for the UMO. This only needs to happen once and must be done // before the MediaHierarchyManager attempts to move the UMO to the hub. Loading