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
(cherry picked from commit 2d178eaabb)
This commit is contained in:
committed by
SongFerng Wang
parent
1de175914b
commit
3cbcf75c4a
31
packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml
Normal file
31
packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml
Normal file
@@ -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>
|
||||
@@ -424,6 +424,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>
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ import com.android.systemui.statusbar.policy.NetworkControllerImpl.SubscriptionD
|
||||
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<
|
||||
@@ -73,6 +75,8 @@ public class MobileSignalController extends SignalController<
|
||||
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.
|
||||
@@ -236,6 +240,8 @@ public class MobileSignalController extends SignalController<
|
||||
TelephonyIcons.LTE_PLUS);
|
||||
}
|
||||
}
|
||||
mNetworkToIconLookup.put(NETWORK_TYPE_LTE_CA_5GE,
|
||||
TelephonyIcons.LTE_CA_5G_E);
|
||||
mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_IWLAN, TelephonyIcons.WFC);
|
||||
}
|
||||
|
||||
@@ -381,6 +387,26 @@ public class MobileSignalController extends SignalController<
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
@@ -559,12 +585,8 @@ public class MobileSignalController extends SignalController<
|
||||
+ " 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();
|
||||
}
|
||||
@@ -576,14 +598,21 @@ public class MobileSignalController extends SignalController<
|
||||
+ " 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) {
|
||||
|
||||
@@ -1102,6 +1102,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
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
|
||||
@@ -1140,6 +1141,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
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)) {
|
||||
|
||||
@@ -35,6 +35,7 @@ class TelephonyIcons {
|
||||
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 @@ class TelephonyIcons {
|
||||
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,
|
||||
@@ -276,6 +290,7 @@ class TelephonyIcons {
|
||||
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);
|
||||
|
||||
@@ -4321,6 +4321,22 @@ public final class Telephony {
|
||||
* @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";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1311,6 +1311,24 @@ public class CarrierConfigManager {
|
||||
public static final String KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL =
|
||||
"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
|
||||
@@ -3139,6 +3157,8 @@ public class CarrierConfigManager {
|
||||
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);
|
||||
|
||||
@@ -49,10 +49,10 @@ public abstract class CellIdentity implements Parcelable {
|
||||
|
||||
// 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,
|
||||
@@ -144,6 +144,13 @@ public abstract class CellIdentity implements Parcelable {
|
||||
return mAlphaLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
@@ -153,6 +160,13 @@ public abstract class CellIdentity implements Parcelable {
|
||||
return mAlphaShort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void setOperatorAlphaShort(String alphaShort) {
|
||||
mAlphaShort = alphaShort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a CellLocation object for this CellIdentity
|
||||
* @hide
|
||||
|
||||
@@ -339,6 +339,9 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
private List<NetworkRegistrationInfo> mNetworkRegistrationInfos = new ArrayList<>();
|
||||
|
||||
private String mOperatorAlphaLongRaw;
|
||||
private String mOperatorAlphaShortRaw;
|
||||
|
||||
/**
|
||||
* get String description of roaming type
|
||||
* @hide
|
||||
@@ -420,6 +423,8 @@ public class ServiceState implements Parcelable {
|
||||
mNetworkRegistrationInfos = s.mNetworkRegistrationInfos == null ? null :
|
||||
new ArrayList<>(s.mNetworkRegistrationInfos);
|
||||
mNrFrequencyRange = s.mNrFrequencyRange;
|
||||
mOperatorAlphaLongRaw = s.mOperatorAlphaLongRaw;
|
||||
mOperatorAlphaShortRaw = s.mOperatorAlphaShortRaw;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -453,6 +458,8 @@ public class ServiceState implements Parcelable {
|
||||
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 @@ public class ServiceState implements Parcelable {
|
||||
out.writeInt(mChannelNumber);
|
||||
out.writeIntArray(mCellBandwidths);
|
||||
out.writeInt(mNrFrequencyRange);
|
||||
out.writeString(mOperatorAlphaLongRaw);
|
||||
out.writeString(mOperatorAlphaShortRaw);
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
@@ -836,7 +845,9 @@ public class ServiceState implements Parcelable {
|
||||
mIsEmergencyOnly,
|
||||
mLteEarfcnRsrpBoost,
|
||||
mNetworkRegistrationInfos,
|
||||
mNrFrequencyRange);
|
||||
mNrFrequencyRange,
|
||||
mOperatorAlphaLongRaw,
|
||||
mOperatorAlphaShortRaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -862,6 +873,8 @@ public class ServiceState implements Parcelable {
|
||||
&& 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 @@ public class ServiceState implements Parcelable {
|
||||
.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 @@ public class ServiceState implements Parcelable {
|
||||
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
|
||||
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
||||
.build());
|
||||
mOperatorAlphaLongRaw = null;
|
||||
mOperatorAlphaShortRaw = null;
|
||||
}
|
||||
|
||||
public void setStateOutOfService() {
|
||||
@@ -1297,6 +1314,8 @@ public class ServiceState implements Parcelable {
|
||||
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 */
|
||||
@@ -1906,4 +1925,36 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user