diff options
| author | 2024-07-09 18:38:33 +0000 | |
|---|---|---|
| committer | 2024-07-09 18:38:33 +0000 | |
| commit | f05e0f2ffbbe27f1d1388ee96c76a4c7fa3376b5 (patch) | |
| tree | aa2be112c169d4163487b5c5f7650267bb0d463e | |
| parent | fbe143377074e1448414f650a6acdcb0315f8353 (diff) | |
| parent | 22497a5e712712bce7d25688daf2bbbd8fc66d6a (diff) | |
Merge "Move topClippingBounds to main immediate dispatcher" into main
3 files changed, 32 insertions, 17 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt index 608e25a82eff..33f9209fea09 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt @@ -42,6 +42,7 @@ import com.android.systemui.CoreStartable import com.android.systemui.biometrics.ui.binder.DeviceEntryUnlockTrackerViewBinder import com.android.systemui.common.ui.ConfigurationState import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.deviceentry.domain.interactor.DeviceEntryHapticsInteractor import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor @@ -73,6 +74,7 @@ import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import dagger.Lazy import java.util.Optional import javax.inject.Inject +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -108,6 +110,7 @@ constructor( private val clockInteractor: KeyguardClockInteractor, private val keyguardViewMediator: KeyguardViewMediator, private val deviceEntryUnlockTrackerViewBinder: Optional<DeviceEntryUnlockTrackerViewBinder>, + @Main private val mainDispatcher: CoroutineDispatcher, ) : CoreStartable { private var rootViewHandle: DisposableHandle? = null @@ -215,6 +218,7 @@ constructor( vibratorHelper, falsingManager, keyguardViewMediator, + mainDispatcher, ) } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt index 8f149fbe99de..f96f053b8da1 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt @@ -37,6 +37,7 @@ import androidx.activity.setViewTreeOnBackPressedDispatcherOwner import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.animation.Interpolators +import com.android.app.tracing.coroutines.launch import com.android.internal.jank.InteractionJankMonitor import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD import com.android.systemui.Flags.newAodTransition @@ -80,6 +81,7 @@ import com.android.systemui.util.ui.isAnimating import com.android.systemui.util.ui.stopAnimating import com.android.systemui.util.ui.value import kotlin.math.min +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.coroutineScope @@ -110,6 +112,7 @@ object KeyguardRootViewBinder { vibratorHelper: VibratorHelper?, falsingManager: FalsingManager?, keyguardViewMediator: KeyguardViewMediator?, + mainImmediateDispatcher: CoroutineDispatcher, ): DisposableHandle { val disposables = DisposableHandles() val childViews = mutableMapOf<Int, View>() @@ -128,6 +131,30 @@ object KeyguardRootViewBinder { val burnInParams = MutableStateFlow(BurnInParameters()) val viewState = ViewStateAccessor(alpha = { view.alpha }) + + disposables += + view.repeatWhenAttached(mainImmediateDispatcher) { + repeatOnLifecycle(Lifecycle.State.CREATED) { + if (MigrateClocksToBlueprint.isEnabled) { + launch("$TAG#topClippingBounds") { + val clipBounds = Rect() + viewModel.topClippingBounds.collect { clipTop -> + if (clipTop == null) { + view.setClipBounds(null) + } else { + clipBounds.apply { + top = clipTop + left = view.getLeft() + right = view.getRight() + bottom = view.getBottom() + } + view.setClipBounds(clipBounds) + } + } + } + } + } + } disposables += view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.CREATED) { @@ -192,23 +219,6 @@ object KeyguardRootViewBinder { } launch { - val clipBounds = Rect() - viewModel.topClippingBounds.collect { clipTop -> - if (clipTop == null) { - view.setClipBounds(null) - } else { - clipBounds.apply { - top = clipTop - left = view.getLeft() - right = view.getRight() - bottom = view.getBottom() - } - view.setClipBounds(clipBounds) - } - } - } - - launch { viewModel.lockscreenStateAlpha(viewState).collect { alpha -> childViews[statusViewId]?.alpha = alpha } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt index 4f0ac42a0e87..bc5b7b923082 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt @@ -394,6 +394,7 @@ constructor( null, // device entry haptics not required for preview mode null, // falsing manager not required for preview mode null, // keyguard view mediator is not required for preview mode + mainDispatcher, ) } rootView.addView( |