diff options
author | Weijie Wang <weijiew@codeaurora.org> | 2019-06-12 14:11:49 +0800 |
---|---|---|
committer | Weijie Wang <weijiew@codeaurora.org> | 2019-06-13 14:38:00 +0800 |
commit | e6c92c68df7faada87a4816ef3ab840348d2c536 (patch) | |
tree | c052d0214c788a57da8f2c798acd5fb91b66dbad /packages/SystemUI/src/com/android/keyguard/CarrierTextController.java | |
parent | 0d279ed1a1f23e3cee4bfff6858b0ab61e86f7eb (diff) |
SystemUI: Don't display 5G in carrier name when data type is not LTE
UE moved to 3G n/w due to CSFB, modem still reports 5G_Basic in the
ui_mask. 5G shouldn't display in carrier name
Change-Id: I586de4812e7f9837a4fa7fbae9f8ba564e77f250
CRs-Fixed: 2439219
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/CarrierTextController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/CarrierTextController.java | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java index dafbef9d97a5..311e0c7df2a5 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java @@ -708,15 +708,9 @@ public class CarrierTextController { int networkType = getNetworkType(sub.getSubscriptionId()); String networkClass = networkClassToString(TelephonyManager.getNetworkClass(networkType)); - if ( mFiveGServiceClient == null ) { - mFiveGServiceClient = FiveGServiceClient.getInstance(mContext); - mFiveGServiceClient.registerCallback(mCallback); - } - FiveGServiceState fiveGServiceState = - mFiveGServiceClient.getCurrentServiceState(sub.getSimSlotIndex()); - if ( fiveGServiceState.isConnectedOnNsaMode() ) { - networkClass = - mContext.getResources().getString(R.string.data_connection_5g); + String fiveGNetworkClass = get5GNetworkClass(sub); + if ( fiveGNetworkClass != null ) { + networkClass = fiveGNetworkClass; } if (!TextUtils.isEmpty(originCarrierName)) { @@ -788,4 +782,33 @@ public class CarrierTextController { } return originalString; } + + private String get5GNetworkClass(SubscriptionInfo sub) { + int slotIndex = sub.getSimSlotIndex(); + int subId = sub.getSubscriptionId(); + + if ( mFiveGServiceClient == null ) { + mFiveGServiceClient = FiveGServiceClient.getInstance(mContext); + mFiveGServiceClient.registerCallback(mCallback); + } + FiveGServiceState fiveGServiceState = + mFiveGServiceClient.getCurrentServiceState(slotIndex); + if ( fiveGServiceState.isConnectedOnNsaMode() && isDataRegisteredOnLte(subId)) { + return mContext.getResources().getString(R.string.data_connection_5g); + } + + return null; + } + + private boolean isDataRegisteredOnLte(int subId) { + TelephonyManager telephonyManager = (TelephonyManager) + mContext.getSystemService(Context.TELEPHONY_SERVICE); + int dataType = telephonyManager.getDataNetworkType(subId); + if ( dataType == TelephonyManager.NETWORK_TYPE_LTE || + dataType == TelephonyManager.NETWORK_TYPE_LTE_CA) { + return true; + }else{ + return false; + } + } } |