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.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    }
159    operator_id_to_name = {
160
161        #VZW (Verizon Wireless)
162        '310010': tel_defines.CARRIER_VZW,
163        '310012': tel_defines.CARRIER_VZW,
164        '310013': tel_defines.CARRIER_VZW,
165        '310590': tel_defines.CARRIER_VZW,
166        '310890': tel_defines.CARRIER_VZW,
167        '310910': tel_defines.CARRIER_VZW,
168        '310110': tel_defines.CARRIER_VZW,
169        '311270': tel_defines.CARRIER_VZW,
170        '311271': tel_defines.CARRIER_VZW,
171        '311272': tel_defines.CARRIER_VZW,
172        '311273': tel_defines.CARRIER_VZW,
173        '311274': tel_defines.CARRIER_VZW,
174        '311275': tel_defines.CARRIER_VZW,
175        '311276': tel_defines.CARRIER_VZW,
176        '311277': tel_defines.CARRIER_VZW,
177        '311278': tel_defines.CARRIER_VZW,
178        '311279': tel_defines.CARRIER_VZW,
179        '311280': tel_defines.CARRIER_VZW,
180        '311281': tel_defines.CARRIER_VZW,
181        '311282': tel_defines.CARRIER_VZW,
182        '311283': tel_defines.CARRIER_VZW,
183        '311284': tel_defines.CARRIER_VZW,
184        '311285': tel_defines.CARRIER_VZW,
185        '311286': tel_defines.CARRIER_VZW,
186        '311287': tel_defines.CARRIER_VZW,
187        '311288': tel_defines.CARRIER_VZW,
188        '311289': tel_defines.CARRIER_VZW,
189        '311390': tel_defines.CARRIER_VZW,
190        '311480': tel_defines.CARRIER_VZW,
191        '311481': tel_defines.CARRIER_VZW,
192        '311482': tel_defines.CARRIER_VZW,
193        '311483': tel_defines.CARRIER_VZW,
194        '311484': tel_defines.CARRIER_VZW,
195        '311485': tel_defines.CARRIER_VZW,
196        '311486': tel_defines.CARRIER_VZW,
197        '311487': tel_defines.CARRIER_VZW,
198        '311488': tel_defines.CARRIER_VZW,
199        '311489': tel_defines.CARRIER_VZW,
200
201        #TMO (T-Mobile USA)
202        '310160': tel_defines.CARRIER_TMO,
203        '310200': tel_defines.CARRIER_TMO,
204        '310210': tel_defines.CARRIER_TMO,
205        '310220': tel_defines.CARRIER_TMO,
206        '310230': tel_defines.CARRIER_TMO,
207        '310240': tel_defines.CARRIER_TMO,
208        '310250': tel_defines.CARRIER_TMO,
209        '310260': tel_defines.CARRIER_TMO,
210        '310270': tel_defines.CARRIER_TMO,
211        '310310': tel_defines.CARRIER_TMO,
212        '310490': tel_defines.CARRIER_TMO,
213        '310660': tel_defines.CARRIER_TMO,
214        '310800': tel_defines.CARRIER_TMO,
215
216        #ATT (AT&T and Cingular)
217        '310070': tel_defines.CARRIER_ATT,
218        '310560': tel_defines.CARRIER_ATT,
219        '310670': tel_defines.CARRIER_ATT,
220        '310680': tel_defines.CARRIER_ATT,
221        '310150': tel_defines.CARRIER_ATT,  #Cingular
222        '310170': tel_defines.CARRIER_ATT,  #Cingular
223        '310410': tel_defines.CARRIER_ATT,  #Cingular
224        '311180': tel_defines.CARRIER_ATT,
225        #Cingular Licensee Pacific Telesis Mobile Services, LLC
226
227        #Sprint (and Sprint-Nextel)
228        '310120': tel_defines.CARRIER_SPT,
229        '311490': tel_defines.CARRIER_SPT,
230        '311870': tel_defines.CARRIER_SPT,
231        '311880': tel_defines.CARRIER_SPT,
232        '312190': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
233        '316010': tel_defines.CARRIER_SPT,  #Sprint-Nextel Communications Inc
234        '23433': tel_defines.CARRIER_EEUK,  #Orange
235        '23434': tel_defines.CARRIER_EEUK,  #Orange
236        '23430': tel_defines.CARRIER_EEUK,  #T-Mobile UK
237        '23431': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
238        '23432': tel_defines.CARRIER_EEUK,  #Virgin Mobile (MVNO)
239        '23415': tel_defines.CARRIER_VFUK,
240
241        # Google Fi
242        '312580': tel_defines.CARRIER_FI,
243
244        #USCC
245        '311580': tel_defines.CARRIER_USCC,
246
247        #Vodafone (Germany)
248        '26202': tel_defines.CARRIER_GMBH,
249        '26204': tel_defines.CARRIER_GMBH,
250        '26209': tel_defines.CARRIER_GMBH,
251        '26242': tel_defines.CARRIER_GMBH,
252        '26243': tel_defines.CARRIER_GMBH,
253
254        #Vodafone (Italy)
255        '22206': tel_defines.CARRIER_ITA,
256        '22210': tel_defines.CARRIER_ITA,
257
258        #Vodafone (Spain)
259        '21401': tel_defines.CARRIER_ESP,
260        '20406': tel_defines.CARRIER_ESP,
261
262        #Orange (France)
263        '20801': tel_defines.CARRIER_ORG,
264        '20802': tel_defines.CARRIER_ORG,
265        '20891': tel_defines.CARRIER_ORG,
266
267        #Telenor (Norway)
268        '24201': tel_defines.CARRIER_TEL,
269        '24212': tel_defines.CARRIER_TEL,
270
271        #Canada Freedom
272        '302490': tel_defines.CARRIER_FRE,
273
274        #Telstra (Australia)
275        '50501': tel_defines.CARRIER_TSA
276    }
277
278    technology_gen_tbl = [
279        tel_defines.GEN_2G, tel_defines.GEN_3G, tel_defines.GEN_4G
280    ]
281
282    technology_tbl = {
283        tel_defines.RAT_1XRTT: {
284            'is_voice_rat': True,
285            'is_data_rat': False,
286            'generation': tel_defines.GEN_3G,
287            'simultaneous_voice_data': False,
288            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
289        },
290        tel_defines.RAT_EDGE: {
291            'is_voice_rat': False,
292            'is_data_rat': True,
293            'generation': tel_defines.GEN_2G,
294            'simultaneous_voice_data': False,
295            'rat_family': tel_defines.RAT_FAMILY_GSM
296        },
297        tel_defines.RAT_GPRS: {
298            'is_voice_rat': False,
299            'is_data_rat': True,
300            'generation': tel_defines.GEN_2G,
301            'simultaneous_voice_data': False,
302            'rat_family': tel_defines.RAT_FAMILY_GSM
303        },
304        tel_defines.RAT_GSM: {
305            'is_voice_rat': True,
306            'is_data_rat': False,
307            'generation': tel_defines.GEN_2G,
308            'simultaneous_voice_data': False,
309            'rat_family': tel_defines.RAT_FAMILY_GSM
310        },
311        tel_defines.RAT_UMTS: {
312            'is_voice_rat': True,
313            'is_data_rat': True,
314            'generation': tel_defines.GEN_3G,
315            'simultaneous_voice_data': True,
316            'rat_family': tel_defines.RAT_FAMILY_WCDMA
317        },
318        tel_defines.RAT_WCDMA: {
319            'is_voice_rat': True,
320            'is_data_rat': True,
321            'generation': tel_defines.GEN_3G,
322            'simultaneous_voice_data': True,
323            'rat_family': tel_defines.RAT_FAMILY_WCDMA
324        },
325        tel_defines.RAT_HSDPA: {
326            'is_voice_rat': False,
327            'is_data_rat': True,
328            'generation': tel_defines.GEN_3G,
329            'simultaneous_voice_data': False,
330            'rat_family': tel_defines.RAT_FAMILY_WCDMA
331        },
332        tel_defines.RAT_HSUPA: {
333            'is_voice_rat': False,
334            'is_data_rat': True,
335            'generation': tel_defines.GEN_3G,
336            'simultaneous_voice_data': False,
337            'rat_family': tel_defines.RAT_FAMILY_WCDMA
338        },
339        tel_defines.RAT_CDMA: {
340            'is_voice_rat': True,
341            'is_data_rat': False,
342            'generation': tel_defines.GEN_2G,
343            'simultaneous_voice_data': False,
344            'rat_family': tel_defines.RAT_FAMILY_CDMA
345        },
346        tel_defines.RAT_EVDO: {
347            'is_voice_rat': False,
348            'is_data_rat': True,
349            'generation': tel_defines.GEN_3G,
350            'simultaneous_voice_data': False,
351            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
352        },
353        tel_defines.RAT_EVDO_0: {
354            'is_voice_rat': False,
355            'is_data_rat': True,
356            'generation': tel_defines.GEN_3G,
357            'simultaneous_voice_data': False,
358            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
359        },
360        tel_defines.RAT_EVDO_A: {
361            'is_voice_rat': False,
362            'is_data_rat': True,
363            'generation': tel_defines.GEN_3G,
364            'simultaneous_voice_data': False,
365            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
366        },
367        tel_defines.RAT_EVDO_B: {
368            'is_voice_rat': False,
369            'is_data_rat': True,
370            'generation': tel_defines.GEN_3G,
371            'simultaneous_voice_data': False,
372            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
373        },
374        tel_defines.RAT_IDEN: {
375            'is_voice_rat': False,
376            'is_data_rat': True,
377            'generation': tel_defines.GEN_2G,
378            'simultaneous_voice_data': False,
379            'rat_family': tel_defines.RAT_FAMILY_IDEN
380        },
381        tel_defines.RAT_LTE_CA: {
382            'is_voice_rat': True,
383            'is_data_rat': True,
384            'generation': tel_defines.GEN_4G,
385            'simultaneous_voice_data': True,
386            'rat_family': tel_defines.RAT_FAMILY_LTE
387        },
388        tel_defines.RAT_LTE: {
389            'is_voice_rat': True,
390            'is_data_rat': True,
391            'generation': tel_defines.GEN_4G,
392            'simultaneous_voice_data': True,
393            'rat_family': tel_defines.RAT_FAMILY_LTE
394        },
395        tel_defines.RAT_EHRPD: {
396            'is_voice_rat': False,
397            'is_data_rat': True,
398            'generation': tel_defines.GEN_3G,
399            'simultaneous_voice_data': False,
400            'rat_family': tel_defines.RAT_FAMILY_CDMA2000
401        },
402        tel_defines.RAT_HSPA: {
403            'is_voice_rat': False,
404            'is_data_rat': True,
405            'generation': tel_defines.GEN_3G,
406            'simultaneous_voice_data': True,
407            'rat_family': tel_defines.RAT_FAMILY_WCDMA
408        },
409        tel_defines.RAT_HSPAP: {
410            'is_voice_rat': False,
411            'is_data_rat': True,
412            'generation': tel_defines.GEN_3G,
413            'simultaneous_voice_data': True,
414            'rat_family': tel_defines.RAT_FAMILY_WCDMA
415        },
416        tel_defines.RAT_IWLAN: {
417            'is_voice_rat': True,
418            'is_data_rat': True,
419            'generation': tel_defines.GEN_4G,
420            'simultaneous_voice_data': True,
421            'rat_family': tel_defines.RAT_FAMILY_WLAN
422        },
423        tel_defines.RAT_TD_SCDMA: {
424            'is_voice_rat': True,
425            'is_data_rat': True,
426            'generation': tel_defines.GEN_3G,
427            'simultaneous_voice_data': True,
428            'rat_family': tel_defines.RAT_FAMILY_TDSCDMA
429        },
430        tel_defines.RAT_UNKNOWN: {
431            'is_voice_rat': False,
432            'is_data_rat': False,
433            'generation': tel_defines.GEN_UNKNOWN,
434            'simultaneous_voice_data': False,
435            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
436        },
437        tel_defines.RAT_GLOBAL: {
438            'is_voice_rat': False,
439            'is_data_rat': False,
440            'generation': tel_defines.GEN_UNKNOWN,
441            'simultaneous_voice_data': False,
442            'rat_family': tel_defines.RAT_FAMILY_UNKNOWN
443        }
444    }
445
446    network_preference_tbl = {
447        tel_defines.NETWORK_MODE_LTE_GSM_WCDMA: {
448            'rat_family_list': [
449                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
450                tel_defines.RAT_FAMILY_GSM
451            ]
452        },
453        tel_defines.NETWORK_MODE_GSM_UMTS: {
454            'rat_family_list':
455            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
456        },
457        tel_defines.NETWORK_MODE_GSM_ONLY: {
458            'rat_family_list': [tel_defines.RAT_FAMILY_GSM]
459        },
460        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO: {
461            'rat_family_list': [
462                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_CDMA2000,
463                tel_defines.RAT_FAMILY_CDMA
464            ]
465        },
466        tel_defines.NETWORK_MODE_CDMA: {
467            'rat_family_list':
468            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
469        },
470        tel_defines.NETWORK_MODE_CDMA_NO_EVDO: {
471            'rat_family_list':
472            [tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA]
473        },
474        tel_defines.NETWORK_MODE_WCDMA_PREF: {
475            'rat_family_list':
476            [tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM]
477        },
478        tel_defines.NETWORK_MODE_WCDMA_ONLY: {
479            'rat_family_list': [tel_defines.RAT_FAMILY_WCDMA]
480        },
481        tel_defines.NETWORK_MODE_EVDO_NO_CDMA: {
482            'rat_family_list': [tel_defines.RAT_FAMILY_CDMA2000]
483        },
484        tel_defines.NETWORK_MODE_GLOBAL: {
485            'rat_family_list': [
486                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
487                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_GSM,
488                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
489            ]
490        },
491        tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA: {
492            'rat_family_list': [
493                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA,
494                tel_defines.RAT_FAMILY_GSM, tel_defines.RAT_FAMILY_CDMA2000,
495                tel_defines.RAT_FAMILY_CDMA
496            ]
497        },
498        tel_defines.NETWORK_MODE_LTE_ONLY: {
499            'rat_family_list': [tel_defines.RAT_FAMILY_LTE]
500        },
501        tel_defines.NETWORK_MODE_LTE_WCDMA: {
502            'rat_family_list':
503            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_WCDMA]
504        },
505        tel_defines.NETWORK_MODE_TDSCDMA_ONLY: {
506            'rat_family_list': [tel_defines.RAT_FAMILY_TDSCDMA]
507        },
508        tel_defines.NETWORK_MODE_TDSCDMA_WCDMA: {
509            'rat_family_list':
510            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_WCDMA]
511        },
512        tel_defines.NETWORK_MODE_LTE_TDSCDMA: {
513            'rat_family_list':
514            [tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA]
515        },
516        tel_defines.NETWORK_MODE_TDSCDMA_GSM: {
517            'rat_family_list':
518            [tel_defines.RAT_FAMILY_TDSCDMA, tel_defines.RAT_FAMILY_GSM]
519        },
520        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM: {
521            'rat_family_list': [
522                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_TDSCDMA,
523                tel_defines.RAT_FAMILY_GSM
524            ]
525        },
526        tel_defines.NETWORK_MODE_TDSCDMA_GSM_WCDMA: {
527            'rat_family_list': [
528                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
529                tel_defines.RAT_FAMILY_GSM
530            ]
531        },
532        tel_defines.NETWORK_MODE_LTE_TDSCDMA_WCDMA: {
533            'rat_family_list': [
534                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
535                tel_defines.RAT_FAMILY_LTE
536            ]
537        },
538        tel_defines.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA: {
539            'rat_family_list': [
540                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
541                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM
542            ]
543        },
544        tel_defines.NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA: {
545            'rat_family_list': [
546                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
547                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
548            ]
549        },
550        tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA: {
551            'rat_family_list': [
552                tel_defines.RAT_FAMILY_WCDMA, tel_defines.RAT_FAMILY_TDSCDMA,
553                tel_defines.RAT_FAMILY_LTE, tel_defines.RAT_FAMILY_GSM,
554                tel_defines.RAT_FAMILY_CDMA2000, tel_defines.RAT_FAMILY_CDMA
555            ]
556        }
557    }
558    default_umts_operator_network_tbl = {
559        tel_defines.GEN_4G: {
560            'rat_family': tel_defines.RAT_FAMILY_LTE,
561            'network_preference':
562            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
563        },
564        tel_defines.GEN_3G: {
565            'rat_family': tel_defines.RAT_FAMILY_WCDMA,
566            'network_preference': tel_defines.NETWORK_MODE_WCDMA_ONLY
567        },
568        tel_defines.GEN_2G: {
569            'rat_family': tel_defines.RAT_FAMILY_GSM,
570            'network_preference': tel_defines.NETWORK_MODE_GSM_ONLY
571        }
572    }
573    default_cdma_operator_network_tbl = {
574        tel_defines.GEN_4G: {
575            'rat_family': tel_defines.RAT_FAMILY_LTE,
576            'network_preference':
577            tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
578        },
579        tel_defines.GEN_3G: {
580            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
581            'network_preference': tel_defines.NETWORK_MODE_CDMA
582        },
583        tel_defines.GEN_2G: {
584            'rat_family': tel_defines.RAT_FAMILY_CDMA2000,
585            'network_preference': tel_defines.NETWORK_MODE_CDMA_NO_EVDO
586        }
587    }
588    operator_network_tbl = {
589        tel_defines.CARRIER_TMO: default_umts_operator_network_tbl,
590        tel_defines.CARRIER_ATT: default_umts_operator_network_tbl,
591        tel_defines.CARRIER_VZW: default_cdma_operator_network_tbl,
592        tel_defines.CARRIER_SPT: default_cdma_operator_network_tbl,
593        tel_defines.CARRIER_EEUK: default_umts_operator_network_tbl,
594        tel_defines.CARRIER_VFUK: default_umts_operator_network_tbl,
595        tel_defines.CARRIER_GMBH: default_umts_operator_network_tbl,
596        tel_defines.CARRIER_ITA: default_umts_operator_network_tbl,
597        tel_defines.CARRIER_ESP: default_umts_operator_network_tbl,
598        tel_defines.CARRIER_ORG: default_umts_operator_network_tbl,
599        tel_defines.CARRIER_TEL: default_umts_operator_network_tbl,
600        tel_defines.CARRIER_TSA: default_umts_operator_network_tbl
601    }
602    operator_network_tbl_by_phone_type = {
603        tel_defines.PHONE_TYPE_GSM: default_umts_operator_network_tbl,
604        tel_defines.PHONE_TYPE_CDMA: default_cdma_operator_network_tbl
605    }
606
607    umts_allowable_network_preference_tbl = \
608        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
609         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
610         tel_defines.NETWORK_MODE_LTE_GSM_WCDMA,
611         tel_defines.NETWORK_MODE_WCDMA_PREF,
612         tel_defines.NETWORK_MODE_WCDMA_ONLY,
613         tel_defines.NETWORK_MODE_GSM_ONLY]
614
615    cdma_allowable_network_preference_tbl = \
616        [tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
617         tel_defines.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA,
618         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO,
619         tel_defines.NETWORK_MODE_CDMA,
620         tel_defines.NETWORK_MODE_CDMA_NO_EVDO,
621         tel_defines.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA]
622
623    allowable_network_preference_tbl = {
624        tel_defines.CARRIER_TMO: umts_allowable_network_preference_tbl,
625        tel_defines.CARRIER_ATT: umts_allowable_network_preference_tbl,
626        tel_defines.CARRIER_VZW: cdma_allowable_network_preference_tbl,
627        tel_defines.CARRIER_SPT: cdma_allowable_network_preference_tbl,
628        tel_defines.CARRIER_EEUK: umts_allowable_network_preference_tbl,
629        tel_defines.CARRIER_VFUK: umts_allowable_network_preference_tbl
630    }
631    allowable_network_preference_tbl_by_phone_type = {
632        tel_defines.PHONE_TYPE_GSM: umts_allowable_network_preference_tbl,
633        tel_defines.PHONE_TYPE_CDMA: cdma_allowable_network_preference_tbl
634    }
635
636    voice_mail_number_tbl = {
637        tel_defines.CARRIER_TMO: "123",
638        tel_defines.CARRIER_VZW: "*86",
639        tel_defines.CARRIER_ATT: None,
640        tel_defines.CARRIER_SPT: None,
641        tel_defines.CARRIER_EEUK: "+447953222222"
642    }
643
644    voice_mail_count_check_function_tbl = {
645        tel_defines.CARRIER_TMO: check_tmo_voice_mail_count,
646        tel_defines.CARRIER_ATT: check_att_voice_mail_count,
647        tel_defines.CARRIER_SPT: check_spt_voice_mail_count
648    }
649
650    voice_mail_delete_digit_tbl = {tel_defines.CARRIER_EEUK: "3"}
651
652
653device_capabilities = {
654    NexusModelNames.ONE:
655    [tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_MSIM],
656    NexusModelNames.N5: [tel_defines.CAPABILITY_PHONE],
657    NexusModelNames.N5v2: [
658        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
659        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
660    ],
661    NexusModelNames.N6: [
662        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
663        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
664    ],
665    NexusModelNames.N6v2: [
666        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
667        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC
668    ],
669    NexusModelNames.N5v3: [
670        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
671        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
672        tel_defines.CAPABILITY_VT
673    ],
674    NexusModelNames.N6v3: [
675        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
676        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
677        tel_defines.CAPABILITY_VT
678    ],
679    "default": [
680        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
681        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
682        tel_defines.CAPABILITY_VT
683    ]
684}
685
686operator_capabilities = {
687    tel_defines.CARRIER_VZW: [
688        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_OMADM,
689        tel_defines.CAPABILITY_VOLTE, tel_defines.CAPABILITY_WFC,
690        tel_defines.CAPABILITY_VT
691    ],
692    tel_defines.CARRIER_ATT:
693    [tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE],
694    tel_defines.CARRIER_TMO: [
695        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
696        tel_defines.CAPABILITY_WFC, tel_defines.CAPABILITY_VT
697    ],
698    tel_defines.CARRIER_SPT: [tel_defines.CAPABILITY_PHONE],
699    tel_defines.CARRIER_ROGERS: [
700        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
701        tel_defines.CAPABILITY_WFC
702    ],
703    tel_defines.CARRIER_EEUK: [
704        tel_defines.CAPABILITY_PHONE, tel_defines.CAPABILITY_VOLTE,
705        tel_defines.CAPABILITY_WFC
706    ],
707    tel_defines.CARRIER_VFUK: [tel_defines.CAPABILITY_PHONE],
708    "default": [tel_defines.CAPABILITY_PHONE]
709}
710