Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 281c870c authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Fix clock being clipped in lockscreen after opening notification shade and unlocking

It happens when topClippingBounds is not set correctly until keyguard
finishes transition to GONE state, because in topClippingBounds in
KeyguardInteractor, we only emit topClippingBounds when it's set in
repository by filtering out GONE is finished in sampleFilter. We need to
reapply topClippingBounds when the change of GONE state is detected to
avoid keyguard being wrongly clipped.

Bug: 348596582
Flag: com.android.systemui.migrate_clocks_to_blueprint
Test: manually test with the steps in the bug description, observe clock
is not clipped / disappears after the change

Change-Id: I459a2ad86e0bd68f903ee46f65f8c66a184b0a45
parent 1f8ddb15
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ import com.android.systemui.statusbar.CommandQueue
import com.android.systemui.statusbar.notification.NotificationUtils.interpolate
import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor
import com.android.systemui.util.kotlin.Utils.Companion.sample as sampleCombine
import com.android.systemui.util.kotlin.Utils.Companion.sampleFilter
import com.android.systemui.util.kotlin.pairwise
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
@@ -250,17 +249,20 @@ constructor(
    val isKeyguardGoingAway: Flow<Boolean> = repository.isKeyguardGoingAway

    /** Keyguard can be clipped at the top as the shade is dragged */
    val topClippingBounds: Flow<Int?> by lazy {
        repository.topClippingBounds
            .sampleFilter(
    val topClippingBounds: Flow<Int?> =
        combineTransform(
                keyguardTransitionInteractor
                    .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE)
                    .onStart { emit(0f) }
            ) { goneValue ->
                goneValue != 1f
                    .map { it == 1f }
                    .onStart { emit(false) }
                    .distinctUntilChanged(),
                repository.topClippingBounds
            ) { isGone, topClippingBounds ->
                if (!isGone) {
                    emit(topClippingBounds)
                }
            .distinctUntilChanged()
            }
            .distinctUntilChanged()

    /** Last point that [KeyguardRootView] view was tapped */
    val lastRootViewTapPosition: Flow<Point?> = repository.lastRootViewTapPosition.asStateFlow()