Merge "Adds mobile indicators to QQS header when multiple SIMs are in use" into udc-qpr-dev

This commit is contained in:
Shawn Lee
2023-06-27 22:40:18 +00:00
committed by Android (Google) Code Review
3 changed files with 31 additions and 5 deletions

View File

@@ -195,7 +195,9 @@ constructor(
set(value) {
if (visible && field != value) {
field = value
iconContainer.setQsExpansionTransitioning(value > 0f && value < 1.0f)
updatePosition()
updateIgnoredSlots()
}
}
@@ -216,6 +218,8 @@ constructor(
view.onApplyWindowInsets(insets)
}
private var singleCarrier = false
private val demoModeReceiver =
object : DemoMode {
override fun demoCommands() = listOf(DemoMode.COMMAND_CLOCK)
@@ -479,17 +483,20 @@ constructor(
private fun updateListeners() {
mShadeCarrierGroupController.setListening(visible)
if (visible) {
updateSingleCarrier(mShadeCarrierGroupController.isSingleCarrier)
singleCarrier = mShadeCarrierGroupController.isSingleCarrier
updateIgnoredSlots()
mShadeCarrierGroupController.setOnSingleCarrierChangedListener {
updateSingleCarrier(it)
singleCarrier = it
updateIgnoredSlots()
}
} else {
mShadeCarrierGroupController.setOnSingleCarrierChangedListener(null)
}
}
private fun updateSingleCarrier(singleCarrier: Boolean) {
if (singleCarrier) {
private fun updateIgnoredSlots() {
// switching from QQS to QS state halfway through the transition
if (singleCarrier || qsExpandedFraction < 0.5) {
iconContainer.removeIgnoredSlots(carrierIconSlots)
} else {
iconContainer.addIgnoredSlots(carrierIconSlots)

View File

@@ -64,6 +64,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
private boolean mNeedsUnderflow;
// Individual StatusBarIconViews draw their etc dots centered in this width
private int mIconDotFrameWidth;
private boolean mQsExpansionTransitioning;
private boolean mShouldRestrictIcons = true;
// Used to count which states want to be visible during layout
private ArrayList<StatusIconState> mLayoutStates = new ArrayList<>();
@@ -87,6 +88,10 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
super.onFinishInflate();
}
public void setQsExpansionTransitioning(boolean expansionTransitioning) {
mQsExpansionTransitioning = expansionTransitioning;
}
public void setShouldRestrictIcons(boolean should) {
mShouldRestrictIcons = should;
}
@@ -386,6 +391,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
StatusIconState vs = getViewStateFromChild(child);
if (vs != null) {
vs.applyToView(child);
vs.qsExpansionTransitioning = mQsExpansionTransitioning;
}
}
}
@@ -420,6 +426,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
/// StatusBarIconView.STATE_*
public int visibleState = STATE_ICON;
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
float distanceToViewEnd = -1;
@@ -462,12 +469,13 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
}
icon.setVisibleState(visibleState, animateVisibility);
if (animationProperties != null) {
if (animationProperties != null && !qsExpansionTransitioning) {
animateTo(view, animationProperties);
} else {
super.applyToView(view);
}
qsExpansionTransitioning = false;
justAdded = false;
distanceToViewEnd = currentDistanceToEnd;

View File

@@ -237,10 +237,21 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
whenever(mShadeCarrierGroupController.isSingleCarrier).thenReturn(false)
makeShadeVisible()
shadeHeaderController.qsExpandedFraction = 1.0f
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
fun disableQS_notDisabled_visible() {
makeShadeVisible()