DO NOT MERGE Allow for HTML styling in mobile data type content descriptions
This CL implements a (somewhat hacky) way to enable HTML attributes in the mobile data type content description strings. This way we can use some basic styling in the Quick Settings cellular data tile which uses it in a TextView. We do this by assuming that the content description is valid, escaped HTML, and send two separate CharSequences to all of the listeners, all of which can then decide if they need the regular content description or the prettified version. Test: atest SystemUITests; system ui demo mode Bug: 141177147 Change-Id: Idf387111b0cdc34ad3762eac0ec6c2b484b393e3
This commit is contained in:
@@ -440,6 +440,9 @@
|
|||||||
<!-- Content description of the data connection type 5Ge. [CHAR LIMIT=NONE] -->
|
<!-- Content description of the data connection type 5Ge. [CHAR LIMIT=NONE] -->
|
||||||
<string name="data_connection_5ge" translate="false">5Ge</string>
|
<string name="data_connection_5ge" translate="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] -->
|
<!-- Content description of the data connection type 5G. [CHAR LIMIT=NONE] -->
|
||||||
<string name="data_connection_5g" translate="false">5G</string>
|
<string name="data_connection_5g" translate="false">5G</string>
|
||||||
|
|
||||||
|
|||||||
@@ -207,8 +207,9 @@ public class QSCarrierGroup extends LinearLayout implements
|
|||||||
public void setMobileDataIndicators(NetworkController.IconState statusIcon,
|
public void setMobileDataIndicators(NetworkController.IconState statusIcon,
|
||||||
NetworkController.IconState qsIcon, int statusType,
|
NetworkController.IconState qsIcon, int statusType,
|
||||||
int qsType, boolean activityIn, boolean activityOut,
|
int qsType, boolean activityIn, boolean activityOut,
|
||||||
String typeContentDescription,
|
CharSequence typeContentDescription,
|
||||||
String description, boolean isWide, int subId, boolean roaming) {
|
CharSequence typeContentDescriptionHtml, CharSequence description,
|
||||||
|
boolean isWide, int subId, boolean roaming) {
|
||||||
int slotIndex = getSlotIndex(subId);
|
int slotIndex = getSlotIndex(subId);
|
||||||
if (slotIndex >= SIM_SLOTS) {
|
if (slotIndex >= SIM_SLOTS) {
|
||||||
Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
|
Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
|
||||||
@@ -221,7 +222,7 @@ public class QSCarrierGroup extends LinearLayout implements
|
|||||||
mInfos[slotIndex].visible = statusIcon.visible;
|
mInfos[slotIndex].visible = statusIcon.visible;
|
||||||
mInfos[slotIndex].mobileSignalIconId = statusIcon.icon;
|
mInfos[slotIndex].mobileSignalIconId = statusIcon.icon;
|
||||||
mInfos[slotIndex].contentDescription = statusIcon.contentDescription;
|
mInfos[slotIndex].contentDescription = statusIcon.contentDescription;
|
||||||
mInfos[slotIndex].typeContentDescription = typeContentDescription;
|
mInfos[slotIndex].typeContentDescription = typeContentDescription.toString();
|
||||||
mInfos[slotIndex].roaming = roaming;
|
mInfos[slotIndex].roaming = roaming;
|
||||||
handleUpdateState();
|
handleUpdateState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.content.res.Resources;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -206,12 +207,13 @@ public class CellularTile extends QSTileImpl<SignalState> {
|
|||||||
|
|
||||||
private CharSequence appendMobileDataType(CharSequence current, CharSequence dataType) {
|
private CharSequence appendMobileDataType(CharSequence current, CharSequence dataType) {
|
||||||
if (TextUtils.isEmpty(dataType)) {
|
if (TextUtils.isEmpty(dataType)) {
|
||||||
return current;
|
return Html.fromHtml(current.toString(), 0);
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(current)) {
|
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) {
|
private CharSequence getMobileDataContentName(CallbackInfo cb) {
|
||||||
@@ -252,14 +254,17 @@ public class CellularTile extends QSTileImpl<SignalState> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
int qsType, boolean activityIn, boolean activityOut,
|
||||||
String description, boolean isWide, int subId, boolean roaming) {
|
CharSequence typeContentDescription,
|
||||||
|
CharSequence typeContentDescriptionHtml, CharSequence description,
|
||||||
|
boolean isWide, int subId, boolean roaming) {
|
||||||
if (qsIcon == null) {
|
if (qsIcon == null) {
|
||||||
// Not data sim, don't display.
|
// Not data sim, don't display.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mInfo.dataSubscriptionName = mController.getMobileDataNetworkName();
|
mInfo.dataSubscriptionName = mController.getMobileDataNetworkName();
|
||||||
mInfo.dataContentDescription = (description != null) ? typeContentDescription : null;
|
mInfo.dataContentDescription =
|
||||||
|
(description != null) ? typeContentDescriptionHtml : null;
|
||||||
mInfo.activityIn = activityIn;
|
mInfo.activityIn = activityIn;
|
||||||
mInfo.activityOut = activityOut;
|
mInfo.activityOut = activityOut;
|
||||||
mInfo.roaming = roaming;
|
mInfo.roaming = roaming;
|
||||||
|
|||||||
@@ -177,8 +177,10 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
int qsType, boolean activityIn, boolean activityOut,
|
||||||
String description, boolean isWide, int subId, boolean roaming) {
|
CharSequence typeContentDescription,
|
||||||
|
CharSequence typeContentDescriptionHtml, CharSequence description,
|
||||||
|
boolean isWide, int subId, boolean roaming) {
|
||||||
MobileIconState state = getState(subId);
|
MobileIconState state = getState(subId);
|
||||||
if (state == null) {
|
if (state == null) {
|
||||||
return;
|
return;
|
||||||
@@ -387,7 +389,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
|
|||||||
public int typeId;
|
public int typeId;
|
||||||
public boolean roaming;
|
public boolean roaming;
|
||||||
public boolean needsLeadingPadding;
|
public boolean needsLeadingPadding;
|
||||||
public String typeContentDescription;
|
public CharSequence typeContentDescription;
|
||||||
|
|
||||||
private MobileIconState(int subId) {
|
private MobileIconState(int subId) {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -111,30 +111,25 @@ public class CallbackHandler extends Handler implements EmergencyListener, Signa
|
|||||||
public void setWifiIndicators(final boolean enabled, final IconState statusIcon,
|
public void setWifiIndicators(final boolean enabled, final IconState statusIcon,
|
||||||
final IconState qsIcon, final boolean activityIn, final boolean activityOut,
|
final IconState qsIcon, final boolean activityIn, final boolean activityOut,
|
||||||
final String description, boolean isTransient, String secondaryLabel) {
|
final String description, boolean isTransient, String secondaryLabel) {
|
||||||
post(new Runnable() {
|
post(() -> {
|
||||||
@Override
|
for (SignalCallback callback : mSignalCallbacks) {
|
||||||
public void run() {
|
callback.setWifiIndicators(enabled, statusIcon, qsIcon, activityIn, activityOut,
|
||||||
for (SignalCallback callback : mSignalCallbacks) {
|
description, isTransient, secondaryLabel);
|
||||||
callback.setWifiIndicators(enabled, statusIcon, qsIcon, activityIn, activityOut,
|
|
||||||
description, isTransient, secondaryLabel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon,
|
public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon,
|
||||||
final int statusType, final int qsType,final boolean activityIn,
|
final int statusType, final int qsType, final boolean activityIn,
|
||||||
final boolean activityOut, final String typeContentDescription,
|
final boolean activityOut, final CharSequence typeContentDescription,
|
||||||
final String description, final boolean isWide, final int subId, boolean roaming) {
|
CharSequence typeContentDescriptionHtml, final CharSequence description,
|
||||||
post(new Runnable() {
|
final boolean isWide, final int subId, boolean roaming) {
|
||||||
@Override
|
post(() -> {
|
||||||
public void run() {
|
for (SignalCallback signalCluster : mSignalCallbacks) {
|
||||||
for (SignalCallback signalCluster : mSignalCallbacks) {
|
signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType,
|
||||||
signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType,
|
activityIn, activityOut, typeContentDescription,
|
||||||
activityIn, activityOut, typeContentDescription, description, isWide,
|
typeContentDescriptionHtml, description, isWide, subId, roaming);
|
||||||
subId, roaming);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class EthernetSignalController extends
|
|||||||
@Override
|
@Override
|
||||||
public void notifyListeners(SignalCallback callback) {
|
public void notifyListeners(SignalCallback callback) {
|
||||||
boolean ethernetVisible = mCurrentState.connected;
|
boolean ethernetVisible = mCurrentState.connected;
|
||||||
String contentDescription = getStringIfExists(getContentDescription());
|
String contentDescription = getStringIfExists(getContentDescription()).toString();
|
||||||
|
|
||||||
// TODO: wire up data transfer using WifiSignalPoller.
|
// TODO: wire up data transfer using WifiSignalPoller.
|
||||||
callback.setEthernetIndicators(new IconState(ethernetVisible, getCurrentIconId(),
|
callback.setEthernetIndicators(new IconState(ethernetVisible, getCurrentIconId(),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.telephony.SignalStrength;
|
|||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
@@ -104,9 +105,10 @@ public class MobileSignalController extends SignalController<
|
|||||||
mDefaults = defaults;
|
mDefaults = defaults;
|
||||||
mSubscriptionInfo = info;
|
mSubscriptionInfo = info;
|
||||||
mPhoneStateListener = new MobilePhoneStateListener(receiverLooper);
|
mPhoneStateListener = new MobilePhoneStateListener(receiverLooper);
|
||||||
mNetworkNameSeparator = getStringIfExists(R.string.status_bar_network_name_separator);
|
mNetworkNameSeparator = getStringIfExists(R.string.status_bar_network_name_separator)
|
||||||
|
.toString();
|
||||||
mNetworkNameDefault = getStringIfExists(
|
mNetworkNameDefault = getStringIfExists(
|
||||||
com.android.internal.R.string.lockscreen_carrier_default);
|
com.android.internal.R.string.lockscreen_carrier_default).toString();
|
||||||
|
|
||||||
mapIconSets();
|
mapIconSets();
|
||||||
|
|
||||||
@@ -143,10 +145,6 @@ public class MobileSignalController extends SignalController<
|
|||||||
updateTelephony();
|
updateTelephony();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDataContentDescription() {
|
|
||||||
return getIcons().mDataContentDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAirplaneMode(boolean airplaneMode) {
|
public void setAirplaneMode(boolean airplaneMode) {
|
||||||
mCurrentState.airplaneMode = airplaneMode;
|
mCurrentState.airplaneMode = airplaneMode;
|
||||||
notifyListenersIfNecessary();
|
notifyListenersIfNecessary();
|
||||||
@@ -314,8 +312,14 @@ public class MobileSignalController extends SignalController<
|
|||||||
public void notifyListeners(SignalCallback callback) {
|
public void notifyListeners(SignalCallback callback) {
|
||||||
MobileIconGroup icons = getIcons();
|
MobileIconGroup icons = getIcons();
|
||||||
|
|
||||||
String contentDescription = getStringIfExists(getContentDescription());
|
String contentDescription = getStringIfExists(getContentDescription()).toString();
|
||||||
String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
|
CharSequence dataContentDescriptionHtml = getStringIfExists(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) {
|
if (mCurrentState.inetCondition == 0) {
|
||||||
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
|
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
|
||||||
}
|
}
|
||||||
@@ -330,7 +334,7 @@ public class MobileSignalController extends SignalController<
|
|||||||
|
|
||||||
int qsTypeIcon = 0;
|
int qsTypeIcon = 0;
|
||||||
IconState qsIcon = null;
|
IconState qsIcon = null;
|
||||||
String description = null;
|
CharSequence description = null;
|
||||||
// Only send data sim callbacks to QS.
|
// Only send data sim callbacks to QS.
|
||||||
if (mCurrentState.dataSim) {
|
if (mCurrentState.dataSim) {
|
||||||
qsTypeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.mQsDataType : 0;
|
qsTypeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.mQsDataType : 0;
|
||||||
@@ -347,8 +351,9 @@ public class MobileSignalController extends SignalController<
|
|||||||
showDataIcon &= mCurrentState.isDefault || dataDisabled;
|
showDataIcon &= mCurrentState.isDefault || dataDisabled;
|
||||||
int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.mDataType : 0;
|
int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.mDataType : 0;
|
||||||
callback.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
callback.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
||||||
activityIn, activityOut, dataContentDescription, description, icons.mIsWide,
|
activityIn, activityOut, dataContentDescription, dataContentDescriptionHtml,
|
||||||
mSubscriptionInfo.getSubscriptionId(), mCurrentState.roaming);
|
description, icons.mIsWide, mSubscriptionInfo.getSubscriptionId(),
|
||||||
|
mCurrentState.roaming);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
void addEmergencyListener(EmergencyListener listener);
|
void addEmergencyListener(EmergencyListener listener);
|
||||||
void removeEmergencyListener(EmergencyListener listener);
|
void removeEmergencyListener(EmergencyListener listener);
|
||||||
boolean hasEmergencyCryptKeeperText();
|
boolean hasEmergencyCryptKeeperText();
|
||||||
|
|
||||||
boolean isRadioOn();
|
boolean isRadioOn();
|
||||||
|
|
||||||
public interface SignalCallback {
|
public interface SignalCallback {
|
||||||
@@ -51,10 +52,31 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
boolean activityIn, boolean activityOut, String description, boolean isTransient,
|
boolean activityIn, boolean activityOut, String description, boolean isTransient,
|
||||||
String statusLabel) {}
|
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,
|
default void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
int qsType, boolean activityIn, boolean activityOut,
|
||||||
String description, boolean isWide, int subId, boolean roaming) {}
|
CharSequence typeContentDescription,
|
||||||
|
CharSequence typeContentDescriptionHtml, CharSequence description,
|
||||||
|
boolean isWide, int subId, boolean roaming) {
|
||||||
|
}
|
||||||
|
|
||||||
default void setSubs(List<SubscriptionInfo> subs) {}
|
default void setSubs(List<SubscriptionInfo> subs) {}
|
||||||
|
|
||||||
default void setNoSims(boolean show, boolean simDetected) {}
|
default void setNoSims(boolean show, boolean simDetected) {}
|
||||||
|
|
||||||
default void setEthernetIndicators(IconState icon) {}
|
default void setEthernetIndicators(IconState icon) {}
|
||||||
|
|||||||
@@ -1001,6 +1001,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
datatype.equals("4g") ? TelephonyIcons.FOUR_G :
|
datatype.equals("4g") ? TelephonyIcons.FOUR_G :
|
||||||
datatype.equals("4g+") ? TelephonyIcons.FOUR_G_PLUS :
|
datatype.equals("4g+") ? TelephonyIcons.FOUR_G_PLUS :
|
||||||
datatype.equals("5g") ? TelephonyIcons.NR_5G :
|
datatype.equals("5g") ? TelephonyIcons.NR_5G :
|
||||||
|
datatype.equals("5ge") ? TelephonyIcons.LTE_CA_5G_E :
|
||||||
datatype.equals("5g+") ? TelephonyIcons.NR_5G_PLUS :
|
datatype.equals("5g+") ? TelephonyIcons.NR_5G_PLUS :
|
||||||
datatype.equals("e") ? TelephonyIcons.E :
|
datatype.equals("e") ? TelephonyIcons.E :
|
||||||
datatype.equals("g") ? TelephonyIcons.G :
|
datatype.equals("g") ? TelephonyIcons.G :
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ package com.android.systemui.statusbar.policy;
|
|||||||
|
|
||||||
import static com.android.systemui.statusbar.policy.NetworkControllerImpl.TAG;
|
import static com.android.systemui.statusbar.policy.NetworkControllerImpl.TAG;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -166,8 +167,8 @@ public abstract class SignalController<T extends SignalController.State,
|
|||||||
/**
|
/**
|
||||||
* Returns the resource if resId is not 0, and an empty string otherwise.
|
* Returns the resource if resId is not 0, and an empty string otherwise.
|
||||||
*/
|
*/
|
||||||
protected String getStringIfExists(int resId) {
|
@NonNull CharSequence getStringIfExists(int resId) {
|
||||||
return resId != 0 ? mContext.getString(resId) : "";
|
return resId != 0 ? mContext.getText(resId) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected I getIcons() {
|
protected I getIcons() {
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class TelephonyIcons {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_5ge,
|
R.string.data_connection_5ge_html,
|
||||||
TelephonyIcons.ICON_5G_E,
|
TelephonyIcons.ICON_5G_E,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class WifiSignalController extends
|
|||||||
&& (mCurrentState.connected || !mHasMobileData || visibleWhenEnabled);
|
&& (mCurrentState.connected || !mHasMobileData || visibleWhenEnabled);
|
||||||
String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
|
String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
|
||||||
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
|
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
|
||||||
String contentDescription = getStringIfExists(getContentDescription());
|
String contentDescription = getStringIfExists(getContentDescription()).toString();
|
||||||
if (mCurrentState.inetCondition == 0) {
|
if (mCurrentState.inetCondition == 0) {
|
||||||
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
|
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,6 @@ public class QSCarrierGroupTest extends LeakCheckedTest {
|
|||||||
spiedCarrierGroup.setMobileDataIndicators(
|
spiedCarrierGroup.setMobileDataIndicators(
|
||||||
mock(NetworkController.IconState.class),
|
mock(NetworkController.IconState.class),
|
||||||
mock(NetworkController.IconState.class),
|
mock(NetworkController.IconState.class),
|
||||||
0, 0, true, true, "", "", true, 0, true);
|
0, 0, true, true, "", "", "", true, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,15 +115,16 @@ public class CallbackHandlerTest extends SysuiTestCase {
|
|||||||
IconState qs = new IconState(true, 1, "");
|
IconState qs = new IconState(true, 1, "");
|
||||||
boolean in = true;
|
boolean in = true;
|
||||||
boolean out = true;
|
boolean out = true;
|
||||||
String typeDescription = "Test 1";
|
CharSequence typeDescription = "Test 1";
|
||||||
String description = "Test 2";
|
CharSequence typeDescriptionHtml = "<b>Test 1</b>";
|
||||||
|
CharSequence description = "Test 2";
|
||||||
int type = TelephonyIcons.ICON_1X;
|
int type = TelephonyIcons.ICON_1X;
|
||||||
int qsType = TelephonyIcons.ICON_1X;
|
int qsType = TelephonyIcons.ICON_1X;
|
||||||
boolean wide = true;
|
boolean wide = true;
|
||||||
int subId = 5;
|
int subId = 5;
|
||||||
boolean roaming = true;
|
boolean roaming = true;
|
||||||
mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription,
|
mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription,
|
||||||
description, wide, subId, roaming);
|
typeDescriptionHtml, description, wide, subId, roaming);
|
||||||
waitForCallbacks();
|
waitForCallbacks();
|
||||||
|
|
||||||
ArgumentCaptor<IconState> statusArg = ArgumentCaptor.forClass(IconState.class);
|
ArgumentCaptor<IconState> statusArg = ArgumentCaptor.forClass(IconState.class);
|
||||||
@@ -132,14 +133,16 @@ public class CallbackHandlerTest extends SysuiTestCase {
|
|||||||
ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
|
ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||||
ArgumentCaptor<Boolean> inArg = ArgumentCaptor.forClass(Boolean.class);
|
ArgumentCaptor<Boolean> inArg = ArgumentCaptor.forClass(Boolean.class);
|
||||||
ArgumentCaptor<Boolean> outArg = ArgumentCaptor.forClass(Boolean.class);
|
ArgumentCaptor<Boolean> outArg = ArgumentCaptor.forClass(Boolean.class);
|
||||||
ArgumentCaptor<String> typeContentArg = ArgumentCaptor.forClass(String.class);
|
ArgumentCaptor<CharSequence> typeContentArg = ArgumentCaptor.forClass(CharSequence.class);
|
||||||
ArgumentCaptor<String> descArg = ArgumentCaptor.forClass(String.class);
|
ArgumentCaptor<CharSequence> typeContentHtmlArg =
|
||||||
|
ArgumentCaptor.forClass(CharSequence.class);
|
||||||
|
ArgumentCaptor<CharSequence> descArg = ArgumentCaptor.forClass(CharSequence.class);
|
||||||
ArgumentCaptor<Boolean> wideArg = ArgumentCaptor.forClass(Boolean.class);
|
ArgumentCaptor<Boolean> wideArg = ArgumentCaptor.forClass(Boolean.class);
|
||||||
ArgumentCaptor<Integer> subIdArg = ArgumentCaptor.forClass(Integer.class);
|
ArgumentCaptor<Integer> subIdArg = ArgumentCaptor.forClass(Integer.class);
|
||||||
Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(),
|
Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(),
|
||||||
qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(),
|
qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(),
|
||||||
outArg.capture(), typeContentArg.capture(), descArg.capture(), wideArg.capture(),
|
outArg.capture(), typeContentArg.capture(), typeContentHtmlArg.capture(),
|
||||||
subIdArg.capture(), eq(roaming));
|
descArg.capture(), wideArg.capture(), subIdArg.capture(), eq(roaming));
|
||||||
assertEquals(status, statusArg.getValue());
|
assertEquals(status, statusArg.getValue());
|
||||||
assertEquals(qs, qsArg.getValue());
|
assertEquals(qs, qsArg.getValue());
|
||||||
assertEquals(type, (int) typeIconArg.getValue());
|
assertEquals(type, (int) typeIconArg.getValue());
|
||||||
@@ -147,6 +150,7 @@ public class CallbackHandlerTest extends SysuiTestCase {
|
|||||||
assertEquals(in, (boolean) inArg.getValue());
|
assertEquals(in, (boolean) inArg.getValue());
|
||||||
assertEquals(out, (boolean) outArg.getValue());
|
assertEquals(out, (boolean) outArg.getValue());
|
||||||
assertEquals(typeDescription, typeContentArg.getValue());
|
assertEquals(typeDescription, typeContentArg.getValue());
|
||||||
|
assertEquals(typeDescriptionHtml, typeContentHtmlArg.getValue());
|
||||||
assertEquals(description, descArg.getValue());
|
assertEquals(description, descArg.getValue());
|
||||||
assertEquals(wide, (boolean) wideArg.getValue());
|
assertEquals(wide, (boolean) wideArg.getValue());
|
||||||
assertEquals(subId, (int) subIdArg.getValue());
|
assertEquals(subId, (int) subIdArg.getValue());
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
|||||||
iconArg.capture(),
|
iconArg.capture(),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(),
|
typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(),
|
||||||
anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
|
anyString(), anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
|
||||||
IconState iconState = iconArg.getValue();
|
IconState iconState = iconArg.getValue();
|
||||||
int state = SignalDrawable.getState(icon, SignalStrength.NUM_SIGNAL_STRENGTH_BINS,
|
int state = SignalDrawable.getState(icon, SignalStrength.NUM_SIGNAL_STRENGTH_BINS,
|
||||||
false);
|
false);
|
||||||
@@ -409,8 +409,8 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
|||||||
iconArg.capture(),
|
iconArg.capture(),
|
||||||
any(),
|
any(),
|
||||||
typeIconArg.capture(),
|
typeIconArg.capture(),
|
||||||
anyInt(), anyBoolean(), anyBoolean(), anyString(), anyString(), anyBoolean(),
|
anyInt(), anyBoolean(), anyBoolean(), anyString(), anyString(), anyString(),
|
||||||
anyInt(), eq(roaming));
|
anyBoolean(), anyInt(), eq(roaming));
|
||||||
IconState iconState = iconArg.getValue();
|
IconState iconState = iconArg.getValue();
|
||||||
|
|
||||||
int state = icon == -1 ? 0
|
int state = icon == -1 ? 0
|
||||||
@@ -453,6 +453,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
|||||||
dataInArg.capture(),
|
dataInArg.capture(),
|
||||||
dataOutArg.capture(),
|
dataOutArg.capture(),
|
||||||
typeContentDescriptionArg.capture(),
|
typeContentDescriptionArg.capture(),
|
||||||
|
typeContentDescriptionArg.capture(),
|
||||||
anyString(), anyBoolean(), anyInt(), anyBoolean());
|
anyString(), anyBoolean(), anyInt(), anyBoolean());
|
||||||
|
|
||||||
IconState iconState = iconArg.getValue();
|
IconState iconState = iconArg.getValue();
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
|||||||
|
|
||||||
String defaultNetworkName = mMobileSignalController
|
String defaultNetworkName = mMobileSignalController
|
||||||
.getStringIfExists(
|
.getStringIfExists(
|
||||||
com.android.internal.R.string.lockscreen_carrier_default);
|
com.android.internal.R.string.lockscreen_carrier_default).toString();
|
||||||
assertNetworkNameEquals(defaultNetworkName);
|
assertNetworkNameEquals(defaultNetworkName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
|||||||
mNetworkController.onReceive(mContext, intent);
|
mNetworkController.onReceive(mContext, intent);
|
||||||
|
|
||||||
String defaultNetworkName = mMobileSignalController.getStringIfExists(
|
String defaultNetworkName = mMobileSignalController.getStringIfExists(
|
||||||
com.android.internal.R.string.lockscreen_carrier_default);
|
com.android.internal.R.string.lockscreen_carrier_default).toString();
|
||||||
assertNetworkNameEquals(defaultNetworkName);
|
assertNetworkNameEquals(defaultNetworkName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
|||||||
|
|
||||||
assertNetworkNameEquals(plmn
|
assertNetworkNameEquals(plmn
|
||||||
+ mMobileSignalController.getStringIfExists(
|
+ mMobileSignalController.getStringIfExists(
|
||||||
R.string.status_bar_network_name_separator)
|
R.string.status_bar_network_name_separator).toString()
|
||||||
+ spn);
|
+ spn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user