Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt +1 −10 Original line number Diff line number Diff line Loading @@ -89,7 +89,6 @@ import kotlin.math.min import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update Loading Loading @@ -381,16 +380,8 @@ object KeyguardRootViewBinder { if (wallpaperFocalAreaViewModel.hasFocalArea.value) { launch { wallpaperFocalAreaViewModel.wallpaperFocalAreaBounds.collect { wallpaperFocalAreaBounds -> wallpaperFocalAreaViewModel.setFocalAreaBounds( wallpaperFocalAreaBounds ) } wallpaperFocalAreaViewModel.setFocalAreaBounds(it) } launch { wallpaperFocalAreaViewModel.wallpaperFocalAreaBounds .filterNotNull() .collect { wallpaperFocalAreaViewModel.setFocalAreaBounds(it) } } } } Loading packages/SystemUI/src/com/android/systemui/wallpapers/ui/viewmodel/WallpaperFocalAreaViewModel.kt +18 −11 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.systemui.wallpapers.domain.interactor.WallpaperFocalAreaInter import javax.inject.Inject import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map class WallpaperFocalAreaViewModel Loading @@ -39,25 +40,31 @@ constructor( val wallpaperFocalAreaBounds = combine( wallpaperFocalAreaInteractor.wallpaperFocalAreaBounds, keyguardTransitionInteractor.startedKeyguardTransitionStep, // Emit transition state when FINISHED instead of STARTED to avoid race with // wakingup command, causing layout change command not be received. keyguardTransitionInteractor .transition( edge = Edge.create(to = Scenes.Lockscreen), edgeWithoutSceneContainer = Edge.create(to = KeyguardState.LOCKSCREEN), ) .filter { transitionStep -> // Should not filter by TransitionState.STARTED, it may race with // wakingup command, causing layout change command not be received. transitionStep.transitionState == TransitionState.FINISHED }, ::Pair, .filter { it.transitionState == TransitionState.FINISHED }, ::Triple, ) .map { (bounds, _) -> bounds } .map { (bounds, startedStep, _) -> // Avoid sending wrong bounds when transitioning from LOCKSCREEN to GONE if ( startedStep.to == KeyguardState.LOCKSCREEN && startedStep.from != KeyguardState.LOCKSCREEN ) { bounds } else { null } } .filterNotNull() fun setFocalAreaBounds(bounds: RectF) { wallpaperFocalAreaInteractor.setFocalAreaBounds(bounds) } fun setTapPosition(x: Float, y: Float) { wallpaperFocalAreaInteractor.setTapPosition(x, y) } } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt +1 −10 Original line number Diff line number Diff line Loading @@ -89,7 +89,6 @@ import kotlin.math.min import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update Loading Loading @@ -381,16 +380,8 @@ object KeyguardRootViewBinder { if (wallpaperFocalAreaViewModel.hasFocalArea.value) { launch { wallpaperFocalAreaViewModel.wallpaperFocalAreaBounds.collect { wallpaperFocalAreaBounds -> wallpaperFocalAreaViewModel.setFocalAreaBounds( wallpaperFocalAreaBounds ) } wallpaperFocalAreaViewModel.setFocalAreaBounds(it) } launch { wallpaperFocalAreaViewModel.wallpaperFocalAreaBounds .filterNotNull() .collect { wallpaperFocalAreaViewModel.setFocalAreaBounds(it) } } } } Loading
packages/SystemUI/src/com/android/systemui/wallpapers/ui/viewmodel/WallpaperFocalAreaViewModel.kt +18 −11 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.systemui.wallpapers.domain.interactor.WallpaperFocalAreaInter import javax.inject.Inject import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map class WallpaperFocalAreaViewModel Loading @@ -39,25 +40,31 @@ constructor( val wallpaperFocalAreaBounds = combine( wallpaperFocalAreaInteractor.wallpaperFocalAreaBounds, keyguardTransitionInteractor.startedKeyguardTransitionStep, // Emit transition state when FINISHED instead of STARTED to avoid race with // wakingup command, causing layout change command not be received. keyguardTransitionInteractor .transition( edge = Edge.create(to = Scenes.Lockscreen), edgeWithoutSceneContainer = Edge.create(to = KeyguardState.LOCKSCREEN), ) .filter { transitionStep -> // Should not filter by TransitionState.STARTED, it may race with // wakingup command, causing layout change command not be received. transitionStep.transitionState == TransitionState.FINISHED }, ::Pair, .filter { it.transitionState == TransitionState.FINISHED }, ::Triple, ) .map { (bounds, _) -> bounds } .map { (bounds, startedStep, _) -> // Avoid sending wrong bounds when transitioning from LOCKSCREEN to GONE if ( startedStep.to == KeyguardState.LOCKSCREEN && startedStep.from != KeyguardState.LOCKSCREEN ) { bounds } else { null } } .filterNotNull() fun setFocalAreaBounds(bounds: RectF) { wallpaperFocalAreaInteractor.setFocalAreaBounds(bounds) } fun setTapPosition(x: Float, y: Float) { wallpaperFocalAreaInteractor.setTapPosition(x, y) } }