Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +28 −2 Original line number Original line Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { ) : ComposableLockscreenSceneBlueprint { override val id: String = "default" override val id: String = "default" Loading @@ -59,6 +66,8 @@ constructor( @Composable @Composable override fun SceneScope.Content(modifier: Modifier) { override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( LockscreenLongPress( viewModel = viewModel.longPress, viewModel = viewModel.longPress, Loading @@ -68,10 +77,27 @@ constructor( content = { content = { // Constrained to above the lock icon. // Constrained to above the lock icon. Column( Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt +27 −2 Original line number Original line Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { ) : ComposableLockscreenSceneBlueprint { override val id: String = "shortcuts-besides-udfps" override val id: String = "shortcuts-besides-udfps" Loading @@ -59,6 +66,8 @@ constructor( @Composable @Composable override fun SceneScope.Content(modifier: Modifier) { override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( LockscreenLongPress( viewModel = viewModel.longPress, viewModel = viewModel.longPress, Loading @@ -68,11 +77,27 @@ constructor( content = { content = { // Constrained to above the lock icon. // Constrained to above the lock icon. Column( Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,7 @@ constructor( val burnIn = rememberBurnIn(clockInteractor) val burnIn = rememberBurnIn(clockInteractor) val resources = LocalContext.current.resources val resources = LocalContext.current.resources val currentClockState = clockViewModel.currentClock.collectAsState() val currentClockState = clockViewModel.currentClock.collectAsState() val areNotificationsVisible by viewModel.areNotificationsVisible.collectAsState() LockscreenLongPress( LockscreenLongPress( viewModel = viewModel.longPress, viewModel = viewModel.longPress, modifier = modifier, modifier = modifier, Loading Loading @@ -145,7 +146,7 @@ constructor( with(mediaCarouselSection) { MediaCarousel() } with(mediaCarouselSection) { MediaCarousel() } if (viewModel.areNotificationsVisible) { if (areNotificationsVisible) { with(notificationSection) { with(notificationSection) { Notifications( Notifications( modifier = Modifier.fillMaxWidth().weight(weight = 1f) modifier = Modifier.fillMaxWidth().weight(weight = 1f) Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt +33 −1 Original line number Original line Diff line number Diff line Loading @@ -17,12 +17,25 @@ package com.android.systemui.keyguard.ui.composable.section package com.android.systemui.keyguard.ui.composable.section import android.view.ViewGroup import android.view.ViewGroup import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel import com.android.systemui.notifications.ui.composable.NotificationStack import com.android.systemui.notifications.ui.composable.NotificationStack import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder Loading @@ -39,6 +52,7 @@ constructor( sharedNotificationContainerViewModel: SharedNotificationContainerViewModel, sharedNotificationContainerViewModel: SharedNotificationContainerViewModel, stackScrollLayout: NotificationStackScrollLayout, stackScrollLayout: NotificationStackScrollLayout, sharedNotificationContainerBinder: SharedNotificationContainerBinder, sharedNotificationContainerBinder: SharedNotificationContainerBinder, private val lockscreenContentViewModel: LockscreenContentViewModel, ) { ) { init { init { Loading @@ -65,9 +79,27 @@ constructor( @Composable @Composable fun SceneScope.Notifications(modifier: Modifier = Modifier) { fun SceneScope.Notifications(modifier: Modifier = Modifier) { val shouldUseSplitNotificationShade by lockscreenContentViewModel.shouldUseSplitNotificationShade.collectAsState() val areNotificationsVisible by lockscreenContentViewModel.areNotificationsVisible.collectAsState() val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } if (!areNotificationsVisible) { return } NotificationStack( NotificationStack( viewModel = viewModel, viewModel = viewModel, modifier = modifier, modifier = modifier.fillMaxWidth().thenIf(shouldUseSplitNotificationShade) { Modifier.padding(top = splitShadeTopMargin) }, ) ) } } } } packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt +65 −141 Original line number Original line Diff line number Diff line Loading @@ -16,30 +16,20 @@ package com.android.systemui.keyguard.ui.composable.section package com.android.systemui.keyguard.ui.composable.section import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.modifiers.thenIf import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene Loading @@ -48,8 +38,6 @@ import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.splitSh import com.android.systemui.keyguard.ui.composable.blueprint.ClockTransition import com.android.systemui.keyguard.ui.composable.blueprint.ClockTransition import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import javax.inject.Inject import javax.inject.Inject class TopAreaSection class TopAreaSection Loading @@ -58,19 +46,16 @@ constructor( private val clockViewModel: KeyguardClockViewModel, private val clockViewModel: KeyguardClockViewModel, private val smartSpaceSection: SmartSpaceSection, private val smartSpaceSection: SmartSpaceSection, private val mediaCarouselSection: MediaCarouselSection, private val mediaCarouselSection: MediaCarouselSection, private val notificationSection: NotificationSection, private val clockSection: DefaultClockSection, private val clockSection: DefaultClockSection, private val clockInteractor: KeyguardClockInteractor, private val clockInteractor: KeyguardClockInteractor, ) { ) { @Composable @Composable fun DefaultClockLayoutWithNotifications( fun DefaultClockLayout( modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() val currentClockLayout by clockViewModel.currentClockLayout.collectAsState() val currentClockLayout by clockViewModel.currentClockLayout.collectAsState() val hasCustomPositionUpdatedAnimation by val hasCustomPositionUpdatedAnimation by clockViewModel.hasCustomPositionUpdatedAnimation.collectAsState() clockViewModel.hasCustomPositionUpdatedAnimation.collectAsState() val currentScene = val currentScene = when (currentClockLayout) { when (currentClockLayout) { KeyguardClockViewModel.ClockLayout.SPLIT_SHADE_LARGE_CLOCK -> KeyguardClockViewModel.ClockLayout.SPLIT_SHADE_LARGE_CLOCK -> Loading @@ -81,86 +66,34 @@ constructor( KeyguardClockViewModel.ClockLayout.SMALL_CLOCK -> smallClockScene KeyguardClockViewModel.ClockLayout.SMALL_CLOCK -> smallClockScene } } val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } val burnIn = rememberBurnIn(clockInteractor) LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } SceneTransitionLayout( SceneTransitionLayout( modifier = modifier.fillMaxSize(), modifier = modifier, currentScene = currentScene, currentScene = currentScene, onChangeScene = {}, onChangeScene = {}, transitions = ClockTransition.defaultClockTransitions, transitions = ClockTransition.defaultClockTransitions, enableInterruptions = false, enableInterruptions = false, ) { ) { scene(splitShadeLargeClockScene) { scene(splitShadeLargeClockScene) { Box(modifier = Modifier.fillMaxSize()) { LargeClockWithSmartSpace( Column( shouldOffSetClockToOneHalf = !hasCustomPositionUpdatedAnimation modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, ) { with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, ) ) } } with(clockSection) { scene(splitShadeSmallClockScene) { LargeClock( SmallClockWithSmartSpace(modifier = Modifier.fillMaxWidth(0.5f)) modifier = Modifier.fillMaxSize().thenIf( !hasCustomPositionUpdatedAnimation ) { // If we do not have a custom position animation, we want // the clock to be on one half of the screen. Modifier.offset { IntOffset( x = -clockSection .getClockCenteringDistance() .toInt(), y = 0, ) } } ) } } } } Row( scene(smallClockScene) { SmallClockWithSmartSpace() } modifier = Modifier.fillMaxSize(), ) { scene(largeClockScene) { LargeClockWithSmartSpace() } Spacer(modifier = Modifier.weight(weight = 1f)) with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } } } } } scene(splitShadeSmallClockScene) { @Composable Row( private fun SceneScope.SmallClockWithSmartSpace(modifier: Modifier = Modifier) { modifier = Modifier.fillMaxSize(), val burnIn = rememberBurnIn(clockInteractor) ) { Column( Column(modifier = modifier) { modifier = Modifier.fillMaxHeight().weight(weight = 1f), horizontalAlignment = Alignment.CenterHorizontally, ) { with(clockSection) { with(clockSection) { SmallClock( SmallClock( burnInParams = burnIn.parameters, burnInParams = burnIn.parameters, Loading @@ -176,49 +109,40 @@ constructor( } } with(mediaCarouselSection) { MediaCarousel() } with(mediaCarouselSection) { MediaCarousel() } } } with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } } @Composable private fun SceneScope.LargeClockWithSmartSpace(shouldOffSetClockToOneHalf: Boolean = false) { val burnIn = rememberBurnIn(clockInteractor) val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } } } scene(smallClockScene) { Column { Column { with(clockSection) { SmallClock( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmallClockTopChanged, modifier = Modifier.wrapContentSize() ) } with(smartSpaceSection) { with(smartSpaceSection) { SmartSpace( SmartSpace( burnInParams = burnIn.parameters, burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, onTopChanged = burnIn.onSmartspaceTopChanged, ) ) } } with(mediaCarouselSection) { MediaCarousel() } with(clockSection) { with(notificationSection) { LargeClock( Notifications(modifier = Modifier.fillMaxWidth().weight(weight = 1f)) modifier = } Modifier.fillMaxSize().thenIf(shouldOffSetClockToOneHalf) { } // If we do not have a custom position animation, we want } // the clock to be on one half of the screen. Modifier.offset { scene(largeClockScene) { IntOffset( Column { x = -clockSection.getClockCenteringDistance().toInt(), with(smartSpaceSection) { y = 0, SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, ) ) } } with(clockSection) { LargeClock(modifier = Modifier.fillMaxSize()) } } } ) } } } } } } Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +28 −2 Original line number Original line Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { ) : ComposableLockscreenSceneBlueprint { override val id: String = "default" override val id: String = "default" Loading @@ -59,6 +66,8 @@ constructor( @Composable @Composable override fun SceneScope.Content(modifier: Modifier) { override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( LockscreenLongPress( viewModel = viewModel.longPress, viewModel = viewModel.longPress, Loading @@ -68,10 +77,27 @@ constructor( content = { content = { // Constrained to above the lock icon. // Constrained to above the lock icon. Column( Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt +27 −2 Original line number Original line Diff line number Diff line Loading @@ -16,10 +16,15 @@ package com.android.systemui.keyguard.ui.composable.blueprint package com.android.systemui.keyguard.ui.composable.blueprint import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect import androidx.compose.ui.unit.IntRect Loading @@ -28,6 +33,7 @@ import com.android.systemui.keyguard.ui.composable.LockscreenLongPress import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.LockSection import com.android.systemui.keyguard.ui.composable.section.NotificationSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.StatusBarSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection import com.android.systemui.keyguard.ui.composable.section.TopAreaSection Loading @@ -52,6 +58,7 @@ constructor( private val bottomAreaSection: BottomAreaSection, private val bottomAreaSection: BottomAreaSection, private val settingsMenuSection: SettingsMenuSection, private val settingsMenuSection: SettingsMenuSection, private val topAreaSection: TopAreaSection, private val topAreaSection: TopAreaSection, private val notificationSection: NotificationSection, ) : ComposableLockscreenSceneBlueprint { ) : ComposableLockscreenSceneBlueprint { override val id: String = "shortcuts-besides-udfps" override val id: String = "shortcuts-besides-udfps" Loading @@ -59,6 +66,8 @@ constructor( @Composable @Composable override fun SceneScope.Content(modifier: Modifier) { override fun SceneScope.Content(modifier: Modifier) { val isUdfpsVisible = viewModel.isUdfpsVisible val isUdfpsVisible = viewModel.isUdfpsVisible val shouldUseSplitNotificationShade by viewModel.shouldUseSplitNotificationShade.collectAsState() LockscreenLongPress( LockscreenLongPress( viewModel = viewModel.longPress, viewModel = viewModel.longPress, Loading @@ -68,11 +77,27 @@ constructor( content = { content = { // Constrained to above the lock icon. // Constrained to above the lock icon. Column( Column( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxSize(), ) { ) { with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) } with(topAreaSection) { DefaultClockLayoutWithNotifications() } Box { with(topAreaSection) { DefaultClockLayout() } if (shouldUseSplitNotificationShade) { with(notificationSection) { Notifications( Modifier.fillMaxWidth(0.5f) .fillMaxHeight() .align(alignment = Alignment.TopEnd) ) } } } if (!shouldUseSplitNotificationShade) { with(notificationSection) { Notifications(Modifier.weight(weight = 1f)) } } if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { with(ambientIndicationSectionOptional.get()) { AmbientIndication(modifier = Modifier.fillMaxWidth()) AmbientIndication(modifier = Modifier.fillMaxWidth()) Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,7 @@ constructor( val burnIn = rememberBurnIn(clockInteractor) val burnIn = rememberBurnIn(clockInteractor) val resources = LocalContext.current.resources val resources = LocalContext.current.resources val currentClockState = clockViewModel.currentClock.collectAsState() val currentClockState = clockViewModel.currentClock.collectAsState() val areNotificationsVisible by viewModel.areNotificationsVisible.collectAsState() LockscreenLongPress( LockscreenLongPress( viewModel = viewModel.longPress, viewModel = viewModel.longPress, modifier = modifier, modifier = modifier, Loading Loading @@ -145,7 +146,7 @@ constructor( with(mediaCarouselSection) { MediaCarousel() } with(mediaCarouselSection) { MediaCarousel() } if (viewModel.areNotificationsVisible) { if (areNotificationsVisible) { with(notificationSection) { with(notificationSection) { Notifications( Notifications( modifier = Modifier.fillMaxWidth().weight(weight = 1f) modifier = Modifier.fillMaxWidth().weight(weight = 1f) Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt +33 −1 Original line number Original line Diff line number Diff line Loading @@ -17,12 +17,25 @@ package com.android.systemui.keyguard.ui.composable.section package com.android.systemui.keyguard.ui.composable.section import android.view.ViewGroup import android.view.ViewGroup import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel import com.android.systemui.notifications.ui.composable.NotificationStack import com.android.systemui.notifications.ui.composable.NotificationStack import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder Loading @@ -39,6 +52,7 @@ constructor( sharedNotificationContainerViewModel: SharedNotificationContainerViewModel, sharedNotificationContainerViewModel: SharedNotificationContainerViewModel, stackScrollLayout: NotificationStackScrollLayout, stackScrollLayout: NotificationStackScrollLayout, sharedNotificationContainerBinder: SharedNotificationContainerBinder, sharedNotificationContainerBinder: SharedNotificationContainerBinder, private val lockscreenContentViewModel: LockscreenContentViewModel, ) { ) { init { init { Loading @@ -65,9 +79,27 @@ constructor( @Composable @Composable fun SceneScope.Notifications(modifier: Modifier = Modifier) { fun SceneScope.Notifications(modifier: Modifier = Modifier) { val shouldUseSplitNotificationShade by lockscreenContentViewModel.shouldUseSplitNotificationShade.collectAsState() val areNotificationsVisible by lockscreenContentViewModel.areNotificationsVisible.collectAsState() val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } if (!areNotificationsVisible) { return } NotificationStack( NotificationStack( viewModel = viewModel, viewModel = viewModel, modifier = modifier, modifier = modifier.fillMaxWidth().thenIf(shouldUseSplitNotificationShade) { Modifier.padding(top = splitShadeTopMargin) }, ) ) } } } }
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt +65 −141 Original line number Original line Diff line number Diff line Loading @@ -16,30 +16,20 @@ package com.android.systemui.keyguard.ui.composable.section package com.android.systemui.keyguard.ui.composable.section import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.SceneScope import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.modifiers.thenIf import com.android.compose.modifiers.thenIf import com.android.systemui.Flags import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene Loading @@ -48,8 +38,6 @@ import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.splitSh import com.android.systemui.keyguard.ui.composable.blueprint.ClockTransition import com.android.systemui.keyguard.ui.composable.blueprint.ClockTransition import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import javax.inject.Inject import javax.inject.Inject class TopAreaSection class TopAreaSection Loading @@ -58,19 +46,16 @@ constructor( private val clockViewModel: KeyguardClockViewModel, private val clockViewModel: KeyguardClockViewModel, private val smartSpaceSection: SmartSpaceSection, private val smartSpaceSection: SmartSpaceSection, private val mediaCarouselSection: MediaCarouselSection, private val mediaCarouselSection: MediaCarouselSection, private val notificationSection: NotificationSection, private val clockSection: DefaultClockSection, private val clockSection: DefaultClockSection, private val clockInteractor: KeyguardClockInteractor, private val clockInteractor: KeyguardClockInteractor, ) { ) { @Composable @Composable fun DefaultClockLayoutWithNotifications( fun DefaultClockLayout( modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() val currentClockLayout by clockViewModel.currentClockLayout.collectAsState() val currentClockLayout by clockViewModel.currentClockLayout.collectAsState() val hasCustomPositionUpdatedAnimation by val hasCustomPositionUpdatedAnimation by clockViewModel.hasCustomPositionUpdatedAnimation.collectAsState() clockViewModel.hasCustomPositionUpdatedAnimation.collectAsState() val currentScene = val currentScene = when (currentClockLayout) { when (currentClockLayout) { KeyguardClockViewModel.ClockLayout.SPLIT_SHADE_LARGE_CLOCK -> KeyguardClockViewModel.ClockLayout.SPLIT_SHADE_LARGE_CLOCK -> Loading @@ -81,86 +66,34 @@ constructor( KeyguardClockViewModel.ClockLayout.SMALL_CLOCK -> smallClockScene KeyguardClockViewModel.ClockLayout.SMALL_CLOCK -> smallClockScene } } val splitShadeTopMargin: Dp = if (Flags.centralizedStatusBarHeightFix()) { LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp } else { dimensionResource(id = R.dimen.large_screen_shade_header_height) } val burnIn = rememberBurnIn(clockInteractor) LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } SceneTransitionLayout( SceneTransitionLayout( modifier = modifier.fillMaxSize(), modifier = modifier, currentScene = currentScene, currentScene = currentScene, onChangeScene = {}, onChangeScene = {}, transitions = ClockTransition.defaultClockTransitions, transitions = ClockTransition.defaultClockTransitions, enableInterruptions = false, enableInterruptions = false, ) { ) { scene(splitShadeLargeClockScene) { scene(splitShadeLargeClockScene) { Box(modifier = Modifier.fillMaxSize()) { LargeClockWithSmartSpace( Column( shouldOffSetClockToOneHalf = !hasCustomPositionUpdatedAnimation modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, ) { with(smartSpaceSection) { SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, ) ) } } with(clockSection) { scene(splitShadeSmallClockScene) { LargeClock( SmallClockWithSmartSpace(modifier = Modifier.fillMaxWidth(0.5f)) modifier = Modifier.fillMaxSize().thenIf( !hasCustomPositionUpdatedAnimation ) { // If we do not have a custom position animation, we want // the clock to be on one half of the screen. Modifier.offset { IntOffset( x = -clockSection .getClockCenteringDistance() .toInt(), y = 0, ) } } ) } } } } Row( scene(smallClockScene) { SmallClockWithSmartSpace() } modifier = Modifier.fillMaxSize(), ) { scene(largeClockScene) { LargeClockWithSmartSpace() } Spacer(modifier = Modifier.weight(weight = 1f)) with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } } } } } scene(splitShadeSmallClockScene) { @Composable Row( private fun SceneScope.SmallClockWithSmartSpace(modifier: Modifier = Modifier) { modifier = Modifier.fillMaxSize(), val burnIn = rememberBurnIn(clockInteractor) ) { Column( Column(modifier = modifier) { modifier = Modifier.fillMaxHeight().weight(weight = 1f), horizontalAlignment = Alignment.CenterHorizontally, ) { with(clockSection) { with(clockSection) { SmallClock( SmallClock( burnInParams = burnIn.parameters, burnInParams = burnIn.parameters, Loading @@ -176,49 +109,40 @@ constructor( } } with(mediaCarouselSection) { MediaCarousel() } with(mediaCarouselSection) { MediaCarousel() } } } with(notificationSection) { Notifications( modifier = Modifier.fillMaxHeight() .weight(weight = 1f) .padding(top = splitShadeTopMargin) ) } } @Composable private fun SceneScope.LargeClockWithSmartSpace(shouldOffSetClockToOneHalf: Boolean = false) { val burnIn = rememberBurnIn(clockInteractor) val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState() LaunchedEffect(isLargeClockVisible) { if (isLargeClockVisible) { burnIn.onSmallClockTopChanged(null) } } } } scene(smallClockScene) { Column { Column { with(clockSection) { SmallClock( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmallClockTopChanged, modifier = Modifier.wrapContentSize() ) } with(smartSpaceSection) { with(smartSpaceSection) { SmartSpace( SmartSpace( burnInParams = burnIn.parameters, burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, onTopChanged = burnIn.onSmartspaceTopChanged, ) ) } } with(mediaCarouselSection) { MediaCarousel() } with(clockSection) { with(notificationSection) { LargeClock( Notifications(modifier = Modifier.fillMaxWidth().weight(weight = 1f)) modifier = } Modifier.fillMaxSize().thenIf(shouldOffSetClockToOneHalf) { } // If we do not have a custom position animation, we want } // the clock to be on one half of the screen. Modifier.offset { scene(largeClockScene) { IntOffset( Column { x = -clockSection.getClockCenteringDistance().toInt(), with(smartSpaceSection) { y = 0, SmartSpace( burnInParams = burnIn.parameters, onTopChanged = burnIn.onSmartspaceTopChanged, ) ) } } with(clockSection) { LargeClock(modifier = Modifier.fillMaxSize()) } } } ) } } } } } } Loading