Merge "Allow for HTML styling in mobile data type content descriptions"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 8f9e934..9da7379 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -487,6 +487,9 @@
<!-- Content description of the data connection type 5Ge. [CHAR LIMIT=NONE] -->
<string name="data_connection_5ge" translatable="false">5Ge</string>
+ <!-- Content description of the data connection type 5Ge with HTML styling. DO NOT TRANSLATE [CHAR LIMIT=NONE] -->
+ <string name="data_connection_5ge_html" translate="false"> <i>5G <small>E</small></i> </string>
+
<!-- Content description of the data connection type 5G. [CHAR LIMIT=NONE] -->
<string name="data_connection_5g" translatable="false">5G</string>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroupController.java
index 86fccd7..eb5b4cc 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroupController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroupController.java
@@ -69,8 +69,10 @@
@Override
public void setMobileDataIndicators(NetworkController.IconState statusIcon,
NetworkController.IconState qsIcon, int statusType, int qsType,
- boolean activityIn, boolean activityOut, String typeContentDescription,
- String description, boolean isWide, int subId, boolean roaming) {
+ boolean activityIn, boolean activityOut,
+ CharSequence typeContentDescription,
+ CharSequence typeContentDescriptionHtml, CharSequence description,
+ boolean isWide, int subId, boolean roaming) {
int slotIndex = getSlotIndex(subId);
if (slotIndex >= SIM_SLOTS) {
Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
@@ -83,7 +85,7 @@
mInfos[slotIndex].visible = statusIcon.visible;
mInfos[slotIndex].mobileSignalIconId = statusIcon.icon;
mInfos[slotIndex].contentDescription = statusIcon.contentDescription;
- mInfos[slotIndex].typeContentDescription = typeContentDescription;
+ mInfos[slotIndex].typeContentDescription = typeContentDescription.toString();
mInfos[slotIndex].roaming = roaming;
mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index d5f86c9..436869d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -26,6 +26,7 @@
import android.provider.Settings;
import android.service.quicksettings.Tile;
import android.telephony.SubscriptionManager;
+import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -205,12 +206,13 @@
private CharSequence appendMobileDataType(CharSequence current, CharSequence dataType) {
if (TextUtils.isEmpty(dataType)) {
- return current;
+ return Html.fromHtml(current.toString(), 0);
}
if (TextUtils.isEmpty(current)) {
- return dataType;
+ return Html.fromHtml(dataType.toString(), 0);
}
- return mContext.getString(R.string.mobile_carrier_text_format, current, dataType);
+ String concat = mContext.getString(R.string.mobile_carrier_text_format, current, dataType);
+ return Html.fromHtml(concat, 0);
}
private CharSequence getMobileDataContentName(CallbackInfo cb) {
@@ -251,14 +253,17 @@
@Override
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
- int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
- String description, boolean isWide, int subId, boolean roaming) {
+ int qsType, boolean activityIn, boolean activityOut,
+ CharSequence typeContentDescription,
+ CharSequence typeContentDescriptionHtml, CharSequence description,
+ boolean isWide, int subId, boolean roaming) {
if (qsIcon == null) {
// Not data sim, don't display.
return;
}
mInfo.dataSubscriptionName = mController.getMobileDataNetworkName();
- mInfo.dataContentDescription = (description != null) ? typeContentDescription : null;
+ mInfo.dataContentDescription =
+ (description != null) ? typeContentDescriptionHtml : null;
mInfo.activityIn = activityIn;
mInfo.activityOut = activityOut;
mInfo.roaming = roaming;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
index d2e9262..690d573 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
@@ -177,8 +177,10 @@
@Override
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
- int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
- String description, boolean isWide, int subId, boolean roaming) {
+ int qsType, boolean activityIn, boolean activityOut,
+ CharSequence typeContentDescription,
+ CharSequence typeContentDescriptionHtml, CharSequence description,
+ boolean isWide, int subId, boolean roaming) {
MobileIconState state = getState(subId);
if (state == null) {
return;
@@ -387,7 +389,7 @@
public int typeId;
public boolean roaming;
public boolean needsLeadingPadding;
- public String typeContentDescription;
+ public CharSequence typeContentDescription;
private MobileIconState(int subId) {
super();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java
index e1bb19a..97d348b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java
@@ -111,30 +111,25 @@
public void setWifiIndicators(final boolean enabled, final IconState statusIcon,
final IconState qsIcon, final boolean activityIn, final boolean activityOut,
final String description, boolean isTransient, String secondaryLabel) {
- post(new Runnable() {
- @Override
- public void run() {
- for (SignalCallback callback : mSignalCallbacks) {
- callback.setWifiIndicators(enabled, statusIcon, qsIcon, activityIn, activityOut,
- description, isTransient, secondaryLabel);
- }
+ post(() -> {
+ for (SignalCallback callback : mSignalCallbacks) {
+ callback.setWifiIndicators(enabled, statusIcon, qsIcon, activityIn, activityOut,
+ description, isTransient, secondaryLabel);
}
});
}
@Override
public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon,
- final int statusType, final int qsType,final boolean activityIn,
- final boolean activityOut, final String typeContentDescription,
- final String description, final boolean isWide, final int subId, boolean roaming) {
- post(new Runnable() {
- @Override
- public void run() {
- for (SignalCallback signalCluster : mSignalCallbacks) {
- signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType,
- activityIn, activityOut, typeContentDescription, description, isWide,
- subId, roaming);
- }
+ final int statusType, final int qsType, final boolean activityIn,
+ final boolean activityOut, final CharSequence typeContentDescription,
+ CharSequence typeContentDescriptionHtml, final CharSequence description,
+ final boolean isWide, final int subId, boolean roaming) {
+ post(() -> {
+ for (SignalCallback signalCluster : mSignalCallbacks) {
+ signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType,
+ activityIn, activityOut, typeContentDescription,
+ typeContentDescriptionHtml, description, isWide, subId, roaming);
}
});
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java
index 159bd41..4fbf5ff 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EthernetSignalController.java
@@ -49,7 +49,7 @@
@Override
public void notifyListeners(SignalCallback callback) {
boolean ethernetVisible = mCurrentState.connected;
- String contentDescription = getStringIfExists(getContentDescription());
+ String contentDescription = getTextIfExists(getContentDescription()).toString();
// TODO: wire up data transfer using WifiSignalPoller.
callback.setEthernetIndicators(new IconState(ethernetVisible, getCurrentIconId(),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 28ba125..f6e1681 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -39,6 +39,7 @@
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
@@ -114,9 +115,10 @@
mDefaults = defaults;
mSubscriptionInfo = info;
mPhoneStateListener = new MobilePhoneStateListener((new Handler(receiverLooper))::post);
- mNetworkNameSeparator = getStringIfExists(R.string.status_bar_network_name_separator);
- mNetworkNameDefault = getStringIfExists(
- com.android.internal.R.string.lockscreen_carrier_default);
+ mNetworkNameSeparator = getTextIfExists(R.string.status_bar_network_name_separator)
+ .toString();
+ mNetworkNameDefault = getTextIfExists(
+ com.android.internal.R.string.lockscreen_carrier_default).toString();
mapIconSets();
@@ -153,10 +155,6 @@
updateTelephony();
}
- public int getDataContentDescription() {
- return getIcons().mDataContentDescription;
- }
-
public void setAirplaneMode(boolean airplaneMode) {
mCurrentState.airplaneMode = airplaneMode;
notifyListenersIfNecessary();
@@ -360,8 +358,14 @@
public void notifyListeners(SignalCallback callback) {
MobileIconGroup icons = getIcons();
- String contentDescription = getStringIfExists(getContentDescription());
- String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
+ String contentDescription = getTextIfExists(getContentDescription()).toString();
+ CharSequence dataContentDescriptionHtml = getTextIfExists(icons.mDataContentDescription);
+
+ //TODO: Hacky
+ // The data content description can sometimes be shown in a text view and might come to us
+ // as HTML. Strip any styling here so that listeners don't have to care
+ CharSequence dataContentDescription = Html.fromHtml(
+ dataContentDescriptionHtml.toString(), 0).toString();
if (mCurrentState.inetCondition == 0) {
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
}
@@ -376,7 +380,7 @@
int qsTypeIcon = 0;
IconState qsIcon = null;
- String description = null;
+ CharSequence description = null;
// Only send data sim callbacks to QS.
if (mCurrentState.dataSim) {
qsTypeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.mQsDataType : 0;
@@ -393,8 +397,9 @@
showDataIcon &= mCurrentState.isDefault || dataDisabled;
int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.mDataType : 0;
callback.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon,
- activityIn, activityOut, dataContentDescription, description, icons.mIsWide,
- mSubscriptionInfo.getSubscriptionId(), mCurrentState.roaming);
+ activityIn, activityOut, dataContentDescription, dataContentDescriptionHtml,
+ description, icons.mIsWide, mSubscriptionInfo.getSubscriptionId(),
+ mCurrentState.roaming);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 71db618..95a9772 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -44,6 +44,7 @@
void addEmergencyListener(EmergencyListener listener);
void removeEmergencyListener(EmergencyListener listener);
boolean hasEmergencyCryptKeeperText();
+
boolean isRadioOn();
public interface SignalCallback {
@@ -51,10 +52,31 @@
boolean activityIn, boolean activityOut, String description, boolean isTransient,
String statusLabel) {}
+ /**
+ * Callback for listeners to be able to update the state of any UI tracking connectivity
+ * @param statusIcon the icon that should be shown in the status bar
+ * @param qsIcon the icon to show in Quick Settings
+ * @param statusType the resId of the data type icon (e.g. LTE) to show in the status bar
+ * @param qsType similar to above, the resId of the data type icon to show in Quick Settings
+ * @param activityIn indicates whether there is inbound activity
+ * @param activityOut indicates outbound activity
+ * @param typeContentDescription the contentDescription of the data type
+ * @param typeContentDescriptionHtml the (possibly HTML-styled) contentDescription of the
+ * data type. Suitable for display
+ * @param description description of the network (usually just the network name)
+ * @param isWide //TODO: unused?
+ * @param subId subscription ID for which to update the UI
+ * @param roaming indicates roaming
+ */
default void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
- int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
- String description, boolean isWide, int subId, boolean roaming) {}
+ int qsType, boolean activityIn, boolean activityOut,
+ CharSequence typeContentDescription,
+ CharSequence typeContentDescriptionHtml, CharSequence description,
+ boolean isWide, int subId, boolean roaming) {
+ }
+
default void setSubs(List<SubscriptionInfo> subs) {}
+
default void setNoSims(boolean show, boolean simDetected) {}
default void setEthernetIndicators(IconState icon) {}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 46143ca..4f382e7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -1016,6 +1016,7 @@
datatype.equals("4g") ? TelephonyIcons.FOUR_G :
datatype.equals("4g+") ? TelephonyIcons.FOUR_G_PLUS :
datatype.equals("5g") ? TelephonyIcons.NR_5G :
+ datatype.equals("5ge") ? TelephonyIcons.LTE_CA_5G_E :
datatype.equals("5g+") ? TelephonyIcons.NR_5G_PLUS :
datatype.equals("e") ? TelephonyIcons.E :
datatype.equals("g") ? TelephonyIcons.G :
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
index fc6e5e2..749b56c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
@@ -17,6 +17,7 @@
import static com.android.systemui.statusbar.policy.NetworkControllerImpl.TAG;
+import android.annotation.NonNull;
import android.content.Context;
import android.util.Log;
@@ -166,8 +167,8 @@
/**
* Returns the resource if resId is not 0, and an empty string otherwise.
*/
- protected String getStringIfExists(int resId) {
- return resId != 0 ? mContext.getString(resId) : "";
+ @NonNull CharSequence getTextIfExists(int resId) {
+ return resId != 0 ? mContext.getText(resId) : "";
}
protected I getIcons() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index c22ff8b..d9591cf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -214,7 +214,7 @@
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- R.string.data_connection_5ge,
+ R.string.data_connection_5ge_html,
TelephonyIcons.ICON_5G_E,
true);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
index 6baf36c..8bd0f2c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
@@ -90,7 +90,7 @@
|| !mHasMobileData || visibleWhenEnabled);
String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
- String contentDescription = getStringIfExists(getContentDescription());
+ String contentDescription = getTextIfExists(getContentDescription()).toString();
if (mCurrentState.inetCondition == 0) {
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupControllerTest.java
index 1bfe1b1..715087d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupControllerTest.java
@@ -217,6 +217,6 @@
mSignalCallback.setMobileDataIndicators(
mock(NetworkController.IconState.class),
mock(NetworkController.IconState.class),
- 0, 0, true, true, "", "", true, 0, true);
+ 0, 0, true, true, "", "", "", true, 0, true);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
index 85f6033..18e7840 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
@@ -115,15 +115,16 @@
IconState qs = new IconState(true, 1, "");
boolean in = true;
boolean out = true;
- String typeDescription = "Test 1";
- String description = "Test 2";
+ CharSequence typeDescription = "Test 1";
+ CharSequence typeDescriptionHtml = "<b>Test 1</b>";
+ CharSequence description = "Test 2";
int type = TelephonyIcons.ICON_1X;
int qsType = TelephonyIcons.ICON_1X;
boolean wide = true;
int subId = 5;
boolean roaming = true;
mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription,
- description, wide, subId, roaming);
+ typeDescriptionHtml, description, wide, subId, roaming);
waitForCallbacks();
ArgumentCaptor<IconState> statusArg = ArgumentCaptor.forClass(IconState.class);
@@ -132,14 +133,16 @@
ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
ArgumentCaptor<Boolean> inArg = ArgumentCaptor.forClass(Boolean.class);
ArgumentCaptor<Boolean> outArg = ArgumentCaptor.forClass(Boolean.class);
- ArgumentCaptor<String> typeContentArg = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<String> descArg = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<CharSequence> typeContentArg = ArgumentCaptor.forClass(CharSequence.class);
+ ArgumentCaptor<CharSequence> typeContentHtmlArg =
+ ArgumentCaptor.forClass(CharSequence.class);
+ ArgumentCaptor<CharSequence> descArg = ArgumentCaptor.forClass(CharSequence.class);
ArgumentCaptor<Boolean> wideArg = ArgumentCaptor.forClass(Boolean.class);
ArgumentCaptor<Integer> subIdArg = ArgumentCaptor.forClass(Integer.class);
Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(),
qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(),
- outArg.capture(), typeContentArg.capture(), descArg.capture(), wideArg.capture(),
- subIdArg.capture(), eq(roaming));
+ outArg.capture(), typeContentArg.capture(), typeContentHtmlArg.capture(),
+ descArg.capture(), wideArg.capture(), subIdArg.capture(), eq(roaming));
assertEquals(status, statusArg.getValue());
assertEquals(qs, qsArg.getValue());
assertEquals(type, (int) typeIconArg.getValue());
@@ -147,6 +150,7 @@
assertEquals(in, (boolean) inArg.getValue());
assertEquals(out, (boolean) outArg.getValue());
assertEquals(typeDescription, typeContentArg.getValue());
+ assertEquals(typeDescriptionHtml, typeContentHtmlArg.getValue());
assertEquals(description, descArg.getValue());
assertEquals(wide, (boolean) wideArg.getValue());
assertEquals(subId, (int) subIdArg.getValue());
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 294d546..9a0e97a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -413,7 +413,8 @@
iconArg.capture(),
anyInt(),
typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(),
- anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
+ any(CharSequence.class), any(CharSequence.class), any(CharSequence.class),
+ anyBoolean(), anyInt(), anyBoolean());
IconState iconState = iconArg.getValue();
int state = SignalDrawable.getState(icon, CellSignalStrength.getNumSignalStrengthLevels(),
false);
@@ -445,8 +446,9 @@
iconArg.capture(),
any(),
typeIconArg.capture(),
- anyInt(), anyBoolean(), anyBoolean(), anyString(), anyString(), anyBoolean(),
- anyInt(), eq(roaming));
+ anyInt(), anyBoolean(), anyBoolean(),
+ any(CharSequence.class), any(CharSequence.class), any(CharSequence.class),
+ anyBoolean(), anyInt(), eq(roaming));
IconState iconState = iconArg.getValue();
int state = icon == -1 ? 0
@@ -468,19 +470,23 @@
boolean cutOut) {
verifyLastMobileDataIndicators(
visible, icon, typeIcon, qsVisible, qsIcon, qsTypeIcon, dataIn, dataOut, cutOut,
- null);
+ null, null);
}
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon,
boolean qsVisible, int qsIcon, int qsTypeIcon, boolean dataIn, boolean dataOut,
- boolean cutOut, String typeContentDescription) {
+ boolean cutOut, CharSequence typeContentDescription,
+ CharSequence typeContentDescriptionHtml) {
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
ArgumentCaptor<IconState> qsIconArg = ArgumentCaptor.forClass(IconState.class);
ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
ArgumentCaptor<Boolean> dataInArg = ArgumentCaptor.forClass(Boolean.class);
ArgumentCaptor<Boolean> dataOutArg = ArgumentCaptor.forClass(Boolean.class);
- ArgumentCaptor<String> typeContentDescriptionArg = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<CharSequence> typeContentDescriptionArg =
+ ArgumentCaptor.forClass(CharSequence.class);
+ ArgumentCaptor<CharSequence> typeContentDescriptionHtmlArg =
+ ArgumentCaptor.forClass(CharSequence.class);
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
iconArg.capture(),
@@ -490,6 +496,7 @@
dataInArg.capture(),
dataOutArg.capture(),
typeContentDescriptionArg.capture(),
+ typeContentDescriptionHtmlArg.capture(),
anyString(), anyBoolean(), anyInt(), anyBoolean());
IconState iconState = iconArg.getValue();
@@ -516,6 +523,10 @@
assertEquals("Type content description", typeContentDescription,
typeContentDescriptionArg.getValue());
}
+ if (typeContentDescriptionHtml != null) { // Only check if it was provided
+ assertEquals("Type content description (html)", typeContentDescriptionHtml,
+ typeContentDescriptionHtmlArg.getValue());
+ }
}
protected void assertNetworkNameEquals(String expected) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index 1eb5939..a906d9f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -132,7 +132,7 @@
// Verify that a SignalDrawable with a cut out is used to display data disabled.
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, 0,
true, DEFAULT_QS_SIGNAL_STRENGTH, 0, false,
- false, true, NO_DATA_STRING);
+ false, true, NO_DATA_STRING, NO_DATA_STRING);
}
@Test
@@ -146,7 +146,7 @@
// Verify that a SignalDrawable with a cut out is used to display data disabled.
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, 0,
true, DEFAULT_QS_SIGNAL_STRENGTH, 0, false,
- false, true, NO_DATA_STRING);
+ false, true, NO_DATA_STRING, NO_DATA_STRING);
}
@Test
@@ -161,7 +161,7 @@
// Verify that a SignalDrawable with a cut out is used to display data disabled.
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, 0,
true, DEFAULT_QS_SIGNAL_STRENGTH, 0, false,
- false, false, NOT_DEFAULT_DATA_STRING);
+ false, false, NOT_DEFAULT_DATA_STRING, NOT_DEFAULT_DATA_STRING);
}
@Test
@@ -176,7 +176,7 @@
// Verify that a SignalDrawable with a cut out is used to display data disabled.
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, 0,
true, DEFAULT_QS_SIGNAL_STRENGTH, 0, false,
- false, false, NOT_DEFAULT_DATA_STRING);
+ false, false, NOT_DEFAULT_DATA_STRING, NOT_DEFAULT_DATA_STRING);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index f52c8c1..b922f06 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -369,8 +369,8 @@
mNetworkController.onReceive(mContext, intent);
String defaultNetworkName = mMobileSignalController
- .getStringIfExists(
- com.android.internal.R.string.lockscreen_carrier_default);
+ .getTextIfExists(
+ com.android.internal.R.string.lockscreen_carrier_default).toString();
assertNetworkNameEquals(defaultNetworkName);
}
@@ -383,8 +383,8 @@
mNetworkController.onReceive(mContext, intent);
- String defaultNetworkName = mMobileSignalController.getStringIfExists(
- com.android.internal.R.string.lockscreen_carrier_default);
+ String defaultNetworkName = mMobileSignalController.getTextIfExists(
+ com.android.internal.R.string.lockscreen_carrier_default).toString();
assertNetworkNameEquals(defaultNetworkName);
}
@@ -401,8 +401,8 @@
mNetworkController.onReceive(mContext, intent);
assertNetworkNameEquals(plmn
- + mMobileSignalController.getStringIfExists(
- R.string.status_bar_network_name_separator)
+ + mMobileSignalController.getTextIfExists(
+ R.string.status_bar_network_name_separator).toString()
+ spn);
}