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

Commit 73444553 authored by Hawkwood Glazier's avatar Hawkwood Glazier
Browse files

Refresh Notification Shelf layout when it becomes visible

Bug: 363260606
Test: Manual; presumbits
Flag: com.android.systemui.migrate_clocks_to_blueprint
Change-Id: Ifcf15c1860697826407f7e9a2e6122dbe35e55cd
parent 3c0b650a
Loading
Loading
Loading
Loading
+18 −21
Original line number Diff line number Diff line
@@ -261,10 +261,7 @@ object KeyguardRootViewBinder {
                            ->
                            if (biometricMessage?.message != null) {
                                chipbarCoordinator!!.displayView(
                                    createChipbarInfo(
                                        biometricMessage.message,
                                        R.drawable.ic_lock,
                                    )
                                    createChipbarInfo(biometricMessage.message, R.drawable.ic_lock)
                                )
                            } else {
                                chipbarCoordinator!!.removeView(ID, "occludingAppMsgNull")
@@ -327,6 +324,9 @@ object KeyguardRootViewBinder {
                                    .getDimensionPixelSize(R.dimen.shelf_appear_translation)
                                    .stateIn(this)
                            viewModel.isNotifIconContainerVisible.collect { isVisible ->
                                if (isVisible.value) {
                                    blueprintViewModel.refreshBlueprint()
                                } else {
                                    childViews[aodNotificationIconContainerId]
                                        ?.setAodNotifIconContainerIsVisible(
                                            isVisible,
@@ -335,6 +335,7 @@ object KeyguardRootViewBinder {
                                        )
                                }
                            }
                        }

                        interactionJankMonitor?.let { jankMonitor ->
                            launch {
@@ -382,7 +383,7 @@ object KeyguardRootViewBinder {
                                if (msdlFeedback()) {
                                    msdlPlayer?.playToken(
                                        MSDLToken.UNLOCK,
                                        authInteractionProperties
                                        authInteractionProperties,
                                    )
                                } else {
                                    vibratorHelper.performHapticFeedback(
@@ -398,7 +399,7 @@ object KeyguardRootViewBinder {
                                if (msdlFeedback()) {
                                    msdlPlayer?.playToken(
                                        MSDLToken.FAILURE,
                                        authInteractionProperties
                                        authInteractionProperties,
                                    )
                                } else {
                                    vibratorHelper.performHapticFeedback(
@@ -425,7 +426,7 @@ object KeyguardRootViewBinder {
                    blueprintViewModel,
                    clockViewModel,
                    childViews,
                    burnInParams
                    burnInParams,
                )
            )

@@ -464,11 +465,7 @@ object KeyguardRootViewBinder {
     */
    private fun createChipbarInfo(message: String, @DrawableRes icon: Int): ChipbarInfo {
        return ChipbarInfo(
            startIcon =
                TintedIcon(
                    Icon.Resource(icon, null),
                    ChipbarInfo.DEFAULT_ICON_TINT,
                ),
            startIcon = TintedIcon(Icon.Resource(icon, null), ChipbarInfo.DEFAULT_ICON_TINT),
            text = Text.Loaded(message),
            endItem = null,
            vibrationEffect = null,
@@ -499,7 +496,7 @@ object KeyguardRootViewBinder {
            oldLeft: Int,
            oldTop: Int,
            oldRight: Int,
            oldBottom: Int
            oldBottom: Int,
        ) {
            // After layout, ensure the notifications are positioned correctly
            childViews[nsslPlaceholderId]?.let { notificationListPlaceholder ->
@@ -515,7 +512,7 @@ object KeyguardRootViewBinder {
                viewModel.onNotificationContainerBoundsChanged(
                    notificationListPlaceholder.top.toFloat(),
                    notificationListPlaceholder.bottom.toFloat(),
                    animate = shouldAnimate
                    animate = shouldAnimate,
                )
            }

@@ -531,7 +528,7 @@ object KeyguardRootViewBinder {
                                        Int.MAX_VALUE
                                    } else {
                                        view.getTop()
                                    }
                                    },
                                )
                            }
                        } else {
+8 −7
Original line number Diff line number Diff line
@@ -25,20 +25,18 @@ import androidx.constraintlayout.widget.ConstraintLayout
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Config
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Type
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow

data class TransitionData(
    val config: Config,
    val start: Long = System.currentTimeMillis(),
)
data class TransitionData(val config: Config, val start: Long = System.currentTimeMillis())

class KeyguardBlueprintViewModel
@Inject
constructor(
    @Main private val handler: Handler,
    keyguardBlueprintInteractor: KeyguardBlueprintInteractor,
    private val keyguardBlueprintInteractor: KeyguardBlueprintInteractor,
) {
    val blueprint = keyguardBlueprintInteractor.blueprint
    val blueprintId = keyguardBlueprintInteractor.blueprintId
@@ -76,6 +74,9 @@ constructor(
            }
        }

    fun refreshBlueprint(type: Type = Type.NoTransition) =
        keyguardBlueprintInteractor.refreshBlueprint(type)

    fun updateTransitions(data: TransitionData?, mutate: MutableSet<Transition>.() -> Unit) {
        runningTransitions.mutate()

@@ -95,7 +96,7 @@ constructor(
                Log.w(
                    TAG,
                    "runTransition: skipping ${transition::class.simpleName}: " +
                        "currentPriority=$currentPriority; config=$config"
                        "currentPriority=$currentPriority; config=$config",
                )
            }
            apply()
@@ -106,7 +107,7 @@ constructor(
            Log.i(
                TAG,
                "runTransition: running ${transition::class.simpleName}: " +
                    "currentPriority=$currentPriority; config=$config"
                    "currentPriority=$currentPriority; config=$config",
            )
        }