Merge "Add logic for 5G icon to SIM status dialog" into rvc-dev am: 73bf03748e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11763678 Change-Id: Ie52943675d3a5610978a6bf7a7ac0743407447f1
This commit is contained in:
@@ -42,6 +42,7 @@ import android.telephony.SignalStrength;
|
|||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
|
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
|
||||||
|
import android.telephony.TelephonyDisplayInfo;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.UiccCardInfo;
|
import android.telephony.UiccCardInfo;
|
||||||
import android.telephony.euicc.EuiccManager;
|
import android.telephony.euicc.EuiccManager;
|
||||||
@@ -138,6 +139,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
};
|
};
|
||||||
|
|
||||||
private SubscriptionInfo mSubscriptionInfo;
|
private SubscriptionInfo mSubscriptionInfo;
|
||||||
|
private TelephonyDisplayInfo mTelephonyDisplayInfo;
|
||||||
|
|
||||||
private final int mSlotIndex;
|
private final int mSlotIndex;
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
@@ -269,7 +271,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
mTelephonyManager.listen(mPhoneStateListener,
|
mTelephonyManager.listen(mPhoneStateListener,
|
||||||
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
|
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
|
||||||
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
|
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
|
||||||
| PhoneStateListener.LISTEN_SERVICE_STATE);
|
| PhoneStateListener.LISTEN_SERVICE_STATE
|
||||||
|
| PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED);
|
||||||
mSubscriptionManager.addOnSubscriptionsChangedListener(
|
mSubscriptionManager.addOnSubscriptionsChangedListener(
|
||||||
mContext.getMainExecutor(), mOnSubscriptionsChangedListener);
|
mContext.getMainExecutor(), mOnSubscriptionsChangedListener);
|
||||||
registerImsRegistrationCallback(mSubscriptionInfo.getSubscriptionId());
|
registerImsRegistrationCallback(mSubscriptionInfo.getSubscriptionId());
|
||||||
@@ -493,6 +496,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateNetworkType() {
|
private void updateNetworkType() {
|
||||||
|
// TODO: all of this should be based on TelephonyDisplayInfo instead of just the 5G logic
|
||||||
if (mSubscriptionInfo == null) {
|
if (mSubscriptionInfo == null) {
|
||||||
final String unknownNetworkType =
|
final String unknownNetworkType =
|
||||||
getNetworkTypeName(TelephonyManager.NETWORK_TYPE_UNKNOWN);
|
getNetworkTypeName(TelephonyManager.NETWORK_TYPE_UNKNOWN);
|
||||||
@@ -507,6 +511,10 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
final int subId = mSubscriptionInfo.getSubscriptionId();
|
final int subId = mSubscriptionInfo.getSubscriptionId();
|
||||||
final int actualDataNetworkType = mTelephonyManager.getDataNetworkType();
|
final int actualDataNetworkType = mTelephonyManager.getDataNetworkType();
|
||||||
final int actualVoiceNetworkType = mTelephonyManager.getVoiceNetworkType();
|
final int actualVoiceNetworkType = mTelephonyManager.getVoiceNetworkType();
|
||||||
|
final int overrideNetworkType = mTelephonyDisplayInfo == null
|
||||||
|
? TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE
|
||||||
|
: mTelephonyDisplayInfo.getOverrideNetworkType();
|
||||||
|
|
||||||
if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualDataNetworkType) {
|
if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualDataNetworkType) {
|
||||||
dataNetworkTypeName = getNetworkTypeName(actualDataNetworkType);
|
dataNetworkTypeName = getNetworkTypeName(actualDataNetworkType);
|
||||||
}
|
}
|
||||||
@@ -514,6 +522,12 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
voiceNetworkTypeName = getNetworkTypeName(actualVoiceNetworkType);
|
voiceNetworkTypeName = getNetworkTypeName(actualVoiceNetworkType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE
|
||||||
|
|| overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA) {
|
||||||
|
dataNetworkTypeName = "NR NSA";
|
||||||
|
voiceNetworkTypeName = "NR NSA";
|
||||||
|
}
|
||||||
|
|
||||||
boolean show4GForLTE = false;
|
boolean show4GForLTE = false;
|
||||||
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
|
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
|
||||||
if (carrierConfig != null) {
|
if (carrierConfig != null) {
|
||||||
@@ -743,6 +757,12 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
updateServiceState(serviceState);
|
updateServiceState(serviceState);
|
||||||
updateRoamingStatus(serviceState);
|
updateRoamingStatus(serviceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisplayInfoChanged(@NonNull TelephonyDisplayInfo displayInfo) {
|
||||||
|
mTelephonyDisplayInfo = displayInfo;
|
||||||
|
updateNetworkType();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,7 +808,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
// case TelephonyManager.NETWORK_TYPE_LTE_CA:
|
// case TelephonyManager.NETWORK_TYPE_LTE_CA:
|
||||||
// return "LTE_CA";
|
// return "LTE_CA";
|
||||||
case TelephonyManager.NETWORK_TYPE_NR:
|
case TelephonyManager.NETWORK_TYPE_NR:
|
||||||
return "NR";
|
return "NR SA";
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user