diff options
| author | 2024-05-20 22:40:36 +0000 | |
|---|---|---|
| committer | 2024-05-20 22:40:36 +0000 | |
| commit | 04a26d5e106ee2414efbb4ec9699c8c079f17986 (patch) | |
| tree | 88cbf1f6f3e2e0d72adbc7b93b1c404dfd08d6db | |
| parent | 8fd4d3eaec7c19bc409ffcb8728ef3f26b2a6c5a (diff) | |
| parent | 3ce5f030e2db605f163e8eaa74e136ec1108d787 (diff) | |
Merge "Remove AOD clock combine call to improve perf" into main
2 files changed, 13 insertions, 19 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt index c846cbe76770..f2821a0f49d2 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardClockViewBinder.kt @@ -37,7 +37,6 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.clocks.AodClockBurnInModel import com.android.systemui.plugins.clocks.ClockController -import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch object KeyguardClockViewBinder { @@ -113,24 +112,17 @@ object KeyguardClockViewBinder { launch { if (!MigrateClocksToBlueprint.isEnabled) return@launch - combine( - rootViewModel.translationX, - rootViewModel.translationY, - rootViewModel.scale, - ::Triple - ) - .collect { (translationX, translationY, scale) -> - viewModel.currentClock.value - ?.largeClock - ?.layout - ?.applyAodBurnIn( - AodClockBurnInModel( - translationX = translationX.value!!, - translationY = translationY, - scale = scale.scale - ) + rootViewModel.burnInModel.collect { burnInModel -> + viewModel.currentClock.value?.let { + it.largeClock.layout.applyAodBurnIn( + AodClockBurnInModel( + translationX = burnInModel.translationX.toFloat(), + translationY = burnInModel.translationY.toFloat(), + scale = burnInModel.scale ) + ) } + } } } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt index f405b9d5a07c..f8a9310e091f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt @@ -58,6 +58,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combineTransform import kotlinx.coroutines.flow.distinctUntilChanged @@ -117,7 +118,8 @@ constructor( private val shadeInteractor: ShadeInteractor, ) { private var burnInJob: Job? = null - internal val burnInModel = MutableStateFlow(BurnInModel()) + private val _burnInModel = MutableStateFlow(BurnInModel()) + val burnInModel = _burnInModel.asStateFlow() val burnInLayerVisibility: Flow<Int> = keyguardTransitionInteractor.startedKeyguardState @@ -279,7 +281,7 @@ constructor( burnInJob = scope.launch("$TAG#aodBurnInViewModel") { - aodBurnInViewModel.movement(params).collect { burnInModel.value = it } + aodBurnInViewModel.movement(params).collect { _burnInModel.value = it } } } |