Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f512ec8c authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "OVERRIDE_NETWORK_TYPE_NR_ADVANCED use a different int id" into sc-dev

parents 1419d29d 7504281f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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_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
  }
+21 −0
Original line number Diff line number Diff line
@@ -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);
    }
+3 −2
Original line number Diff line number Diff line
@@ -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";
        }
    }