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

Commit fec71ab0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Respect disable flag in LargeScreenHeader" into tm-dev am: b15f71e2

parents 9ee36d8f b15f71e2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -296,6 +296,8 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
                mShadeController.animateCollapsePanels();
            }
        }

        mNotificationPanelViewController.disable(state1, state2, animate);
    }

    /**
+12 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.phone

import android.app.StatusBarManager
import android.view.View
import androidx.constraintlayout.motion.widget.MotionLayout
import com.android.settingslib.Utils
@@ -68,6 +69,9 @@ class LargeScreenShadeHeaderController @Inject constructor(
    private val iconContainer: StatusIconContainer
    private val carrierIconSlots: List<String>
    private val qsCarrierGroupController: QSCarrierGroupController

    private var qsDisabled = false

    private var visible = false
        set(value) {
            if (field == value) {
@@ -177,6 +181,13 @@ class LargeScreenShadeHeaderController @Inject constructor(
        updateConstraints()
    }

    fun disable(state1: Int, state2: Int, animate: Boolean) {
        val disabled = state2 and StatusBarManager.DISABLE2_QUICK_SETTINGS != 0
        if (disabled == qsDisabled) return
        qsDisabled = disabled
        updateVisibility()
    }

    private fun updateScrollY() {
        if (!active && combinedHeaders) {
            header.scrollY = qsScrollY
@@ -204,7 +215,7 @@ class LargeScreenShadeHeaderController @Inject constructor(
    }

    private fun updateVisibility() {
        val visibility = if (!active && !combinedHeaders) {
        val visibility = if (!active && !combinedHeaders || qsDisabled) {
            View.GONE
        } else if (shadeExpanded) {
            View.VISIBLE
+4 −0
Original line number Diff line number Diff line
@@ -4140,6 +4140,10 @@ public class NotificationPanelViewController extends PanelViewController {
        return mNotificationStackScrollLayoutController;
    }

    public void disable(int state1, int state2, boolean animated) {
        mLargeScreenShadeHeaderController.disable(state1, state2, animated);
    }

    /**
     * Close the keyguard user switcher if it is open and capable of closing.
     *
+18 −0
Original line number Diff line number Diff line
package com.android.systemui.statusbar.phone

import android.app.StatusBarManager
import android.testing.AndroidTestingRunner
import android.view.View
import androidx.test.filters.SmallTest
@@ -116,6 +117,23 @@ class LargeScreenShadeHeaderControllerTest : SysuiTestCase() {
        verify(statusIcons).addIgnoredSlots(carrierIconSlots)
    }

    @Test
    fun disableQS_notDisabled_visible() {
        makeShadeVisible()
        mLargeScreenShadeHeaderController.disable(0, 0, false)

        assertThat(viewVisibility).isEqualTo(View.VISIBLE)
    }

    @Test
    fun disableQS_disabled_gone() {
        makeShadeVisible()
        mLargeScreenShadeHeaderController.disable(0, StatusBarManager.DISABLE2_QUICK_SETTINGS,
            false)

        assertThat(viewVisibility).isEqualTo(View.GONE)
    }

    private fun makeShadeVisible() {
        mLargeScreenShadeHeaderController.active = true
        mLargeScreenShadeHeaderController.shadeExpanded = true