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

Commit b3b3efd3 authored by Shawn Lee's avatar Shawn Lee Committed by Automerger Merge Worker
Browse files

Merge "Adds mobile indicators to QQS header when multiple SIMs are in use"...

Merge "Adds mobile indicators to QQS header when multiple SIMs are in use" into udc-qpr-dev am: 87650418 am: 550a8687

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23767862



Change-Id: I41c1d86c365d87060321bad1dff589964c8fc119
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 187f9fbd 550a8687
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -195,7 +195,9 @@ constructor(
        set(value) {
        set(value) {
            if (visible && field != value) {
            if (visible && field != value) {
                field = value
                field = value
                iconContainer.setQsExpansionTransitioning(value > 0f && value < 1.0f)
                updatePosition()
                updatePosition()
                updateIgnoredSlots()
            }
            }
        }
        }


@@ -216,6 +218,8 @@ constructor(
            view.onApplyWindowInsets(insets)
            view.onApplyWindowInsets(insets)
        }
        }


    private var singleCarrier = false

    private val demoModeReceiver =
    private val demoModeReceiver =
        object : DemoMode {
        object : DemoMode {
            override fun demoCommands() = listOf(DemoMode.COMMAND_CLOCK)
            override fun demoCommands() = listOf(DemoMode.COMMAND_CLOCK)
@@ -479,17 +483,20 @@ constructor(
    private fun updateListeners() {
    private fun updateListeners() {
        mShadeCarrierGroupController.setListening(visible)
        mShadeCarrierGroupController.setListening(visible)
        if (visible) {
        if (visible) {
            updateSingleCarrier(mShadeCarrierGroupController.isSingleCarrier)
            singleCarrier = mShadeCarrierGroupController.isSingleCarrier
            updateIgnoredSlots()
            mShadeCarrierGroupController.setOnSingleCarrierChangedListener {
            mShadeCarrierGroupController.setOnSingleCarrierChangedListener {
                updateSingleCarrier(it)
                singleCarrier = it
                updateIgnoredSlots()
            }
            }
        } else {
        } else {
            mShadeCarrierGroupController.setOnSingleCarrierChangedListener(null)
            mShadeCarrierGroupController.setOnSingleCarrierChangedListener(null)
        }
        }
    }
    }


    private fun updateSingleCarrier(singleCarrier: Boolean) {
    private fun updateIgnoredSlots() {
        if (singleCarrier) {
        // switching from QQS to QS state halfway through the transition
        if (singleCarrier || qsExpandedFraction < 0.5) {
            iconContainer.removeIgnoredSlots(carrierIconSlots)
            iconContainer.removeIgnoredSlots(carrierIconSlots)
        } else {
        } else {
            iconContainer.addIgnoredSlots(carrierIconSlots)
            iconContainer.addIgnoredSlots(carrierIconSlots)
+9 −1
Original line number Original line Diff line number Diff line
@@ -64,6 +64,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
    private boolean mNeedsUnderflow;
    private boolean mNeedsUnderflow;
    // Individual StatusBarIconViews draw their etc dots centered in this width
    // Individual StatusBarIconViews draw their etc dots centered in this width
    private int mIconDotFrameWidth;
    private int mIconDotFrameWidth;
    private boolean mQsExpansionTransitioning;
    private boolean mShouldRestrictIcons = true;
    private boolean mShouldRestrictIcons = true;
    // Used to count which states want to be visible during layout
    // Used to count which states want to be visible during layout
    private ArrayList<StatusIconState> mLayoutStates = new ArrayList<>();
    private ArrayList<StatusIconState> mLayoutStates = new ArrayList<>();
@@ -87,6 +88,10 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
        super.onFinishInflate();
        super.onFinishInflate();
    }
    }


    public void setQsExpansionTransitioning(boolean expansionTransitioning) {
        mQsExpansionTransitioning = expansionTransitioning;
    }

    public void setShouldRestrictIcons(boolean should) {
    public void setShouldRestrictIcons(boolean should) {
        mShouldRestrictIcons = should;
        mShouldRestrictIcons = should;
    }
    }
@@ -386,6 +391,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
            StatusIconState vs = getViewStateFromChild(child);
            StatusIconState vs = getViewStateFromChild(child);
            if (vs != null) {
            if (vs != null) {
                vs.applyToView(child);
                vs.applyToView(child);
                vs.qsExpansionTransitioning = mQsExpansionTransitioning;
            }
            }
        }
        }
    }
    }
@@ -420,6 +426,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
        /// StatusBarIconView.STATE_*
        /// StatusBarIconView.STATE_*
        public int visibleState = STATE_ICON;
        public int visibleState = STATE_ICON;
        public boolean justAdded = true;
        public boolean justAdded = true;
        public boolean qsExpansionTransitioning = false;


        // How far we are from the end of the view actually is the most relevant for animation
        // How far we are from the end of the view actually is the most relevant for animation
        float distanceToViewEnd = -1;
        float distanceToViewEnd = -1;
@@ -462,12 +469,13 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
            }
            }


            icon.setVisibleState(visibleState, animateVisibility);
            icon.setVisibleState(visibleState, animateVisibility);
            if (animationProperties != null) {
            if (animationProperties != null && !qsExpansionTransitioning) {
                animateTo(view, animationProperties);
                animateTo(view, animationProperties);
            } else {
            } else {
                super.applyToView(view);
                super.applyToView(view);
            }
            }


            qsExpansionTransitioning = false;
            justAdded = false;
            justAdded = false;
            distanceToViewEnd = currentDistanceToEnd;
            distanceToViewEnd = currentDistanceToEnd;


+11 −0
Original line number Original line Diff line number Diff line
@@ -237,10 +237,21 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
        whenever(mShadeCarrierGroupController.isSingleCarrier).thenReturn(false)
        whenever(mShadeCarrierGroupController.isSingleCarrier).thenReturn(false)


        makeShadeVisible()
        makeShadeVisible()
        shadeHeaderController.qsExpandedFraction = 1.0f


        verify(statusIcons).addIgnoredSlots(carrierIconSlots)
        verify(statusIcons).addIgnoredSlots(carrierIconSlots)
    }
    }


    @Test
    fun dualCarrier_enablesCarrierIconsInStatusIcons_qsExpanded() {
        whenever(mShadeCarrierGroupController.isSingleCarrier).thenReturn(false)

        makeShadeVisible()
        shadeHeaderController.qsExpandedFraction = 0.0f

        verify(statusIcons, times(2)).removeIgnoredSlots(carrierIconSlots)
    }

    @Test
    @Test
    fun disableQS_notDisabled_visible() {
    fun disableQS_notDisabled_visible() {
        makeShadeVisible()
        makeShadeVisible()