Loading packages/SystemUI/compose/facade/enabled/src/com/android/systemui/scene/LockscreenSceneModule.kt +2 −2 Original line number Diff line number Diff line Loading @@ -66,11 +66,11 @@ interface LockscreenSceneModule { @Provides fun providesLockscreenContent( viewModel: LockscreenContentViewModel, viewModelFactory: LockscreenContentViewModel.Factory, blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>, clockInteractor: KeyguardClockInteractor, ): LockscreenContent { return LockscreenContent(viewModel, blueprints, clockInteractor) return LockscreenContent(viewModelFactory, blueprints, clockInteractor) } } } packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenContent.kt +4 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.compose.modifiers.sysuiResTag import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.ui.composable.blueprint.ComposableLockscreenSceneBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel import com.android.systemui.lifecycle.rememberViewModel /** * Renders the content of the lockscreen. Loading @@ -37,7 +38,7 @@ import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel * outside the scene container framework. */ class LockscreenContent( private val viewModel: LockscreenContentViewModel, private val viewModelFactory: LockscreenContentViewModel.Factory, private val blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>, private val clockInteractor: KeyguardClockInteractor, ) { Loading @@ -49,6 +50,7 @@ class LockscreenContent( fun SceneScope.Content( modifier: Modifier = Modifier, ) { val viewModel = rememberViewModel { viewModelFactory.create() } val isContentVisible: Boolean by viewModel.isContentVisible.collectAsStateWithLifecycle() if (!isContentVisible) { // If the content isn't supposed to be visible, show a large empty box as it's needed Loading @@ -69,6 +71,6 @@ class LockscreenContent( } val blueprint = blueprintByBlueprintId[blueprintId] ?: return with(blueprint) { Content(modifier.sysuiResTag("keyguard_root_view")) } with(blueprint) { Content(viewModel, modifier.sysuiResTag("keyguard_root_view")) } } } packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenScene.kt +11 −3 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.animateSceneFloatAsState import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.ui.viewmodel.LockscreenSceneViewModel import com.android.systemui.keyguard.ui.viewmodel.LockscreenSceneActionsViewModel import com.android.systemui.qs.ui.composable.QuickSettings import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.ui.composable.ComposableScene Loading @@ -37,13 +37,21 @@ import kotlinx.coroutines.flow.Flow class LockscreenScene @Inject constructor( viewModel: LockscreenSceneViewModel, actionsViewModelFactory: LockscreenSceneActionsViewModel.Factory, private val lockscreenContent: Lazy<LockscreenContent>, ) : ComposableScene { override val key = Scenes.Lockscreen private val actionsViewModel: LockscreenSceneActionsViewModel by lazy { actionsViewModelFactory.create() } override val destinationScenes: Flow<Map<UserAction, UserActionResult>> = viewModel.destinationScenes actionsViewModel.actions override suspend fun activate() { actionsViewModel.activate() } @Composable override fun SceneScope.Content( Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/CommunalBlueprint.kt +5 −6 Original line number Diff line number Diff line Loading @@ -32,16 +32,15 @@ import dagger.multibindings.IntoSet import javax.inject.Inject /** Renders the lockscreen scene when showing the communal glanceable hub. */ class CommunalBlueprint @Inject constructor( private val viewModel: LockscreenContentViewModel, ) : ComposableLockscreenSceneBlueprint { class CommunalBlueprint @Inject constructor() : ComposableLockscreenSceneBlueprint { override val id: String = "communal" @Composable override fun SceneScope.Content(modifier: Modifier) { override fun SceneScope.Content( viewModel: LockscreenContentViewModel, modifier: Modifier, ) { LockscreenLongPress( viewModel = viewModel.touchHandling, modifier = modifier, Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ComposableLockscreenSceneBlueprint.kt +6 −1 Original line number Diff line number Diff line Loading @@ -20,9 +20,14 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.android.compose.animation.scene.SceneScope import com.android.systemui.keyguard.shared.model.LockscreenSceneBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel /** Defines interface for classes that can render the content for a specific blueprint/layout. */ interface ComposableLockscreenSceneBlueprint : LockscreenSceneBlueprint { /** Renders the content of this blueprint. */ @Composable fun SceneScope.Content(modifier: Modifier) @Composable fun SceneScope.Content( viewModel: LockscreenContentViewModel, modifier: Modifier, ) } Loading
packages/SystemUI/compose/facade/enabled/src/com/android/systemui/scene/LockscreenSceneModule.kt +2 −2 Original line number Diff line number Diff line Loading @@ -66,11 +66,11 @@ interface LockscreenSceneModule { @Provides fun providesLockscreenContent( viewModel: LockscreenContentViewModel, viewModelFactory: LockscreenContentViewModel.Factory, blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>, clockInteractor: KeyguardClockInteractor, ): LockscreenContent { return LockscreenContent(viewModel, blueprints, clockInteractor) return LockscreenContent(viewModelFactory, blueprints, clockInteractor) } } }
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenContent.kt +4 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.compose.modifiers.sysuiResTag import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.ui.composable.blueprint.ComposableLockscreenSceneBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel import com.android.systemui.lifecycle.rememberViewModel /** * Renders the content of the lockscreen. Loading @@ -37,7 +38,7 @@ import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel * outside the scene container framework. */ class LockscreenContent( private val viewModel: LockscreenContentViewModel, private val viewModelFactory: LockscreenContentViewModel.Factory, private val blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>, private val clockInteractor: KeyguardClockInteractor, ) { Loading @@ -49,6 +50,7 @@ class LockscreenContent( fun SceneScope.Content( modifier: Modifier = Modifier, ) { val viewModel = rememberViewModel { viewModelFactory.create() } val isContentVisible: Boolean by viewModel.isContentVisible.collectAsStateWithLifecycle() if (!isContentVisible) { // If the content isn't supposed to be visible, show a large empty box as it's needed Loading @@ -69,6 +71,6 @@ class LockscreenContent( } val blueprint = blueprintByBlueprintId[blueprintId] ?: return with(blueprint) { Content(modifier.sysuiResTag("keyguard_root_view")) } with(blueprint) { Content(viewModel, modifier.sysuiResTag("keyguard_root_view")) } } }
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenScene.kt +11 −3 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.animateSceneFloatAsState import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.ui.viewmodel.LockscreenSceneViewModel import com.android.systemui.keyguard.ui.viewmodel.LockscreenSceneActionsViewModel import com.android.systemui.qs.ui.composable.QuickSettings import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.ui.composable.ComposableScene Loading @@ -37,13 +37,21 @@ import kotlinx.coroutines.flow.Flow class LockscreenScene @Inject constructor( viewModel: LockscreenSceneViewModel, actionsViewModelFactory: LockscreenSceneActionsViewModel.Factory, private val lockscreenContent: Lazy<LockscreenContent>, ) : ComposableScene { override val key = Scenes.Lockscreen private val actionsViewModel: LockscreenSceneActionsViewModel by lazy { actionsViewModelFactory.create() } override val destinationScenes: Flow<Map<UserAction, UserActionResult>> = viewModel.destinationScenes actionsViewModel.actions override suspend fun activate() { actionsViewModel.activate() } @Composable override fun SceneScope.Content( Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/CommunalBlueprint.kt +5 −6 Original line number Diff line number Diff line Loading @@ -32,16 +32,15 @@ import dagger.multibindings.IntoSet import javax.inject.Inject /** Renders the lockscreen scene when showing the communal glanceable hub. */ class CommunalBlueprint @Inject constructor( private val viewModel: LockscreenContentViewModel, ) : ComposableLockscreenSceneBlueprint { class CommunalBlueprint @Inject constructor() : ComposableLockscreenSceneBlueprint { override val id: String = "communal" @Composable override fun SceneScope.Content(modifier: Modifier) { override fun SceneScope.Content( viewModel: LockscreenContentViewModel, modifier: Modifier, ) { LockscreenLongPress( viewModel = viewModel.touchHandling, modifier = modifier, Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ComposableLockscreenSceneBlueprint.kt +6 −1 Original line number Diff line number Diff line Loading @@ -20,9 +20,14 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.android.compose.animation.scene.SceneScope import com.android.systemui.keyguard.shared.model.LockscreenSceneBlueprint import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel /** Defines interface for classes that can render the content for a specific blueprint/layout. */ interface ComposableLockscreenSceneBlueprint : LockscreenSceneBlueprint { /** Renders the content of this blueprint. */ @Composable fun SceneScope.Content(modifier: Modifier) @Composable fun SceneScope.Content( viewModel: LockscreenContentViewModel, modifier: Modifier, ) }