OVERRIDE_NETWORK_TYPE_NR_ADVANCED use a different int id
-OVERRIDE_NETWORK_TYPE_NR_ADVANCED use a different int id -For backward compatible, adding the SDK version checking. Bug: 181658987 Test: atest NetworkTypeControllerTest Change-Id: I8716fe9352c36434a24e875ecb6a6602ff88e2ff
This commit is contained in:
@@ -42338,7 +42338,7 @@ package android.telephony {
|
||||
field public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2; // 0x2
|
||||
field public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; // 0x1
|
||||
field public static final int OVERRIDE_NETWORK_TYPE_NONE = 0; // 0x0
|
||||
field public static final int OVERRIDE_NETWORK_TYPE_NR_ADVANCED = 4; // 0x4
|
||||
field public static final int OVERRIDE_NETWORK_TYPE_NR_ADVANCED = 5; // 0x5
|
||||
field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3; // 0x3
|
||||
field @Deprecated public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; // 0x4
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||
|
||||
int phoneId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
|
||||
int targetSdk;
|
||||
|
||||
boolean matchTelephonyCallbackEvent(int event) {
|
||||
return (callback != null) && (this.eventList.contains(event));
|
||||
@@ -919,6 +920,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
r.phoneId = phoneId;
|
||||
r.eventList = events;
|
||||
r.targetSdk = TelephonyPermissions.getTargetSdk(mContext, callingPackage);
|
||||
|
||||
if (DBG) {
|
||||
log("listen: Register r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId);
|
||||
}
|
||||
@@ -1748,6 +1751,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
TelephonyCallback.EVENT_DISPLAY_INFO_CHANGED)
|
||||
&& idMatchWithoutDefaultPhoneCheck(r.subId, subId)) {
|
||||
try {
|
||||
if (r.targetSdk <= android.os.Build.VERSION_CODES.R) {
|
||||
telephonyDisplayInfo =
|
||||
getBackwardCompatibleTelephonyDisplayInfo(
|
||||
telephonyDisplayInfo);
|
||||
}
|
||||
r.callback.onDisplayInfoChanged(telephonyDisplayInfo);
|
||||
} catch (RemoteException ex) {
|
||||
mRemoveList.add(r.binder);
|
||||
@@ -1759,6 +1767,19 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private TelephonyDisplayInfo getBackwardCompatibleTelephonyDisplayInfo(
|
||||
@NonNull TelephonyDisplayInfo telephonyDisplayInfo) {
|
||||
int networkType = telephonyDisplayInfo.getNetworkType();
|
||||
int overrideNetworkType = telephonyDisplayInfo.getOverrideNetworkType();
|
||||
if (networkType == TelephonyManager.NETWORK_TYPE_NR) {
|
||||
overrideNetworkType = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
|
||||
} else if (networkType == TelephonyManager.NETWORK_TYPE_LTE
|
||||
&& overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED) {
|
||||
overrideNetworkType = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE;
|
||||
}
|
||||
return new TelephonyDisplayInfo(networkType, overrideNetworkType);
|
||||
}
|
||||
|
||||
public void notifyCallForwardingChanged(boolean cfi) {
|
||||
notifyCallForwardingChangedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cfi);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class TelephonyDisplayInfo implements Parcelable {
|
||||
* </ul>
|
||||
* One of the use case is that UX can show a different icon, for example, "5G+"
|
||||
*/
|
||||
public static final int OVERRIDE_NETWORK_TYPE_NR_ADVANCED = 4;
|
||||
public static final int OVERRIDE_NETWORK_TYPE_NR_ADVANCED = 5;
|
||||
|
||||
@NetworkType
|
||||
private final int mNetworkType;
|
||||
@@ -186,7 +186,8 @@ public final class TelephonyDisplayInfo implements Parcelable {
|
||||
case OVERRIDE_NETWORK_TYPE_LTE_CA: return "LTE_CA";
|
||||
case OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO: return "LTE_ADV_PRO";
|
||||
case OVERRIDE_NETWORK_TYPE_NR_NSA: return "NR_NSA";
|
||||
case OVERRIDE_NETWORK_TYPE_NR_ADVANCED: return "NR_NSA_MMWAVE";
|
||||
case OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE: return "NR_NSA_MMWAVE";
|
||||
case OVERRIDE_NETWORK_TYPE_NR_ADVANCED: return "NR_ADVANCED";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user