Add 5G evolution icon
This add the 5GE icon to the system UI for specific carriers
LTE CA network.
Bug: 124768697
Test: build & manually test:
fake the operator name with pattern, and check the status bar data icon.
Change-Id: Ife0401219138c7ed22e7bfbd4d5e8648c54a98a8
Merged-In: Ife0401219138c7ed22e7bfbd4d5e8648c54a98a8
diff --git a/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml b/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml
new file mode 100644
index 0000000..fe1bb26
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml
@@ -0,0 +1,31 @@
+<!--
+ Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:viewportWidth="22"
+ android:viewportHeight="17"
+ android:width="22dp"
+ android:height="17dp">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M1.22,8.49l0.43-4.96h4.33v1.17H2.67L2.44,7.41c0.41-0.29,0.85-0.43,1.33-0.43c0.77,0,1.38,0.3,1.83,0.9 s0.66,1.41,0.66,2.43c0,1.03-0.24,1.84-0.72,2.43s-1.14,0.88-1.98,0.88c-0.75,0-1.36-0.24-1.83-0.73s-0.74-1.16-0.81-2.02h1.13 c0.07,0.57,0.23,1,0.49,1.29c0.26,0.29,0.59,0.43,1.01,0.43c0.47,0,0.84-0.2,1.1-0.61c0.26-0.41,0.4-0.96,0.4-1.65 c0-0.65-0.14-1.18-0.43-1.59S3.96,8.11,3.47,8.11c-0.4,0-0.72,0.1-0.96,0.31L2.19,8.75L1.22,8.49z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M14.14,12.24l-0.22,0.27c-0.63,0.73-1.55,1.1-2.76,1.1c-1.08,0-1.92-0.36-2.53-1.07c-0.61-0.71-0.93-1.72-0.94-3.02V7.56 c0-1.39,0.28-2.44,0.84-3.13c0.56-0.7,1.39-1.04,2.51-1.04c0.95,0,1.69,0.26,2.23,0.79c0.54,0.53,0.83,1.28,0.89,2.26h-1.25 c-0.05-0.62-0.22-1.1-0.52-1.45c-0.29-0.35-0.74-0.52-1.34-0.52c-0.72,0-1.24,0.23-1.57,0.7C9.14,5.63,8.96,6.37,8.95,7.4v2.03 c0,1,0.19,1.77,0.57,2.31c0.38,0.54,0.93,0.8,1.65,0.8c0.67,0,1.19-0.16,1.54-0.49l0.18-0.17V9.59h-1.82V8.52h3.07V12.24z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M20.96,8.88h-3.52v3.53h4.1v1.07h-5.35V3.52h5.28V4.6h-4.03V7.8h3.52V8.88z" />
+
+</vector>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 4437f49..ccf345b 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -390,6 +390,9 @@
<!-- Content description of the data connection type LTE+. [CHAR LIMIT=NONE] -->
<string name="data_connection_lte_plus">LTE+</string>
+ <!-- Content description of the data connection type 5Ge. [CHAR LIMIT=NONE] -->
+ <string name="data_connection_5ge" translate="false">5Ge</string>
+
<!-- Content description of the data connection type 5G. [CHAR LIMIT=NONE] -->
<string name="data_connection_5g" translate="false">5G</string>
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 2f7e3b18..b7c20aa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -46,6 +46,8 @@
import java.io.PrintWriter;
import java.util.BitSet;
import java.util.Objects;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class MobileSignalController extends SignalController<
@@ -72,6 +74,8 @@
private SignalStrength mSignalStrength;
private MobileIconGroup mDefaultIcons;
private Config mConfig;
+ // Some specific carriers have 5GE network which is special LTE CA network.
+ private static final int NETWORK_TYPE_LTE_CA_5GE = TelephonyManager.MAX_NETWORK_TYPE + 1;
// TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't
// need listener lists anymore.
@@ -235,6 +239,8 @@
TelephonyIcons.LTE_PLUS);
}
}
+ mNetworkToIconLookup.put(NETWORK_TYPE_LTE_CA_5GE,
+ TelephonyIcons.LTE_CA_5G_E);
mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_IWLAN, TelephonyIcons.WFC);
}
@@ -400,6 +406,26 @@
}
}
+ private boolean isCarrierSpecificDataIcon() {
+ if (mConfig.patternOfCarrierSpecificDataIcon == null
+ || mConfig.patternOfCarrierSpecificDataIcon.length() == 0) {
+ return false;
+ }
+
+ Pattern stringPattern = Pattern.compile(mConfig.patternOfCarrierSpecificDataIcon);
+ String[] operatorNames = new String[]{mServiceState.getOperatorAlphaLongRaw(),
+ mServiceState.getOperatorAlphaShortRaw()};
+ for (String opName : operatorNames) {
+ if (!TextUtils.isEmpty(opName)) {
+ Matcher matcher = stringPattern.matcher(opName);
+ if (matcher.find()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
/**
* Updates the network's name based on incoming spn and plmn.
*/
@@ -566,12 +592,8 @@
+ " dataState=" + state.getDataRegState());
}
mServiceState = state;
- if (state != null) {
- mDataNetType = state.getDataNetworkType();
- if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE && mServiceState != null &&
- mServiceState.isUsingCarrierAggregation()) {
- mDataNetType = TelephonyManager.NETWORK_TYPE_LTE_CA;
- }
+ if (mServiceState != null) {
+ updateDataNetType(mServiceState.getDataNetworkType());
}
updateTelephony();
}
@@ -583,14 +605,21 @@
+ " type=" + networkType);
}
mDataState = state;
- mDataNetType = networkType;
- if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE && mServiceState != null &&
- mServiceState.isUsingCarrierAggregation()) {
- mDataNetType = TelephonyManager.NETWORK_TYPE_LTE_CA;
- }
+ updateDataNetType(networkType);
updateTelephony();
}
+ private void updateDataNetType(int networkType) {
+ mDataNetType = networkType;
+ if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE) {
+ if (isCarrierSpecificDataIcon()) {
+ mDataNetType = NETWORK_TYPE_LTE_CA_5GE;
+ } else if (mServiceState != null && mServiceState.isUsingCarrierAggregation()) {
+ mDataNetType = TelephonyManager.NETWORK_TYPE_LTE_CA;
+ }
+ }
+ }
+
@Override
public void onDataActivity(int direction) {
if (DEBUG) {
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 b4f0fec..5c6634c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -1084,6 +1084,7 @@
boolean hspaDataDistinguishable;
boolean inflateSignalStrengths = false;
boolean alwaysShowDataRatIcon = false;
+ public String patternOfCarrierSpecificDataIcon = "";
/**
* Mapping from NR 5G status string to an integer. The NR 5G status string should match
@@ -1122,6 +1123,8 @@
CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
config.hideLtePlus = b.getBoolean(
CarrierConfigManager.KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL);
+ config.patternOfCarrierSpecificDataIcon = b.getString(
+ CarrierConfigManager.KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING);
String nr5GIconConfiguration =
b.getString(CarrierConfigManager.KEY_5G_ICON_CONFIGURATION_STRING);
if (!TextUtils.isEmpty(nr5GIconConfiguration)) {
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 7347f66..2c4b1f9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -35,6 +35,7 @@
static final int ICON_3G = R.drawable.ic_3g_mobiledata;
static final int ICON_4G = R.drawable.ic_4g_mobiledata;
static final int ICON_4G_PLUS = R.drawable.ic_4g_plus_mobiledata;
+ static final int ICON_5G_E = R.drawable.ic_5g_e_mobiledata;
static final int ICON_1X = R.drawable.ic_1x_mobiledata;
static final int ICON_5G = R.drawable.ic_5g_mobiledata;
static final int ICON_5G_PLUS = R.drawable.ic_5g_plus_mobiledata;
@@ -204,6 +205,19 @@
TelephonyIcons.ICON_LTE_PLUS,
true);
+ static final MobileIconGroup LTE_CA_5G_E = new MobileIconGroup(
+ "5Ge",
+ null,
+ null,
+ AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
+ 0, 0,
+ 0,
+ 0,
+ AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
+ R.string.data_connection_5ge,
+ TelephonyIcons.ICON_5G_E,
+ true);
+
static final MobileIconGroup NR_5G = new MobileIconGroup(
"5G",
null,
@@ -260,6 +274,7 @@
ICON_NAME_TO_ICON.put("h+", H_PLUS);
ICON_NAME_TO_ICON.put("4g", FOUR_G);
ICON_NAME_TO_ICON.put("4g+", FOUR_G_PLUS);
+ ICON_NAME_TO_ICON.put("5ge", LTE_CA_5G_E);
ICON_NAME_TO_ICON.put("lte", LTE);
ICON_NAME_TO_ICON.put("lte+", LTE_PLUS);
ICON_NAME_TO_ICON.put("5g", NR_5G);
diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java
index ecb0daf..e727a6e 100644
--- a/telephony/java/android/provider/Telephony.java
+++ b/telephony/java/android/provider/Telephony.java
@@ -4259,6 +4259,22 @@
* @hide
*/
public static final String IS_USING_CARRIER_AGGREGATION = "is_using_carrier_aggregation";
+
+ /**
+ * The current registered raw data network operator name in long alphanumeric format.
+ * <p>
+ * This is the same as {@link ServiceState#getOperatorAlphaLongRaw()}.
+ * @hide
+ */
+ public static final String OPERATOR_ALPHA_LONG_RAW = "operator_alpha_long_raw";
+
+ /**
+ * The current registered raw data network operator name in short alphanumeric format.
+ * <p>
+ * This is the same as {@link ServiceState#getOperatorAlphaShortRaw()}.
+ * @hide
+ */
+ public static final String OPERATOR_ALPHA_SHORT_RAW = "operator_alpha_short_raw";
}
/**
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 349ef55..518c5ba 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1386,6 +1386,24 @@
"hide_lte_plus_data_icon_bool";
/**
+ * The string is used to filter redundant string from PLMN Network Name that's supplied by
+ * specific carrier.
+ *
+ * @hide
+ */
+ public static final String KEY_OPERATOR_NAME_FILTER_PATTERN_STRING =
+ "operator_name_filter_pattern_string";
+
+ /**
+ * The string is used to compare with operator name. If it matches the pattern then show
+ * specific data icon.
+ *
+ * @hide
+ */
+ public static final String KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING =
+ "show_carrier_data_icon_pattern_string";
+
+ /**
* Boolean to decide whether to show precise call failed cause to user
* @hide
*/
@@ -3027,6 +3045,8 @@
sDefaults.putBoolean(KEY_SPN_DISPLAY_RULE_USE_ROAMING_FROM_SERVICE_STATE_BOOL, false);
sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false);
sDefaults.putBoolean(KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL, false);
+ sDefaults.putString(KEY_OPERATOR_NAME_FILTER_PATTERN_STRING, "");
+ sDefaults.putString(KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING, "");
sDefaults.putBoolean(KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, true);
sDefaults.putBoolean(KEY_LTE_ENABLED_BOOL, true);
sDefaults.putBoolean(KEY_SUPPORT_TDSCDMA_BOOL, false);
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java
index a83d8f0..cbe5e71 100644
--- a/telephony/java/android/telephony/CellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentity.java
@@ -49,10 +49,10 @@
// long alpha Operator Name String or Enhanced Operator Name String
/** @hide */
- protected final String mAlphaLong;
+ protected String mAlphaLong;
// short alpha Operator Name String or Enhanced Operator Name String
/** @hide */
- protected final String mAlphaShort;
+ protected String mAlphaShort;
/** @hide */
protected CellIdentity(String tag, int type, String mcc, String mnc, String alphal,
@@ -145,6 +145,13 @@
}
/**
+ * @hide
+ */
+ public void setOperatorAlphaLong(String alphaLong) {
+ mAlphaLong = alphaLong;
+ }
+
+ /**
* @return The short alpha tag associated with the current scan result (may be the operator
* name string or extended operator name string). May be null if unknown.
*/
@@ -154,6 +161,13 @@
}
/**
+ * @hide
+ */
+ public void setOperatorAlphaShort(String alphaShort) {
+ mAlphaShort = alphaShort;
+ }
+
+ /**
* @return a CellLocation object for this CellIdentity
* @hide
*/
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 86cdce1..0ad1abe 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -339,6 +339,9 @@
private List<NetworkRegistrationInfo> mNetworkRegistrationInfos = new ArrayList<>();
+ private String mOperatorAlphaLongRaw;
+ private String mOperatorAlphaShortRaw;
+
/**
* get String description of roaming type
* @hide
@@ -420,6 +423,8 @@
mNetworkRegistrationInfos = s.mNetworkRegistrationInfos == null ? null :
s.getNetworkRegistrationInfoList();
mNrFrequencyRange = s.mNrFrequencyRange;
+ mOperatorAlphaLongRaw = s.mOperatorAlphaLongRaw;
+ mOperatorAlphaShortRaw = s.mOperatorAlphaShortRaw;
}
/**
@@ -453,6 +458,8 @@
mChannelNumber = in.readInt();
mCellBandwidths = in.createIntArray();
mNrFrequencyRange = in.readInt();
+ mOperatorAlphaLongRaw = in.readString();
+ mOperatorAlphaShortRaw = in.readString();
}
public void writeToParcel(Parcel out, int flags) {
@@ -478,6 +485,8 @@
out.writeInt(mChannelNumber);
out.writeIntArray(mCellBandwidths);
out.writeInt(mNrFrequencyRange);
+ out.writeString(mOperatorAlphaLongRaw);
+ out.writeString(mOperatorAlphaShortRaw);
}
public int describeContents() {
@@ -836,7 +845,9 @@
mIsEmergencyOnly,
mLteEarfcnRsrpBoost,
mNetworkRegistrationInfos,
- mNrFrequencyRange);
+ mNrFrequencyRange,
+ mOperatorAlphaLongRaw,
+ mOperatorAlphaShortRaw);
}
@Override
@@ -862,6 +873,8 @@
&& equalsHandlesNulls(mCdmaDefaultRoamingIndicator,
s.mCdmaDefaultRoamingIndicator)
&& mIsEmergencyOnly == s.mIsEmergencyOnly
+ && equalsHandlesNulls(mOperatorAlphaLongRaw, s.mOperatorAlphaLongRaw)
+ && equalsHandlesNulls(mOperatorAlphaShortRaw, s.mOperatorAlphaShortRaw)
&& (mNetworkRegistrationInfos == null
? s.mNetworkRegistrationInfos == null : s.mNetworkRegistrationInfos != null
&& mNetworkRegistrationInfos.containsAll(s.mNetworkRegistrationInfos))
@@ -1019,6 +1032,8 @@
.append(", mLteEarfcnRsrpBoost=").append(mLteEarfcnRsrpBoost)
.append(", mNetworkRegistrationInfos=").append(mNetworkRegistrationInfos)
.append(", mNrFrequencyRange=").append(mNrFrequencyRange)
+ .append(", mOperatorAlphaLongRaw=").append(mOperatorAlphaLongRaw)
+ .append(", mOperatorAlphaShortRaw=").append(mOperatorAlphaShortRaw)
.append("}").toString();
}
@@ -1056,6 +1071,8 @@
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
.build());
+ mOperatorAlphaLongRaw = null;
+ mOperatorAlphaShortRaw = null;
}
public void setStateOutOfService() {
@@ -1297,6 +1314,8 @@
m.putInt("ChannelNumber", mChannelNumber);
m.putIntArray("CellBandwidths", mCellBandwidths);
m.putInt("mNrFrequencyRange", mNrFrequencyRange);
+ m.putString("operator-alpha-long-raw", mOperatorAlphaLongRaw);
+ m.putString("operator-alpha-short-raw", mOperatorAlphaShortRaw);
}
/** @hide */
@@ -1910,4 +1929,36 @@
return state;
}
+
+ /**
+ * @hide
+ */
+ public void setOperatorAlphaLongRaw(String operatorAlphaLong) {
+ mOperatorAlphaLongRaw = operatorAlphaLong;
+ }
+
+ /**
+ * The current registered raw data network operator name in long alphanumeric format.
+ *
+ * @hide
+ */
+ public String getOperatorAlphaLongRaw() {
+ return mOperatorAlphaLongRaw;
+ }
+
+ /**
+ * @hide
+ */
+ public void setOperatorAlphaShortRaw(String operatorAlphaShort) {
+ mOperatorAlphaShortRaw = operatorAlphaShort;
+ }
+
+ /**
+ * The current registered raw data network operator name in short alphanumeric format.
+ *
+ * @hide
+ */
+ public String getOperatorAlphaShortRaw() {
+ return mOperatorAlphaShortRaw;
+ }
}