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

Commit 197713b9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "ShadeHeaderCtrl: only apply new window insets"" into main

parents f0f88509 e29ee218
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -255,14 +255,10 @@ constructor(

    private val insetListener =
        View.OnApplyWindowInsetsListener { view, insets ->
            val windowInsets = WindowInsets(insets)
            if (windowInsets != lastInsets) {
            updateConstraintsForInsets(view as MotionLayout, insets)
                lastInsets = windowInsets
            lastInsets = WindowInsets(insets)

            view.onApplyWindowInsets(insets)
            } else {
                insets
            }
        }

    private var singleCarrier = false
@@ -579,9 +575,6 @@ constructor(
            systemIconsHoverContainer.setOnClickListener(null)
            systemIconsHoverContainer.isClickable = false
        }

        lastInsets?.let { updateConstraintsForInsets(header, it) }

        header.jumpToState(header.startState)
        updatePosition()
        updateScrollY()
+0 −37
Original line number Diff line number Diff line
@@ -799,43 +799,6 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
        verify(mockConstraintsChanges.largeScreenConstraintsChanges)!!.invoke(any())
    }

    @Test
    fun sameInsetsTwice_listenerCallsOnApplyWindowInsetsOnlyOnce() {
        val windowInsets = createWindowInsets()

        val captor = ArgumentCaptor.forClass(View.OnApplyWindowInsetsListener::class.java)
        verify(view).setOnApplyWindowInsetsListener(capture(captor))

        val listener = captor.value

        listener.onApplyWindowInsets(view, windowInsets)

        verify(view, times(1)).onApplyWindowInsets(any())

        listener.onApplyWindowInsets(view, windowInsets)

        verify(view, times(1)).onApplyWindowInsets(any())
    }

    @Test
    fun twoDifferentInsets_listenerCallsOnApplyWindowInsetsTwice() {
        val windowInsets1 = WindowInsets(Rect(1, 2, 3, 4))
        val windowInsets2 = WindowInsets(Rect(5, 6, 7, 8))

        val captor = ArgumentCaptor.forClass(View.OnApplyWindowInsetsListener::class.java)
        verify(view).setOnApplyWindowInsetsListener(capture(captor))

        val listener = captor.value

        listener.onApplyWindowInsets(view, windowInsets1)

        verify(view, times(1)).onApplyWindowInsets(any())

        listener.onApplyWindowInsets(view, windowInsets2)

        verify(view, times(2)).onApplyWindowInsets(any())
    }

    @Test
    fun alarmIconNotIgnored() {
        verify(statusIcons, Mockito.never())