Reapply "SystemUI: Allow Wi-Fi/cell tiles to co-exist with provider model"
This reverts commit 8acab11ae07403837e36f42a1cff2521a5c02295.
Change-Id: I3e06c54a775f69d134985dc9ce4893808789eadb
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
index c4dee7b..715427b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
@@ -308,6 +308,9 @@
if (DEBUG) {
Log.d(TAG, "setWifiIndicators: " + indicators);
}
+ if (!indicators.isDefault) {
+ return;
+ }
synchronized (mWifiInfo) {
mWifiInfo.mEnabled = indicators.enabled;
mWifiInfo.mSsid = indicators.description;
@@ -333,7 +336,7 @@
if (DEBUG) {
Log.d(TAG, "setMobileDataIndicators: " + indicators);
}
- if (indicators.qsIcon == null) {
+ if (indicators.qsIcon == null || !indicators.isDefault) {
// Not data sim, don't display.
return;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java
index 88da372..fca43d57 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java
@@ -324,7 +324,8 @@
qsInfo.description,
mSubscriptionInfo.getSubscriptionId(),
mCurrentState.roaming,
- sbInfo.showTriangle);
+ sbInfo.showTriangle,
+ mCurrentState.isDefault);
callback.setMobileDataIndicators(mobileDataIndicators);
}
@@ -334,11 +335,6 @@
CharSequence qsDescription = null;
if (mCurrentState.dataSim) {
- // only show QS icons if the state is also default
- if (!mCurrentState.isDefault) {
- return new QsInfo(qsTypeIcon, qsIcon, qsDescription);
- }
-
if (mCurrentState.showQuickSettingsRatIcon() || mConfig.alwaysShowDataRatIcon) {
qsTypeIcon = dataTypeIcon;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt
index 6be407a..e9be3c3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/SignalCallback.kt
@@ -113,7 +113,8 @@
@JvmField val activityOut: Boolean,
@JvmField val description: String?,
@JvmField val isTransient: Boolean,
- @JvmField val statusLabel: String?
+ @JvmField val statusLabel: String?,
+ @JvmField val isDefault: Boolean
) {
override fun toString(): String {
return StringBuilder("WifiIndicators[")
@@ -125,6 +126,7 @@
.append(",qsDescription=").append(description)
.append(",isTransient=").append(isTransient)
.append(",statusLabel=").append(statusLabel)
+ .append(",isDefault=").append(isDefault)
.append(']').toString()
}
}
@@ -142,7 +144,8 @@
@JvmField val qsDescription: CharSequence?,
@JvmField val subId: Int,
@JvmField val roaming: Boolean,
- @JvmField val showTriangle: Boolean
+ @JvmField val showTriangle: Boolean,
+ @JvmField val isDefault: Boolean
) {
override fun toString(): String {
return java.lang.StringBuilder("MobileDataIndicators[")
@@ -158,6 +161,7 @@
.append(",subId=").append(subId)
.append(",roaming=").append(roaming)
.append(",showTriangle=").append(showTriangle)
+ .append(",isDefault=").append(isDefault)
.append(']').toString()
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
index 08defcc..dcdd12c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiSignalController.java
@@ -112,18 +112,16 @@
}
IconState statusIcon = new IconState(
wifiVisible, getCurrentIconId(), contentDescription);
- IconState qsIcon = null;
- if (mCurrentState.isDefault || (!mNetworkController.isRadioOn()
- && !mNetworkController.isEthernetDefault())) {
- qsIcon = new IconState(mCurrentState.connected,
- mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected
- : getQsCurrentIconId(), contentDescription);
- }
+ IconState qsIcon = new IconState(mCurrentState.connected,
+ mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected
+ : getQsCurrentIconId(), contentDescription);
+ boolean isDefault = mCurrentState.isDefault || (!mNetworkController.isRadioOn()
+ && !mNetworkController.isEthernetDefault());
WifiIndicators wifiIndicators = new WifiIndicators(
mCurrentState.enabled, statusIcon, qsIcon,
ssidPresent && mCurrentState.activityIn,
ssidPresent && mCurrentState.activityOut,
- wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel
+ wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel, isDefault
);
callback.setWifiIndicators(wifiIndicators);
}
@@ -156,7 +154,8 @@
statusIcon, qsIcon, typeIcon, qsTypeIcon,
mCurrentState.activityIn, mCurrentState.activityOut, dataContentDescription,
dataContentDescriptionHtml, description,
- mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true
+ mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true,
+ /* isDefault= */ qsIcon != null
);
callback.setMobileDataIndicators(mobileDataIndicators);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
index 4c5a214..ce9217f8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
@@ -138,7 +138,7 @@
WifiIndicators indicators = new WifiIndicators(
false, mock(IconState.class),
qsIcon, false, false, "",
- false, "");
+ false, "", true);
mSignalCallback.setWifiIndicators(indicators);
mTestableLooper.processAllMessages();
@@ -152,7 +152,7 @@
WifiIndicators indicators = new WifiIndicators(
true, mock(IconState.class),
qsIcon, false, false, "",
- false, "");
+ false, "", true);
mSignalCallback.setWifiIndicators(indicators);
mTestableLooper.processAllMessages();
@@ -164,7 +164,7 @@
WifiIndicators indicators = new WifiIndicators(
true, mock(IconState.class),
qsIcon, false, false, "",
- false, "");
+ false, "", true);
mSignalCallback.setWifiIndicators(indicators);
mTestableLooper.processAllMessages();
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java
index c1f1964..10a37d8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileTest.java
@@ -158,7 +158,8 @@
/* activityOut= */ false,
/* description= */ null,
/* isTransient= */ false,
- /* statusLabel= */ null
+ /* statusLabel= */ null,
+ /* isDefault= */ true
);
mTile.mSignalCallback.setWifiIndicators(wifiIndicators);
IconState state = new IconState(true, 0, "");
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java
index e7056c7..6d7af01 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java
@@ -300,7 +300,7 @@
MobileDataIndicators indicators = new MobileDataIndicators(
mock(IconState.class),
mock(IconState.class),
- 0, 0, true, true, "", "", "", 0, true, true);
+ 0, 0, true, true, "", "", "", 0, true, true, true);
mSignalCallback.setMobileDataIndicators(indicators);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/CallbackHandlerTest.java
index 44e3bb4..5f3b6aa 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/CallbackHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/CallbackHandlerTest.java
@@ -85,7 +85,7 @@
String description = "Test";
String secondaryLabel = "Secondary label";
WifiIndicators indicators = new WifiIndicators(
- enabled, status, qs, in, out, description, true, secondaryLabel);
+ enabled, status, qs, in, out, description, true, secondaryLabel, true);
mHandler.setWifiIndicators(indicators);
waitForCallbacks();
@@ -120,7 +120,7 @@
boolean roaming = true;
MobileDataIndicators indicators = new MobileDataIndicators(
status, qs, type, qsType, in, out, typeDescription,
- typeDescriptionHtml, description, subId, roaming, true);
+ typeDescriptionHtml, description, subId, roaming, true, true);
mHandler.setMobileDataIndicators(indicators);
waitForCallbacks();