• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settings.network.telephony;
18 
19 import android.telephony.TelephonyManager;
20 
21 /**
22  * Contains hidden constants copied from the platform.
23  */
24 public class TelephonyConstants {
25 
26     /**
27      * Copied from {@link android.telephony.TelephonyManager}
28      */
29     public static class TelephonyManagerConstants {
30 
31         // Network modes are in turn copied from RILConstants
32         // with one difference: NETWORK_MODE_CDMA is named NETWORK_MODE_CDMA_EVDO
33 
34         public static final int NETWORK_MODE_UNKNOWN = -1;
35 
36         /**
37          * GSM, WCDMA (WCDMA preferred)
38          */
39         public static final int NETWORK_MODE_WCDMA_PREF = 0;
40 
41         /**
42          * GSM only
43          */
44         public static final int NETWORK_MODE_GSM_ONLY = 1;
45 
46         /**
47          * WCDMA only
48          */
49         public static final int NETWORK_MODE_WCDMA_ONLY = 2;
50 
51         /**
52          * GSM, WCDMA (auto mode, according to PRL)
53          */
54         public static final int NETWORK_MODE_GSM_UMTS = 3;
55 
56         /**
57          * CDMA and EvDo (auto mode, according to PRL)
58          * this is NETWORK_MODE_CDMA in RILConstants.java
59          */
60         public static final int NETWORK_MODE_CDMA_EVDO = 4;
61 
62         /**
63          * CDMA only
64          */
65         public static final int NETWORK_MODE_CDMA_NO_EVDO = 5;
66 
67         /**
68          * EvDo only
69          */
70         public static final int NETWORK_MODE_EVDO_NO_CDMA = 6;
71 
72         /**
73          * GSM, WCDMA, CDMA, and EvDo (auto mode, according to PRL)
74          */
75         public static final int NETWORK_MODE_GLOBAL = 7;
76 
77         /**
78          * LTE, CDMA and EvDo
79          */
80         public static final int NETWORK_MODE_LTE_CDMA_EVDO = 8;
81 
82         /**
83          * LTE, GSM and WCDMA
84          */
85         public static final int NETWORK_MODE_LTE_GSM_WCDMA = 9;
86 
87         /**
88          * LTE, CDMA, EvDo, GSM, and WCDMA
89          */
90         public static final int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = 10;
91 
92         /**
93          * LTE only mode.
94          */
95         public static final int NETWORK_MODE_LTE_ONLY = 11;
96 
97         /**
98          * LTE and WCDMA
99          */
100         public static final int NETWORK_MODE_LTE_WCDMA = 12;
101 
102         /**
103          * TD-SCDMA only
104          */
105         public static final int NETWORK_MODE_TDSCDMA_ONLY = 13;
106 
107         /**
108          * TD-SCDMA and WCDMA
109          */
110         public static final int NETWORK_MODE_TDSCDMA_WCDMA = 14;
111 
112         /**
113          * LTE and TD-SCDMA
114          */
115         public static final int NETWORK_MODE_LTE_TDSCDMA = 15;
116 
117         /**
118          * TD-SCDMA and GSM
119          */
120         public static final int NETWORK_MODE_TDSCDMA_GSM = 16;
121 
122         /**
123          * TD-SCDMA, GSM and LTE
124          */
125         public static final int NETWORK_MODE_LTE_TDSCDMA_GSM = 17;
126 
127         /**
128          * TD-SCDMA, GSM and WCDMA
129          */
130         public static final int NETWORK_MODE_TDSCDMA_GSM_WCDMA = 18;
131 
132         /**
133          * LTE, TD-SCDMA and WCDMA
134          */
135         public static final int NETWORK_MODE_LTE_TDSCDMA_WCDMA = 19;
136 
137         /**
138          * LTE, TD-SCDMA, GSM, and WCDMA
139          */
140         public static final int NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA = 20;
141 
142         /**
143          * TD-SCDMA, CDMA, EVDO, GSM and WCDMA
144          */
145         public static final int NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 21;
146 
147         /**
148          * LTE, TDCSDMA, CDMA, EVDO, GSM and WCDMA
149          */
150         public static final int NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 22;
151 
152         /**
153          * NR 5G only mode
154          */
155         public static final int NETWORK_MODE_NR_ONLY = 23;
156 
157         /**
158          * NR 5G, LTE
159          */
160         public static final int NETWORK_MODE_NR_LTE = 24;
161 
162         /**
163          * NR 5G, LTE, CDMA and EvDo
164          */
165         public static final int NETWORK_MODE_NR_LTE_CDMA_EVDO = 25;
166 
167         /**
168          * NR 5G, LTE, GSM and WCDMA
169          */
170         public static final int NETWORK_MODE_NR_LTE_GSM_WCDMA = 26;
171 
172         /**
173          * NR 5G, LTE, CDMA, EvDo, GSM and WCDMA
174          */
175         public static final int NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA = 27;
176 
177         /**
178          * NR 5G, LTE and WCDMA
179          */
180         public static final int NETWORK_MODE_NR_LTE_WCDMA = 28;
181 
182         /**
183          * NR 5G, LTE and TDSCDMA
184          */
185         public static final int NETWORK_MODE_NR_LTE_TDSCDMA = 29;
186 
187         /**
188          * NR 5G, LTE, TD-SCDMA and GSM
189          */
190         public static final int NETWORK_MODE_NR_LTE_TDSCDMA_GSM = 30;
191 
192         /**
193          * NR 5G, LTE, TD-SCDMA, WCDMA
194          */
195         public static final int NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA = 31;
196 
197         /**
198          * NR 5G, LTE, TD-SCDMA, GSM and WCDMA
199          */
200         public static final int NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA = 32;
201 
202         /**
203          * NR 5G, LTE, TD-SCDMA, CDMA, EVDO, GSM and WCDMA
204          */
205         public static final int NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 33;
206     }
207 
208     /**
209      * Copied from {@link android.telephony.RadioAccessFamily}
210      */
211     public static class RadioAccessFamily {
212         /**
213          * TODO: get rid of RAF definition in RadioAccessFamily and
214          * use {@link TelephonyManager.NetworkTypeBitMask}
215          * TODO: public definition {@link TelephonyManager.NetworkTypeBitMask} is long.
216          * TODO: Convert from int * to long everywhere including HAL definitions.
217          */
218         // 2G
219         public static final int RAF_UNKNOWN = (int) TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
220         public static final int RAF_GSM = (int) TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
221         public static final int RAF_GPRS = (int) TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
222         public static final int RAF_EDGE = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
223         public static final int RAF_IS95A = (int) TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
224         public static final int RAF_IS95B = (int) TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
225         public static final int RAF_1xRTT = (int) TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
226         // 3G
227         public static final int RAF_EVDO_0 = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
228         public static final int RAF_EVDO_A = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
229         public static final int RAF_EVDO_B = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
230         public static final int RAF_EHRPD = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
231         public static final int RAF_HSUPA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
232         public static final int RAF_HSDPA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
233         public static final int RAF_HSPA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
234         public static final int RAF_HSPAP = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
235         public static final int RAF_UMTS = (int) TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
236         public static final int RAF_TD_SCDMA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
237         // 4G
238         public static final int RAF_LTE = (int) TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
239         public static final int RAF_LTE_CA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;
240         // 5G
241         public static final int RAF_NR = (int) TelephonyManager.NETWORK_TYPE_BITMASK_NR;
242 
243         // Grouping of RAFs
244         // 2G
245         public static final int GSM = RAF_GSM | RAF_GPRS | RAF_EDGE;
246         public static final int CDMA = RAF_IS95A | RAF_IS95B | RAF_1xRTT;
247         // 3G
248         public static final int EVDO = RAF_EVDO_0 | RAF_EVDO_A | RAF_EVDO_B | RAF_EHRPD;
249         public static final int HS = RAF_HSUPA | RAF_HSDPA | RAF_HSPA | RAF_HSPAP;
250         public static final int WCDMA = HS | RAF_UMTS;
251         // 4G
252         public static final int LTE = RAF_LTE | RAF_LTE_CA;
253         // 5G
254         public static final int NR = RAF_NR;
255     }
256 }
257