Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenContent.kt +6 −25 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.keyguard.ui.composable import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.collectAsState Loading @@ -24,9 +23,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalView import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.transitions import com.android.compose.animation.scene.SceneScope 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 Loading @@ -45,16 +42,12 @@ constructor( private val blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>, private val clockInteractor: KeyguardClockInteractor, ) { private val sceneKeyByBlueprint: Map<ComposableLockscreenSceneBlueprint, SceneKey> by lazy { blueprints.associateWith { blueprint -> SceneKey(blueprint.id) } } private val sceneKeyByBlueprintId: Map<String, SceneKey> by lazy { sceneKeyByBlueprint.entries.associate { (blueprint, sceneKey) -> blueprint.id to sceneKey } private val blueprintByBlueprintId: Map<String, ComposableLockscreenSceneBlueprint> by lazy { blueprints.associateBy { it.id } } @Composable fun Content( fun SceneScope.Content( modifier: Modifier = Modifier, ) { val coroutineScope = rememberCoroutineScope() Loading @@ -66,19 +59,7 @@ constructor( onDispose { clockInteractor.clockEventController.unregisterListeners() } } // Switch smoothly between blueprints, any composable tagged with element() will be // transition-animated between any two blueprints, if they both display the same element. SceneTransitionLayout( currentScene = checkNotNull(sceneKeyByBlueprintId[blueprintId]), onChangeScene = {}, transitions = transitions { sceneKeyByBlueprintId.values.forEach { sceneKey -> to(sceneKey) } }, modifier = modifier, enableInterruptions = false, ) { sceneKeyByBlueprint.entries.forEach { (blueprint, sceneKey) -> scene(sceneKey) { with(blueprint) { Content(Modifier.fillMaxSize()) } } } } val blueprint = blueprintByBlueprintId[blueprintId] ?: return with(blueprint) { Content(modifier) } } } packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenScene.kt +1 −5 Original line number Diff line number Diff line Loading @@ -66,9 +66,5 @@ private fun SceneScope.LockscreenScene( key = QuickSettings.SharedValues.TilesSquishiness, ) lockscreenContent .get() .Content( modifier = modifier.fillMaxSize(), ) with(lockscreenContent.get()) { Content(modifier = modifier.fillMaxSize()) } } packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +23 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,9 @@ import androidx.constraintlayout.widget.ConstraintSet.END import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.START import androidx.constraintlayout.widget.ConstraintSet.TOP import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.transitions import com.android.internal.jank.InteractionJankMonitor import com.android.keyguard.KeyguardStatusView import com.android.keyguard.KeyguardStatusViewController Loading Loading @@ -109,6 +112,7 @@ constructor( private var rootViewHandle: DisposableHandle? = null private var indicationAreaHandle: DisposableHandle? = null private val sceneKey = SceneKey("root-view-scene-key") var keyguardStatusViewController: KeyguardStatusViewController? = null get() { Loading Loading @@ -219,12 +223,25 @@ constructor( blueprints.mapNotNull { it as? ComposableLockscreenSceneBlueprint }.toSet() return ComposeView(context).apply { setContent { // STL is used solely to provide a SceneScope to enable us to invoke SceneScope // composables. SceneTransitionLayout( currentScene = sceneKey, onChangeScene = {}, transitions = transitions {}, ) { scene(sceneKey) { with( LockscreenContent( viewModel = viewModel, blueprints = sceneBlueprints, clockInteractor = clockInteractor ) .Content(modifier = Modifier.fillMaxSize()) ) { Content(modifier = Modifier.fillMaxSize()) } } } } } } Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenContent.kt +6 −25 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.keyguard.ui.composable import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.collectAsState Loading @@ -24,9 +23,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalView import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.transitions import com.android.compose.animation.scene.SceneScope 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 Loading @@ -45,16 +42,12 @@ constructor( private val blueprints: Set<@JvmSuppressWildcards ComposableLockscreenSceneBlueprint>, private val clockInteractor: KeyguardClockInteractor, ) { private val sceneKeyByBlueprint: Map<ComposableLockscreenSceneBlueprint, SceneKey> by lazy { blueprints.associateWith { blueprint -> SceneKey(blueprint.id) } } private val sceneKeyByBlueprintId: Map<String, SceneKey> by lazy { sceneKeyByBlueprint.entries.associate { (blueprint, sceneKey) -> blueprint.id to sceneKey } private val blueprintByBlueprintId: Map<String, ComposableLockscreenSceneBlueprint> by lazy { blueprints.associateBy { it.id } } @Composable fun Content( fun SceneScope.Content( modifier: Modifier = Modifier, ) { val coroutineScope = rememberCoroutineScope() Loading @@ -66,19 +59,7 @@ constructor( onDispose { clockInteractor.clockEventController.unregisterListeners() } } // Switch smoothly between blueprints, any composable tagged with element() will be // transition-animated between any two blueprints, if they both display the same element. SceneTransitionLayout( currentScene = checkNotNull(sceneKeyByBlueprintId[blueprintId]), onChangeScene = {}, transitions = transitions { sceneKeyByBlueprintId.values.forEach { sceneKey -> to(sceneKey) } }, modifier = modifier, enableInterruptions = false, ) { sceneKeyByBlueprint.entries.forEach { (blueprint, sceneKey) -> scene(sceneKey) { with(blueprint) { Content(Modifier.fillMaxSize()) } } } } val blueprint = blueprintByBlueprintId[blueprintId] ?: return with(blueprint) { Content(modifier) } } }
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenScene.kt +1 −5 Original line number Diff line number Diff line Loading @@ -66,9 +66,5 @@ private fun SceneScope.LockscreenScene( key = QuickSettings.SharedValues.TilesSquishiness, ) lockscreenContent .get() .Content( modifier = modifier.fillMaxSize(), ) with(lockscreenContent.get()) { Content(modifier = modifier.fillMaxSize()) } }
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +23 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,9 @@ import androidx.constraintlayout.widget.ConstraintSet.END import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.START import androidx.constraintlayout.widget.ConstraintSet.TOP import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneTransitionLayout import com.android.compose.animation.scene.transitions import com.android.internal.jank.InteractionJankMonitor import com.android.keyguard.KeyguardStatusView import com.android.keyguard.KeyguardStatusViewController Loading Loading @@ -109,6 +112,7 @@ constructor( private var rootViewHandle: DisposableHandle? = null private var indicationAreaHandle: DisposableHandle? = null private val sceneKey = SceneKey("root-view-scene-key") var keyguardStatusViewController: KeyguardStatusViewController? = null get() { Loading Loading @@ -219,12 +223,25 @@ constructor( blueprints.mapNotNull { it as? ComposableLockscreenSceneBlueprint }.toSet() return ComposeView(context).apply { setContent { // STL is used solely to provide a SceneScope to enable us to invoke SceneScope // composables. SceneTransitionLayout( currentScene = sceneKey, onChangeScene = {}, transitions = transitions {}, ) { scene(sceneKey) { with( LockscreenContent( viewModel = viewModel, blueprints = sceneBlueprints, clockInteractor = clockInteractor ) .Content(modifier = Modifier.fillMaxSize()) ) { Content(modifier = Modifier.fillMaxSize()) } } } } } } Loading