mirror of
https://github.com/yurisieucuti/treble_evolution.git
synced 2024-11-24 08:36:19 +00:00
85 lines
3.1 KiB
Diff
85 lines
3.1 KiB
Diff
From 78efd9275235b4385f6cd5268069ba293ea0d85d Mon Sep 17 00:00:00 2001
|
|
From: Peter Cai <peter@typeblog.net>
|
|
Date: Wed, 16 Dec 2020 13:46:15 +0800
|
|
Subject: [PATCH 18/51] TelephonyManager: bring back getNetworkClass()
|
|
|
|
This partially reverts commit c058cac051ab083dc7fb7ea6aa85699110b2e9bf.
|
|
|
|
* Needed by Spreadtrum IMS
|
|
---
|
|
.../android/telephony/TelephonyManager.java | 58 +++++++++++++++++++
|
|
1 file changed, 58 insertions(+)
|
|
|
|
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
|
|
index 73c957c47892..0cd5ab7fad20 100644
|
|
--- a/telephony/java/android/telephony/TelephonyManager.java
|
|
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
|
@@ -3256,6 +3256,64 @@ public class TelephonyManager {
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
+ * Network Class Definitions.
|
|
+ * Do not change this order, it is used for sorting during emergency calling in
|
|
+ * {@link TelephonyConnectionService#getFirstPhoneForEmergencyCall()}. Any newer technologies
|
|
+ * should be added after the current definitions.
|
|
+ */
|
|
+ /** Unknown network class. {@hide} */
|
|
+ public static final int NETWORK_CLASS_UNKNOWN = 0;
|
|
+ /** Class of broadly defined "2G" networks. {@hide} */
|
|
+ @UnsupportedAppUsage
|
|
+ public static final int NETWORK_CLASS_2_G = 1;
|
|
+ /** Class of broadly defined "3G" networks. {@hide} */
|
|
+ @UnsupportedAppUsage
|
|
+ public static final int NETWORK_CLASS_3_G = 2;
|
|
+ /** Class of broadly defined "4G" networks. {@hide} */
|
|
+ @UnsupportedAppUsage
|
|
+ public static final int NETWORK_CLASS_4_G = 3;
|
|
+ /** Class of broadly defined "5G" networks. {@hide} */
|
|
+ public static final int NETWORK_CLASS_5_G = 4;
|
|
+
|
|
+ /**
|
|
+ * Return general class of network type, such as "3G" or "4G". In cases
|
|
+ * where classification is contentious, this method is conservative.
|
|
+ *
|
|
+ * @hide
|
|
+ */
|
|
+ @UnsupportedAppUsage
|
|
+ public static int getNetworkClass(int networkType) {
|
|
+ switch (networkType) {
|
|
+ case NETWORK_TYPE_GPRS:
|
|
+ case NETWORK_TYPE_GSM:
|
|
+ case NETWORK_TYPE_EDGE:
|
|
+ case NETWORK_TYPE_CDMA:
|
|
+ case NETWORK_TYPE_1xRTT:
|
|
+ case NETWORK_TYPE_IDEN:
|
|
+ return NETWORK_CLASS_2_G;
|
|
+ case NETWORK_TYPE_UMTS:
|
|
+ case NETWORK_TYPE_EVDO_0:
|
|
+ case NETWORK_TYPE_EVDO_A:
|
|
+ case NETWORK_TYPE_HSDPA:
|
|
+ case NETWORK_TYPE_HSUPA:
|
|
+ case NETWORK_TYPE_HSPA:
|
|
+ case NETWORK_TYPE_EVDO_B:
|
|
+ case NETWORK_TYPE_EHRPD:
|
|
+ case NETWORK_TYPE_HSPAP:
|
|
+ case NETWORK_TYPE_TD_SCDMA:
|
|
+ return NETWORK_CLASS_3_G;
|
|
+ case NETWORK_TYPE_LTE:
|
|
+ case NETWORK_TYPE_IWLAN:
|
|
+ case NETWORK_TYPE_LTE_CA:
|
|
+ return NETWORK_CLASS_4_G;
|
|
+ case NETWORK_TYPE_NR:
|
|
+ return NETWORK_CLASS_5_G;
|
|
+ default:
|
|
+ return NETWORK_CLASS_UNKNOWN;
|
|
+ }
|
|
+ }
|
|
+
|
|
/**
|
|
* Returns a string representation of the radio technology (network type)
|
|
* currently in use on the device.
|
|
--
|
|
2.25.1
|
|
|