• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3#   Copyright 2016 - Google
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16from acts.utils import NexusModelNames
17from acts_contrib.test_utils.tel import tel_defines
18
19
20def rat_family_from_rat(rat_type):
21    return _TelTables.technology_tbl[rat_type]['rat_family']
22
23
24def rat_generation_from_rat(rat_type):
25    return _TelTables.technology_tbl[rat_type]['generation']
26
27
28def network_preference_for_generation(generation, operator, phone_type=None):
29    if not phone_type:
30        return _TelTables.operator_network_tbl[operator][generation][
31            'network_preference']
32    else:
33        return _TelTables.operator_network_tbl_by_phone_type[phone_type][
34            generation]['network_preference']
35
36
37def rat_families_for_network_preference(network_preference):
38    return _TelTables.network_preference_tbl[network_preference][
39        'rat_family_list']
40
41
42def rat_family_for_generation(generation, operator, phone_type=None):
43    if not phone_type:
44        return _TelTables.operator_network_tbl[operator][generation][
45            'rat_family']
46    else:
47        return _TelTables.operator_network_tbl_by_phone_type[phone_type][
48            generation]['rat_family']
49
50
51def operator_name_from_plmn_id(plmn_id):
52    return _TelTables.operator_id_to_name[plmn_id]
53
54
55def operator_name_from_network_name(name):
56    return _TelTables.operator_name_tbl.get("name", name)
57
58
59def is_valid_rat(rat_type):
60    return True if rat_type in _TelTables.technology_tbl else False
61
62
63def is_valid_generation(gen):
64    return True if gen in _TelTables.technology_gen_tbl else False
65
66
67def is_rat_svd_capable(rat):
68    return _TelTables.technology_tbl[rat]["simultaneous_voice_data"]
69
70
71def connection_type_from_type_string(input_string):
72    if input_string in _ConnectionTables.connection_type_tbl:
73        return _ConnectionTables.connection_type_tbl[input_string]
74    return tel_defines.NETWORK_CONNECTION_TYPE_UNKNOWN
75
76
77def is_user_plane_data_type(connection_type):
78    if connection_type in _ConnectionTables.user_plane_data_type:
79        return _ConnectionTables.user_plane_data_type[connection_type]
80    return False
81
82
83# For TMO, to check if voice mail count is correct after leaving a new voice message.
84def check_tmo_voice_mail_count(voice_mail_count_before,
85                               voice_mail_count_after):
86    return (voice_mail_count_after == -1)
87
88
89# For ATT, to check if voice mail count is correct after leaving a new voice message.
90def check_att_voice_mail_count(voice_mail_count_before,
91                               voice_mail_count_after):
92    return (voice_mail_count_after == (voice_mail_count_before + 1))
93
94
95# For SPT, to check if voice mail count is correct after leaving a new voice message.
96def check_spt_voice_mail_count(voice_mail_count_before,
97                               voice_mail_count_after):
98    return (voice_mail_count_after == (voice_mail_count_before + 1))
99
100
101def get_voice_mail_check_number(operator):
102    return _TelTables.voice_mail_number_tbl.get(operator)
103
104
105def get_voice_mail_count_check_function(operator):
106    return _TelTables.voice_mail_count_check_function_tbl.get(
107        operator, check_tmo_voice_mail_count)
108
109
110def get_voice_mail_delete_digit(operator):
111    return _TelTables.voice_mail_delete_digit_tbl.get(operator, "7")
112
113
114def get_allowable_network_preference(operator, phone_type=None):
115    if not phone_type:
116        return _TelTables.allowable_network_preference_tbl[operator]
117    else:
118        return _TelTables.allowable_network_preference_tbl_by_phone_type[
119            phone_type]
120
121
122class _ConnectionTables():
123    connection_type_tbl = {
124        'WIFI': tel_defines.NETWORK_CONNECTION_TYPE_WIFI,
125        'WIFI_P2P': tel_defines.NETWORK_CONNECTION_TYPE_WIFI,
126        'MOBILE': tel_defines.NETWORK_CONNECTION_TYPE_CELL,
127        'MOBILE_DUN': tel_defines.NETWORK_CONNECTION_TYPE_CELL,
128        'MOBILE_HIPRI': tel_defines.NETWORK_CONNECTION_TYPE_HIPRI,
129        # TODO: b/26296489 add support for 'MOBILE_SUPL', 'MOBILE_HIPRI',
130        # 'MOBILE_FOTA', 'MOBILE_IMS', 'MOBILE_CBS', 'MOBILE_IA',
131        # 'MOBILE_EMERGENCY'
132        'MOBILE_MMS': tel_defines.NETWORK_CONNECTION_TYPE_MMS
133    }
134
135    user_plane_data_type = {
136        tel_defines.NETWORK_CONNECTION_TYPE_WIFI: True,
137        tel_defines.NETWORK_CONNECTION_TYPE_CELL: False,
138        tel_defines.NETWORK_CONNECTION_TYPE_MMS: False,
139        tel_defines.NETWORK_CONNECTION_TYPE_UNKNOWN: False
140    }
141
142
143class _TelTables():
144    # Operator id mapping to operator name
145    # Reference: Pages 43-50 in
146    # https://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.212B-2013-PDF-E.pdf [2013]
147
148    operator_name_tbl = {
149        "T-Mobile": tel_defines.CARRIER_TMO,
150        "AT&T": tel_defines.CARRIER_ATT,
151        "Verizon": tel_defines.CARRIER_VZW,
152        "Verizon Wireless": tel_defines.CARRIER_VZW,
153        "Sprint": tel_defines.CARRIER_SPT,
154        "ROGERS": tel_defines.CARRIER_ROGERS,
155        "Videotron PRTNR1": tel_defines.CARRIER_VIDEOTRON,
156        "Bell": tel_defines.CARRIER_BELL,
157        "Koodo": tel_defines.CARRIER_KOODO,
158        "Ntt Docomo" : tel_defines.CARRIER_NTT_DOCOMO,
159        "KDDI" : tel_defines.CARRIER_KDDI,
160        "Rakuten": tel_defines.CARRIER_RAKUTEN,
161        "SBM": tel_defines.CARRIER_SBM
162    }
163    operator_id_to_name = {
164
165        #VZW (Verizon Wireless)
166        '310010': tel_defines.CARRIER_VZW,
167        '310012': tel_defines.CARRIER_VZW,
168        '310013': tel_defines.CARRIER_VZW,
169        '310590': tel_defines.CARRIER_VZW,
170        '310890': tel_defines.CARRIER_VZW,
171        '310910': tel_defines.CARRIER_VZW,
172        '310110': tel_defines.CARRIER_VZW,
173        '311270': tel_defines.CARRIER_VZW,
174        '311271': tel_defines.CARRIER_VZW,
175        '311272': tel_defines.CARRIER_VZW,
176        '311273': tel_defines.CARRIER_VZW,
177        '311274': tel_defines.CARRIER_VZW,
178        '311275': tel_defines.CARRIER_VZW,
179        '311276': tel_defines.CARRIER_VZW,
180        '311277': tel_defines.CARRIER_VZW,
181        '311278': tel_defines.CARRIER_VZW,
182        '311279': tel_defines.CARRIER_VZW,
183        '311280': tel_defines.CARRIER_VZW,
184        '311281': tel_defines.CARRIER_VZW,
185        '311282': tel_defines.CARRIER_VZW,
186        '311283': tel_defines.CARRIER_VZW,
187        '311284': tel_defines.CARRIER_VZW,
188        '311285': tel_defines.CARRIER_VZW,
189        '311286': tel_defines.CARRIER_VZW,
190        '311287': tel_defines.CARRIER_VZW,
191        '311288': tel_defines.CARRIER_VZW,
192        '311289': tel_defines.CARRIER_VZW,
193        '311390': tel_defines.CARRIER_VZW,
194        '311480': tel_defines.CARRIER_VZW,
195        '311481': tel_defines.CARRIER_VZW,
196        '311482': tel_defines.CARRIER_VZW,
197        '311483': tel_defines.CARRIER_VZW,
198        '311484': tel_defines.CARRIER_VZW,
199        '311485': tel_defines.CARRIER_VZW,
200        '311486': tel_defines.CARRIER_VZW,
201        '311487': tel_defines.CARRIER_VZW,
202        '311488': tel_defines.CARRIER_VZW,
203        '311489': tel_defines.CARRIER_VZW,
204
205        #TMO (T-Mobile USA)
206        '310160': tel_defines.CARRIER_TMO,
207        '310200': tel_defines.CARRIER_TMO,
208        '310210': tel_defines.CARRIER_TMO,
209        '310220': tel_defines.CARRIER_TMO,
210        '310230': tel_defines.CARRIER_TMO,
211        '310240': tel_defines.CARRIER_TMO,
212        '310250': tel_defines.CARRIER_TMO,
213        '310260': tel_defines.CARRIER_TMO,
214        '310270': tel_defines.CARRIER_TMO,
215        '310310': tel_defines.CARRIER_TMO,
216        '310490': tel_defines.CARRIER_TMO,
217        '310660': tel_defines.CARRIER_TMO,
218        '310800': tel_defines.CARRIER_TMO,
219
220        #ATT (AT&T and Cingular)
221        '310070': tel_defines.CARRIER_ATT,
222        '310560': tel_defines.CARRIER_ATT,
223        '310670': tel_defines.CARRIER_ATT,
224        '310680': tel_defines.CARRIER_ATT,
225        '310150': tel_defines.CARRIER_ATT,  #Cingular
226        '310170': tel_defines.CARRIER_ATT,  #Cingular
227        '310410': tel_defines.CARRIER_ATT,  #Cingular
228        '311180': tel_defines.CARRIER_ATT,
229        #Cingular Licensee Pacific Telesis Mobile Services, LLC
230
231        #Sprint (and Sprint-Nextel)
232        '310120': tel_defines.CARRIER_SPT,
233        '311490': tel_defines.CARRIER_SPT,
234        '311870': tel_defines.CARRIER_SPT,
235        '311880': tel_defines.CARRIER_SPT,
236        '312190': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
237        '316010': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
238        '23433': tel_defines.CARRIER_EEUK,  #Orange
239        '23434': tel_defines.CARRIER_EEUK,  #Orange
240        '23430': tel_defines.CARRIER_EEUK,  #T-Mobile UK
241        '23431': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
242        '23432': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
243        '23415': tel_defines.CARRIER_VFUK,
244
245        # Google Fi
246        '312580': tel_defines.CARRIER_FI,
247
248        #USCC
249        '311580': tel_defines.CARRIER_USCC,
250
251        #Vodafone (Germany)
252        '26202': tel_defines.CARRIER_GMBH,
253        '26204': tel_defines.CARRIER_GMBH,
254        '26209': tel_defines.CARRIER_GMBH,
255        '26242': tel_defines.CARRIER_GMBH,
256        '26243': tel_defines.CARRIER_GMBH,
257
258        #Vodafone (Italy)
259        '22206': tel_defines.CARRIER_ITA,
260        '22210': tel_defines.CARRIER_ITA,
261
262        #Vodafone (Spain)
263        '21401': tel_defines.CARRIER_ESP,
264        '20406': tel_defines.CARRIER_ESP,
265
266        #Orange (France)
267        '20801': tel_defines.CARRIER_ORG,
268        '20802': tel_defines.CARRIER_ORG,
269        '20891': tel_defines.CARRIER_ORG,
270
271        #Telenor (Norway)
272        '24201': tel_defines.CARRIER_TEL,
273        '24212': tel_defines.CARRIER_TEL,
274
275        #Canada Freedom
276        '302490': tel_defines.CARRIER_FRE,
277
278        #Telstra (Australia)
279        '52501': tel_defines.CARRIER_SING,
280        '50501': tel_defines.CARRIER_TSA
281    }
282
283    technology_gen_tbl = [
284        tel_defines.GEN_2G, tel_defines.GEN_3G, tel_defines.GEN_4G
285    ]
286
287    technology_tbl = {
288        tel_defines.RAT_1XRTT: {
289            'is_voice_rat': True,
290            'is_data_rat': False,
291            'generation': tel_defines.GEN_3G,
292            'simultaneous_voice_data': False,
293            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
294        },
295        tel_defines.RAT_EDGE: {
296            'is_voice_rat': False,
297            'is_data_rat': True,
298            'generation': tel_defines.GEN_2G,
299            'simultaneous_voice_data': False,
300            'rat_family': tel_defines.RAT_FAMILY_GSM
301        },
302        tel_defines.RAT_GPRS: {
303            'is_voice_rat': False,
304            'is_data_rat': True,
305            'generation': tel_defines.GEN_2G,
306            'simultaneous_voice_data': False,
307            'rat_family': tel_defines.RAT_FAMILY_GSM
308        },
309        tel_defines.RAT_GSM: {
310            'is_voice_rat': True,
311            'is_data_rat': False,
312            'generation': tel_defines.GEN_2G,
313            'simultaneous_voice_data': False,
314            'rat_family': tel_defines.RAT_FAMILY_GSM
315        },
316        tel_defines.RAT_UMTS: {
317            'is_voice_rat': True,
318            'is_data_rat': True,
319            'generation': tel_defines.GEN_3G,
320            'simultaneous_voice_data': True,
321            'rat_family': tel_defines.RAT_FAMILY_WCDMA
322        },
323        tel_defines.RAT_WCDMA: {
324            'is_voice_rat': True,
325            'is_data_rat': True,
326            'generation': tel_defines.GEN_3G,
327            'simultaneous_voice_data': True,
328            'rat_family': tel_defines.RAT_FAMILY_WCDMA
329        },
330        tel_defines.RAT_HSDPA: {
331            'is_voice_rat': False,
332            'is_data_rat': True,
333            'generation': tel_defines.GEN_3G,
334            'simultaneous_voice_data': False,
335            'rat_family': tel_defines.RAT_FAMILY_WCDMA
336        },
337        tel_defines.RAT_HSUPA: {
338            'is_voice_rat': False,
339            'is_data_rat': True,
340            'generation': tel_defines.GEN_3G,
341            'simultaneous_voice_data': False,
342            'rat_family': tel_defines.RAT_FAMILY_WCDMA
343        },
344        tel_defines.RAT_CDMA: {
345            'is_voice_rat': True,
346            'is_data_rat': False,
347            'generation': tel_defines.GEN_2G,
348            'simultaneous_voice_data': False,
349            'rat_family': tel_defines.RAT_FAMILY_CDMA
350        },
351        tel_defines.RAT_EVDO: {
352            'is_voice_rat': False,
353            'is_data_rat': True,
354            'generation': tel_defines.GEN_3G,
355            'simultaneous_voice_data': False,
356            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
357        },
358        tel_defines.RAT_EVDO_0: {
359            'is_voice_rat': False,
360            'is_data_rat': True,
361            'generation': tel_defines.GEN_3G,
362            'simultaneous_voice_data': False,
363            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
364        },
365        tel_defines.RAT_EVDO_A: {
366            'is_voice_rat': False,
367            'is_data_rat': True,
368            'generation': tel_defines.GEN_3G,
369            'simultaneous_voice_data': False,
370            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
371        },
372        tel_defines.RAT_EVDO_B: {
373            'is_voice_rat': False,
374            'is_data_rat': True,
375            'generation': tel_defines.GEN_3G,
376            'simultaneous_voice_data': False,
377            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
378        },
379        tel_defines.RAT_IDEN: {
380            'is_voice_rat': False,
381            'is_data_rat': True,
382            'generation': tel_defines.GEN_2G,
383            'simultaneous_voice_data': False,
384            'rat_family': tel_defines.RAT_FAMILY_IDEN
385        },
386        tel_defines.RAT_LTE_CA: {
387            'is_voice_rat': True,
388            'is_data_rat': True,
389            'generation': tel_defines.GEN_4G,
390            'simultaneous_voice_data': True,
391            'rat_family': tel_defines.RAT_FAMILY_LTE
392        },
393        tel_defines.RAT_LTE: {
394            'is_voice_rat': True,
395            'is_data_rat': True,
396            'generation': tel_defines.GEN_4G,
397            'simultaneous_voice_data': True,
398            'rat_family': tel_defines.RAT_FAMILY_LTE
399        },
400        tel_defines.RAT_NR: {
401            'is_voice_rat': True,
402            'is_data_rat': True,
403            'generation': tel_defines.GEN_5G,
404            'simultaneous_voice_data': True,
405            'rat_family': tel_defines.RAT_FAMILY_NR
406        },
407        tel_defines.RAT_NR_SA: {
408            'is_voice_rat': True,
409            'is_data_rat': True,
410            'generation': tel_defines.GEN_5G,
411            'simultaneous_voice_data': True,
412            'rat_family': tel_defines.RAT_FAMILY_NR
413        },
414        tel_defines.RAT_EHRPD: {
415            'is_voice_rat': False,
416            'is_data_rat': True,
417            'generation': tel_defines.GEN_3G,
418            'simultaneous_voice_data': False,
419            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
420        },
421        tel_defines.RAT_HSPA: {
422            'is_voice_rat': False,
423            'is_data_rat': True,
424            'generation': tel_defines.GEN_3G,
425            'simultaneous_voice_data': True,
426            'rat_family': tel_defines.RAT_FAMILY_WCDMA
427        },
428        tel_defines.RAT_HSPAP: {
429            'is_voice_rat': False,
430            'is_data_rat': True,
431            'generation': tel_defines.GEN_3G,
432            'simultaneous_voice_data': True,
433            'rat_family': tel_defines.RAT_FAMILY_WCDMA
434        },
435        tel_defines.RAT_IWLAN: {
436            'is_voice_rat': True,
437            'is_data_rat': True,
438            'generation': tel_defines.GEN_4G,
439            'simultaneous_voice_data': True,
440            'rat_family': tel_defines.RAT_FAMILY_WLAN
441        },
442        tel_defines.RAT_TD_SCDMA: {
443            'is_voice_rat': True,
444            'is_data_rat': True,
445            'generation': tel_defines.GEN_3G,
446            'simultaneous_voice_data': True,
447            'rat_family': tel_defines.RAT_FAMILY_TDSCDMA
448        },
449        tel_defines.RAT_UNKNOWN: {
450            'is_voice_rat': False,
451            'is_data_rat': False,
452            'generation': tel_defines.GEN_UNKNOWN,
453            'simultaneous_voice_data': False,
454            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
455        },
456        tel_defines.RAT_GLOBAL: {
457            'is_voice_rat': False,
458            'is_data_rat': False,
459            'generation': tel_defines.GEN_UNKNOWN,
460            'simultaneous_voice_data': False,
461            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
462        }
463    }
464
465    network_preference_tbl = {
466        tel_defines.NETWORK_MODE_LTE_GSM_WCDMA: {
467            'rat_family_list': [
468                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
469                tel_defines.RAT_FAMILY_GSM
470            ]
471        },
472        tel_defines.NETWORK_MODE_GSM_UMTS: {
473            'rat_family_list':
474            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
475        },
476        tel_defines.NETWORK_MODE_GSM_ONLY: {
477            'rat_family_list': [tel_defines.RAT_FAMILY_GSM]
478        },
479        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO: {
480            'rat_family_list': [
481                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_CDMA2000,
482                tel_defines.RAT_FAMILY_CDMA
483            ]
484        },
485        tel_defines.NETWORK_MODE_CDMA: {
486            'rat_family_list':
487            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
488        },
489        tel_defines.NETWORK_MODE_CDMA_NO_EVDO: {
490            'rat_family_list':
491            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
492        },
493        tel_defines.NETWORK_MODE_WCDMA_PREF: {
494            'rat_family_list':
495            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
496        },
497        tel_defines.NETWORK_MODE_WCDMA_ONLY: {
498            'rat_family_list': [tel_defines.RAT_FAMILY_WCDMA]
499        },
500        tel_defines.NETWORK_MODE_EVDO_NO_CDMA: {
501            'rat_family_list': [tel_defines.RAT_FAMILY_CDMA2000]
502        },
503        tel_defines.NETWORK_MODE_GLOBAL: {
504            'rat_family_list': [
505                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
506                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM,
507                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
508            ]
509        },
510        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA: {
511            'rat_family_list': [
512                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
513                tel_defines.RAT_FAMILY_GSM, tel_defines.RAT_FAMILY_CDMA2000,
514                tel_defines.RAT_FAMILY_CDMA
515            ]
516        },
517        tel_defines.NETWORK_MODE_LTE_ONLY: {
518            'rat_family_list': [tel_defines.RAT_FAMILY_LTE]
519        },
520        tel_defines.NETWORK_MODE_LTE_WCDMA: {
521            'rat_family_list':
522            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA]
523        },
524        tel_defines.NETWORK_MODE_TDSCDMA_ONLY: {
525            'rat_family_list': [tel_defines.RAT_FAMILY_TDSCDMA]
526        },
527        tel_defines.NETWORK_MODE_TDSCDMA_WCDMA: {
528            'rat_family_list':
529            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_WCDMA]
530        },
531        tel_defines.NETWORK_MODE_LTE_TDSCDMA: {
532            'rat_family_list':
533            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA]
534        },
535        tel_defines.NETWORK_MODE_TDSCDMA_GSM: {
536            'rat_family_list':
537            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_GSM]
538        },
539        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM: {
540            'rat_family_list': [
541                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
542                tel_defines.RAT_FAMILY_GSM
543            ]
544        },
545        tel_defines.NETWORK_MODE_TDSCDMA_GSM_WCDMA: {
546            'rat_family_list': [
547                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
548                tel_defines.RAT_FAMILY_GSM
549            ]
550        },
551        tel_defines.NETWORK_MODE_LTE_TDSCDMA_WCDMA: {
552            'rat_family_list': [
553                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
554                tel_defines.RAT_FAMILY_LTE
555            ]
556        },
557        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA: {
558            'rat_family_list': [
559                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
560                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM
561            ]
562        },
563        tel_defines.NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA: {
564            'rat_family_list': [
565                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
566                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
567            ]
568        },
569        tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA: {
570            'rat_family_list': [
571                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
572                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM,
573                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
574            ]
575        }
576    }
577    default_umts_operator_network_tbl = {
578        tel_defines.GEN_5G: {
579            'rat_family': tel_defines.RAT_FAMILY_NR,
580            'network_preference': tel_defines.NETWORK_MODE_NR_LTE_GSM_WCDMA
581        },
582        tel_defines.GEN_4G: {
583            'rat_family': tel_defines.RAT_FAMILY_LTE,
584            'network_preference':
585            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
586        },
587        tel_defines.GEN_3G: {
588            'rat_family': tel_defines.RAT_FAMILY_WCDMA,
589            'network_preference': tel_defines.NETWORK_MODE_WCDMA_ONLY
590        },
591        tel_defines.GEN_2G: {
592            'rat_family': tel_defines.RAT_FAMILY_GSM,
593            'network_preference': tel_defines.NETWORK_MODE_GSM_ONLY
594        }
595    }
596    default_cdma_operator_network_tbl = {
597        tel_defines.GEN_5G: {
598            'rat_family': tel_defines.RAT_FAMILY_NR,
599            'network_preference': tel_defines.NETWORK_MODE_NR_LTE_GSM_WCDMA
600        },
601        tel_defines.GEN_4G: {
602            'rat_family': tel_defines.RAT_FAMILY_LTE,
603            'network_preference':
604            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
605        },
606        tel_defines.GEN_3G: {
607            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
608            'network_preference': tel_defines.NETWORK_MODE_CDMA
609        },
610        tel_defines.GEN_2G: {
611            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
612            'network_preference': tel_defines.NETWORK_MODE_CDMA_NO_EVDO
613        }
614    }
615    operator_network_tbl = {
616        tel_defines.CARRIER_TMO: default_umts_operator_network_tbl,
617        tel_defines.CARRIER_ATT: default_umts_operator_network_tbl,
618        tel_defines.CARRIER_VZW: default_cdma_operator_network_tbl,
619        tel_defines.CARRIER_SPT: default_cdma_operator_network_tbl,
620        tel_defines.CARRIER_EEUK: default_umts_operator_network_tbl,
621        tel_defines.CARRIER_VFUK: default_umts_operator_network_tbl,
622        tel_defines.CARRIER_GMBH: default_umts_operator_network_tbl,
623        tel_defines.CARRIER_ITA: default_umts_operator_network_tbl,
624        tel_defines.CARRIER_ESP: default_umts_operator_network_tbl,
625        tel_defines.CARRIER_ORG: default_umts_operator_network_tbl,
626        tel_defines.CARRIER_TEL: default_umts_operator_network_tbl,
627        tel_defines.CARRIER_TSA: default_umts_operator_network_tbl
628    }
629    operator_network_tbl_by_phone_type = {
630        tel_defines.PHONE_TYPE_GSM: default_umts_operator_network_tbl,
631        tel_defines.PHONE_TYPE_CDMA: default_cdma_operator_network_tbl
632    }
633
634    umts_allowable_network_preference_tbl = \
635        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
636         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
637         tel_defines.NETWORK_MODE_LTE_GSM_WCDMA,
638         tel_defines.NETWORK_MODE_WCDMA_PREF,
639         tel_defines.NETWORK_MODE_WCDMA_ONLY,
640         tel_defines.NETWORK_MODE_GSM_ONLY]
641
642    cdma_allowable_network_preference_tbl = \
643        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
644         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
645         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO,
646         tel_defines.NETWORK_MODE_CDMA,
647         tel_defines.NETWORK_MODE_CDMA_NO_EVDO,
648         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA]
649
650    allowable_network_preference_tbl = {
651        tel_defines.CARRIER_TMO: umts_allowable_network_preference_tbl,
652        tel_defines.CARRIER_ATT: umts_allowable_network_preference_tbl,
653        tel_defines.CARRIER_VZW: cdma_allowable_network_preference_tbl,
654        tel_defines.CARRIER_SPT: cdma_allowable_network_preference_tbl,
655        tel_defines.CARRIER_EEUK: umts_allowable_network_preference_tbl,
656        tel_defines.CARRIER_VFUK: umts_allowable_network_preference_tbl
657    }
658    allowable_network_preference_tbl_by_phone_type = {
659        tel_defines.PHONE_TYPE_GSM: umts_allowable_network_preference_tbl,
660        tel_defines.PHONE_TYPE_CDMA: cdma_allowable_network_preference_tbl
661    }
662
663    voice_mail_number_tbl = {
664        tel_defines.CARRIER_TMO: "123",
665        tel_defines.CARRIER_VZW: "*86",
666        tel_defines.CARRIER_ATT: None,
667        tel_defines.CARRIER_SPT: None,
668        tel_defines.CARRIER_EEUK: "+447953222222",
669        tel_defines.CARRIER_NTT_DOCOMO: "1417",
670        tel_defines.CARRIER_KDDI: "1417",
671        tel_defines.CARRIER_RAKUTEN: "1417",
672        tel_defines.CARRIER_SBM: "1416"
673    }
674
675    voice_mail_count_check_function_tbl = {
676        tel_defines.CARRIER_TMO: check_tmo_voice_mail_count,
677        tel_defines.CARRIER_ATT: check_att_voice_mail_count,
678        tel_defines.CARRIER_SPT: check_spt_voice_mail_count
679    }
680
681    voice_mail_delete_digit_tbl = {
682        tel_defines.CARRIER_EEUK: "3",
683        tel_defines.CARRIER_NTT_DOCOMO: "3",
684        tel_defines.CARRIER_KDDI: "9"
685    }
686
687
688device_capabilities = {
689    NexusModelNames.ONE:
690    [tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_MSIM],
691    NexusModelNames.N5: [tel_defines.CAPABILITY_PHONE],
692    NexusModelNames.N5v2: [
693        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
694        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
695    ],
696    NexusModelNames.N6: [
697        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
698        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
699    ],
700    NexusModelNames.N6v2: [
701        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
702        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
703    ],
704    NexusModelNames.N5v3: [
705        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
706        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
707        tel_defines.CAPABILITY_VT
708    ],
709    NexusModelNames.N6v3: [
710        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
711        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
712        tel_defines.CAPABILITY_VT
713    ],
714    "default": [
715        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
716        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
717        tel_defines.CAPABILITY_VT
718    ]
719}
720
721operator_capabilities = {
722    tel_defines.CARRIER_VZW: [
723        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
724        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
725        tel_defines.CAPABILITY_VT
726    ],
727    tel_defines.CARRIER_ATT:
728    [tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE],
729    tel_defines.CARRIER_TMO: [
730        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
731        tel_defines.CAPABILITY_WFC, tel_defines.CAPABILITY_VT
732    ],
733    tel_defines.CARRIER_SPT: [tel_defines.CAPABILITY_PHONE],
734    tel_defines.CARRIER_ROGERS: [
735        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
736        tel_defines.CAPABILITY_WFC
737    ],
738    tel_defines.CARRIER_EEUK: [
739        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
740        tel_defines.CAPABILITY_WFC
741    ],
742    tel_defines.CARRIER_VFUK: [tel_defines.CAPABILITY_PHONE],
743    "default": [tel_defines.CAPABILITY_PHONE]
744}
745