Adds mobile indicators to QQS header when multiple SIMs are in use
Current behavior hides mobile indicators from shade header when multiple SIMs are active, only showing them in the ShadeCarrierGroup which is only visible in full QS. This adds the mobile indicators to the shade header when in QQS, and removes them when in QS. The transition here is not ideal - it just uses the default animations for adding/removing icons from the shade header - this is due to MotionLayout calculating the size the icon container should lerp to before the mobile icons are added to it. Bug: 278726045 Test: verified single-sim and multi-sim behavior Change-Id: I16e8f0265369d2f9be62174e30817bda537f9970
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -397,6 +402,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
|
||||
StatusIconState vs = getViewStateFromChild(child);
|
||||
if (vs != null) {
|
||||
vs.applyToView(child);
|
||||
vs.qsExpansionTransitioning = mQsExpansionTransitioning;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,6 +437,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;
|
||||
@@ -473,12 +480,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;
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user