Merge "OVERRIDE_NETWORK_TYPE_NR_ADVANCED use a different int id" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f512ec8cfa
@@ -42348,7 +42348,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_ADVANCED_PRO = 2; // 0x2
|
||||||
field public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; // 0x1
|
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_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 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
|
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 subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
|
|
||||||
int phoneId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
|
int phoneId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
|
||||||
|
int targetSdk;
|
||||||
|
|
||||||
boolean matchTelephonyCallbackEvent(int event) {
|
boolean matchTelephonyCallbackEvent(int event) {
|
||||||
return (callback != null) && (this.eventList.contains(event));
|
return (callback != null) && (this.eventList.contains(event));
|
||||||
@@ -919,6 +920,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
r.phoneId = phoneId;
|
r.phoneId = phoneId;
|
||||||
r.eventList = events;
|
r.eventList = events;
|
||||||
|
r.targetSdk = TelephonyPermissions.getTargetSdk(mContext, callingPackage);
|
||||||
|
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("listen: Register r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId);
|
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)
|
TelephonyCallback.EVENT_DISPLAY_INFO_CHANGED)
|
||||||
&& idMatchWithoutDefaultPhoneCheck(r.subId, subId)) {
|
&& idMatchWithoutDefaultPhoneCheck(r.subId, subId)) {
|
||||||
try {
|
try {
|
||||||
|
if (r.targetSdk <= android.os.Build.VERSION_CODES.R) {
|
||||||
|
telephonyDisplayInfo =
|
||||||
|
getBackwardCompatibleTelephonyDisplayInfo(
|
||||||
|
telephonyDisplayInfo);
|
||||||
|
}
|
||||||
r.callback.onDisplayInfoChanged(telephonyDisplayInfo);
|
r.callback.onDisplayInfoChanged(telephonyDisplayInfo);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
mRemoveList.add(r.binder);
|
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) {
|
public void notifyCallForwardingChanged(boolean cfi) {
|
||||||
notifyCallForwardingChangedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cfi);
|
notifyCallForwardingChangedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cfi);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public final class TelephonyDisplayInfo implements Parcelable {
|
|||||||
* </ul>
|
* </ul>
|
||||||
* One of the use case is that UX can show a different icon, for example, "5G+"
|
* 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
|
@NetworkType
|
||||||
private final int mNetworkType;
|
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_CA: return "LTE_CA";
|
||||||
case OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO: return "LTE_ADV_PRO";
|
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_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";
|
default: return "UNKNOWN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user