如何判定是NR5G 还是LTE

/frameworks/base/telephony/java/android/telephony/TelephonyManager.java

/frameworks/base/telephony/java/android/telephony/PhysicalChannelConfig.java

 

LTE下radio log搜RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG,查看是否有以下字符串mConnectionStatus=SecondaryServing,mRat=20,有的话就是NSA

02-26 22:29:31.963  2279  2342 D RILJ    : [UNSL]< RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG [{mConnectionStatus=PrimaryServing,mCellBandwidthDownlinkKhz=20000,mRat=13,mFrequencyRange=2,mChannelNumber=2147483647,mContextIds=[I@beea299,mPhysicalCellId=382}, {mConnectionStatus=SecondaryServing,mCellBandwidthDownlinkKhz=0,mRat=20,mFrequencyRange=3,mChannelNumber=2147483647,mContextIds=[I@57c095e,mPhysicalCellId=0}] [SUB0]

  /*
2477     * When adding a network type to the list below, make sure to add the correct icon to
2478     * MobileSignalController.mapIconSets().
2479     * Do not add negative types.
2480     */
2481    /** Network type is unknown */
2482    public static final int NETWORK_TYPE_UNKNOWN = TelephonyProtoEnums.NETWORK_TYPE_UNKNOWN; // = 0.
2483    /** Current network is GPRS */
2484    public static final int NETWORK_TYPE_GPRS = TelephonyProtoEnums.NETWORK_TYPE_GPRS; // = 1.
2485    /** Current network is EDGE */
2486    public static final int NETWORK_TYPE_EDGE = TelephonyProtoEnums.NETWORK_TYPE_EDGE; // = 2.
2487    /** Current network is UMTS */
2488    public static final int NETWORK_TYPE_UMTS = TelephonyProtoEnums.NETWORK_TYPE_UMTS; // = 3.
2489    /** Current network is CDMA: Either IS95A or IS95B*/
2490    public static final int NETWORK_TYPE_CDMA = TelephonyProtoEnums.NETWORK_TYPE_CDMA; // = 4.
2491    /** Current network is EVDO revision 0*/
2492    public static final int NETWORK_TYPE_EVDO_0 = TelephonyProtoEnums.NETWORK_TYPE_EVDO_0; // = 5.
2493    /** Current network is EVDO revision A*/
2494    public static final int NETWORK_TYPE_EVDO_A = TelephonyProtoEnums.NETWORK_TYPE_EVDO_A; // = 6.
2495    /** Current network is 1xRTT*/
2496    public static final int NETWORK_TYPE_1xRTT = TelephonyProtoEnums.NETWORK_TYPE_1XRTT; // = 7.
2497    /** Current network is HSDPA */
2498    public static final int NETWORK_TYPE_HSDPA = TelephonyProtoEnums.NETWORK_TYPE_HSDPA; // = 8.
2499    /** Current network is HSUPA */
2500    public static final int NETWORK_TYPE_HSUPA = TelephonyProtoEnums.NETWORK_TYPE_HSUPA; // = 9.
2501    /** Current network is HSPA */
2502    public static final int NETWORK_TYPE_HSPA = TelephonyProtoEnums.NETWORK_TYPE_HSPA; // = 10.
2503    /** Current network is iDen */
2504    public static final int NETWORK_TYPE_IDEN = TelephonyProtoEnums.NETWORK_TYPE_IDEN; // = 11.
2505    /** Current network is EVDO revision B*/
2506    public static final int NETWORK_TYPE_EVDO_B = TelephonyProtoEnums.NETWORK_TYPE_EVDO_B; // = 12.
2507    /** Current network is LTE */
2508    public static final int NETWORK_TYPE_LTE = TelephonyProtoEnums.NETWORK_TYPE_LTE; // = 13.
2509    /** Current network is eHRPD */
2510    public static final int NETWORK_TYPE_EHRPD = TelephonyProtoEnums.NETWORK_TYPE_EHRPD; // = 14.
2511    /** Current network is HSPA+ */
2512    public static final int NETWORK_TYPE_HSPAP = TelephonyProtoEnums.NETWORK_TYPE_HSPAP; // = 15.
2513    /** Current network is GSM */
2514    public static final int NETWORK_TYPE_GSM = TelephonyProtoEnums.NETWORK_TYPE_GSM; // = 16.
2515    /** Current network is TD_SCDMA */
2516    public static final int NETWORK_TYPE_TD_SCDMA =
2517            TelephonyProtoEnums.NETWORK_TYPE_TD_SCDMA; // = 17.
2518    /** Current network is IWLAN */
2519    public static final int NETWORK_TYPE_IWLAN = TelephonyProtoEnums.NETWORK_TYPE_IWLAN; // = 18.
2520    /** Current network is LTE_CA {@hide} */
2521    @UnsupportedAppUsage
2522    public static final int NETWORK_TYPE_LTE_CA = TelephonyProtoEnums.NETWORK_TYPE_LTE_CA; // = 19.
2523    /** Current network is NR(New Radio) 5G. */
2524    public static final int NETWORK_TYPE_NR = TelephonyProtoEnums.NETWORK_TYPE_NR; // 20.

 

     * @param subId for which network type is returned
2569     *
2570     * @see #NETWORK_TYPE_UNKNOWN
2571     * @see #NETWORK_TYPE_GPRS
2572     * @see #NETWORK_TYPE_EDGE
2573     * @see #NETWORK_TYPE_UMTS
2574     * @see #NETWORK_TYPE_HSDPA
2575     * @see #NETWORK_TYPE_HSUPA
2576     * @see #NETWORK_TYPE_HSPA
2577     * @see #NETWORK_TYPE_CDMA
2578     * @see #NETWORK_TYPE_EVDO_0
2579     * @see #NETWORK_TYPE_EVDO_A
2580     * @see #NETWORK_TYPE_EVDO_B
2581     * @see #NETWORK_TYPE_1xRTT
2582     * @see #NETWORK_TYPE_IDEN
2583     * @see #NETWORK_TYPE_LTE
2584     * @see #NETWORK_TYPE_EHRPD
2585     * @see #NETWORK_TYPE_HSPAP
2586     * @see #NETWORK_TYPE_NR
37    public static int getNetworkClass(int networkType) {
2738        switch (networkType) {
2739            case NETWORK_TYPE_GPRS:
2740            case NETWORK_TYPE_GSM:
2741            case NETWORK_TYPE_EDGE:
2742            case NETWORK_TYPE_CDMA:
2743            case NETWORK_TYPE_1xRTT:
2744            case NETWORK_TYPE_IDEN:
2745                return NETWORK_CLASS_2_G;
2746            case NETWORK_TYPE_UMTS:
2747            case NETWORK_TYPE_EVDO_0:
2748            case NETWORK_TYPE_EVDO_A:
2749            case NETWORK_TYPE_HSDPA:
2750            case NETWORK_TYPE_HSUPA:
2751            case NETWORK_TYPE_HSPA:
2752            case NETWORK_TYPE_EVDO_B:
2753            case NETWORK_TYPE_EHRPD:
2754            case NETWORK_TYPE_HSPAP:
2755            case NETWORK_TYPE_TD_SCDMA:
2756                return NETWORK_CLASS_3_G;
2757            case NETWORK_TYPE_LTE:
2758            case NETWORK_TYPE_IWLAN:
2759            case NETWORK_TYPE_LTE_CA:
2760                return NETWORK_CLASS_4_G;
2761            case NETWORK_TYPE_NR:
2762                return NETWORK_CLASS_5_G;
2763            default:
2764                return NETWORK_CLASS_UNKNOWN;
2765        }
2766    }
2767

 

 

你可能感兴趣的:(如何判定是NR5G 还是LTE)