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

Commit 7c947d64 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge changes from topic "revert-25238254-revert-25203598-JSTZLIMFAD-OSCLKJEMQG" into main

* changes:
  Revert "Revert "NSSL Migration - Animate top padding on shade pu..."
  Revert^2 "Burn in - Don't allow it to enter top inset"
parents 3fe84f27 51751f93
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -20,4 +20,7 @@ package com.android.systemui.common.shared.model
data class SharedNotificationContainerPosition(
    val top: Float = 0f,
    val bottom: Float = 0f,

    /** Whether any modifications to top/bottom are smoothly animated */
    val animate: Boolean = false,
)
+14 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.view.View
import android.view.View.OnLayoutChangeListener
import android.view.ViewGroup
import android.view.ViewGroup.OnHierarchyChangeListener
import android.view.WindowInsets
import android.view.WindowInsets.Type
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.internal.jank.InteractionJankMonitor
@@ -242,11 +244,18 @@ object KeyguardRootViewBinder {
            }
        )

        view.setOnApplyWindowInsetsListener { v: View, insets: WindowInsets ->
            val insetTypes = WindowInsets.Type.systemBars() or WindowInsets.Type.displayCutout()
            viewModel.topInset = insets.getInsetsIgnoringVisibility(insetTypes).top
            insets
        }

        return object : DisposableHandle {
            override fun dispose() {
                disposableHandle.dispose()
                view.removeOnLayoutChangeListener(onLayoutChangeListener)
                view.setOnHierarchyChangeListener(null)
                view.setOnApplyWindowInsetsListener(null)
                childViews.clear()
            }
        }
@@ -288,7 +297,6 @@ object KeyguardRootViewBinder {
            oldBottom: Int
        ) {
            val nsslPlaceholder = v.findViewById(R.id.nssl_placeholder) as View?

            if (nsslPlaceholder != null) {
                // After layout, ensure the notifications are positioned correctly
                viewModel.onSharedNotificationContainerPositionChanged(
@@ -296,6 +304,11 @@ object KeyguardRootViewBinder {
                    nsslPlaceholder.bottom.toFloat(),
                )
            }

            val ksv = v.findViewById(R.id.keyguard_status_view) as View?
            if (ksv != null) {
                viewModel.statusViewTop = ksv.top
            }
        }
    }

+10 −2
Original line number Diff line number Diff line
@@ -65,7 +65,12 @@ constructor(
     */
    private val previewMode = MutableStateFlow(PreviewMode())

    public var clockControllerProvider: Provider<ClockController>? = null
    var clockControllerProvider: Provider<ClockController>? = null

    /** System insets that keyguard needs to stay out of */
    var topInset: Int = 0
    /** Status view top, without translation added in */
    var statusViewTop: Int = 0

    val burnInLayerVisibility: Flow<Int> =
        keyguardTransitionInteractor.startedKeyguardState
@@ -102,9 +107,12 @@ constructor(
                    scale = MathUtils.lerp(burnIn.scale, 1f, 1f - interpolation),
                )
            } else {
                // Ensure the desired translation doesn't encroach on the top inset
                val burnInY = MathUtils.lerp(0, burnIn.translationY, interpolation).toInt()
                val translationY = -(statusViewTop - Math.max(topInset, statusViewTop + burnInY))
                BurnInModel(
                    translationX = MathUtils.lerp(0, burnIn.translationX, interpolation).toInt(),
                    translationY = MathUtils.lerp(0, burnIn.translationY, interpolation).toInt(),
                    translationY = translationY,
                    scale = MathUtils.lerp(burnIn.scale, 1f, 1f - interpolation),
                    scaleClockOnly = true,
                )
+2 −4
Original line number Diff line number Diff line
@@ -59,10 +59,8 @@ object SharedNotificationContainerBinder {

                launch {
                    viewModel.position.collect {
                        controller.updateTopPadding(
                            it.top,
                            controller.isAddOrRemoveAnimationPending()
                        )
                        val animate = it.animate || controller.isAddOrRemoveAnimationPending()
                        controller.updateTopPadding(it.top, animate)
                    }
                }

+10 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.notification.stack.NotificationStackSizeCalculator
import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
@@ -118,8 +119,15 @@ constructor(
                    }
                }
            } else {
                interactor.topPosition.map { top ->
                    keyguardInteractor.sharedNotificationContainerPosition.value.copy(top = top)
                interactor.topPosition.sample(shadeInteractor.qsExpansion, ::Pair).map {
                    (top, qsExpansion) ->
                    // When QS expansion > 0, it should directly set the top padding so do not
                    // animate it
                    val animate = qsExpansion == 0f
                    keyguardInteractor.sharedNotificationContainerPosition.value.copy(
                        top = top,
                        animate = animate
                    )
                }
            }
        }
Loading