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.
16
17###############################################
18# TIMERS
19###############################################
20# Max time to wait for phone data/network connection state update
21MAX_WAIT_TIME_CONNECTION_STATE_UPDATE = 60
22
23# Max time to wait for network reselection
24MAX_WAIT_TIME_NW_SELECTION = 180
25
26# Max time to wait for call drop
27MAX_WAIT_TIME_CALL_DROP = 60
28
29# Wait time between state check retry
30WAIT_TIME_BETWEEN_STATE_CHECK = 5
31
32# Max wait time for state change
33MAX_WAIT_TIME_FOR_STATE_CHANGE = 60
34
35# Max time to wait after caller make a call and before
36# callee start ringing
37MAX_WAIT_TIME_CALLEE_RINGING = 90
38
39# country code list
40COUNTRY_CODE_LIST = [
41    "+1", "+44", "+39", "+61", "+49", "+34", "+33", "+47", "+246", "+86",
42    "+850", "+81"
43]
44
45# default pin/password
46DEFAULT_DEVICE_PASSWORD = "1111"
47
48# Wait time after enterring puk code
49WAIT_TIME_SUPPLY_PUK_CODE = 30
50
51# Max time to wait after caller make a call and before
52# callee start ringing
53MAX_WAIT_TIME_ACCEPT_CALL_TO_OFFHOOK_EVENT = 30
54
55# Max time to wait for "onCallStatehangedIdle" event after reject or ignore
56# incoming call
57MAX_WAIT_TIME_CALL_IDLE_EVENT = 60
58
59# Max time to wait after initiating a call for telecom to report in-call
60MAX_WAIT_TIME_CALL_INITIATION = 90
61
62# Time to wait after change Mode Pref for Stress Test
63WAIT_TIME_AFTER_MODE_CHANGE = 60
64
65# Max time to wait for Carrier Config Version to Update in mins
66WAIT_TIME_FOR_CARRIERCONFIG_CHANGE = 20
67
68# Max time to wait after toggle airplane mode and before
69# get expected event
70MAX_WAIT_TIME_AIRPLANEMODE_EVENT = 90
71
72# Max time to wait after device sent an SMS and before
73# get "onSmsSentSuccess" event
74MAX_WAIT_TIME_SMS_SENT_SUCCESS = 60
75
76# Max time to wait after MT SMS was sent and before device
77# actually receive this MT SMS.
78MAX_WAIT_TIME_SMS_RECEIVE = 120
79
80# Max time to wait for IMS registration
81MAX_WAIT_TIME_IMS_REGISTRATION = 120
82
83# TODO: b/26338156 MAX_WAIT_TIME_VOLTE_ENABLED and MAX_WAIT_TIME_WFC_ENABLED should only
84# be used for wait after IMS registration.
85
86# Max time to wait for VoLTE enabled flag to be True
87MAX_WAIT_TIME_VOLTE_ENABLED = MAX_WAIT_TIME_IMS_REGISTRATION + 60
88
89# Max time to wait for WFC enabled flag to be True
90MAX_WAIT_TIME_WFC_ENABLED = MAX_WAIT_TIME_IMS_REGISTRATION + 120
91
92# Max time to wait for WFC enabled flag to be False
93MAX_WAIT_TIME_WFC_DISABLED = 60
94
95# Max time to wait for WiFi Manager to Connect to an AP
96MAX_WAIT_TIME_WIFI_CONNECTION = 30
97
98# Max time to wait for Video Session Modify Messaging
99MAX_WAIT_TIME_VIDEO_SESSION_EVENT = 10
100
101# Max time to wait after a network connection for ConnectivityManager to
102# report a working user plane data connection
103MAX_WAIT_TIME_USER_PLANE_DATA = 20
104
105# Max time to wait for tethering entitlement check
106MAX_WAIT_TIME_TETHERING_ENTITLEMENT_CHECK = 60
107
108# Max time to wait for voice mail count report correct result.
109MAX_WAIT_TIME_VOICE_MAIL_COUNT = 90
110
111# Max time to wait for data SIM change
112MAX_WAIT_TIME_DATA_SUB_CHANGE = 150
113
114# Max time to wait for telecom Ringing status after receive ringing event
115MAX_WAIT_TIME_TELECOM_RINGING = 5
116
117# Max time to wait for phone get provisioned.
118MAX_WAIT_TIME_PROVISIONING = 300
119
120# Time to wait after call setup before declaring
121# that the call is actually successful
122WAIT_TIME_IN_CALL = 30
123
124# (For IMS, e.g. VoLTE-VoLTE, WFC-WFC, VoLTE-WFC test only)
125# Time to wait after call setup before declaring
126# that the call is actually successful
127WAIT_TIME_IN_CALL_FOR_IMS = 30
128
129# Time to wait after phone receive incoming call before phone reject this call.
130WAIT_TIME_REJECT_CALL = 2
131
132# Time to leave a voice message after callee reject the incoming call
133WAIT_TIME_LEAVE_VOICE_MAIL = 30
134
135# Time to wait after accept video call and before checking state
136WAIT_TIME_ACCEPT_VIDEO_CALL_TO_CHECK_STATE = 2
137
138# Time delay to ensure user actions are performed in
139# 'human' time rather than at the speed of the script
140WAIT_TIME_ANDROID_STATE_SETTLING = 1
141
142# Time to wait after registration to ensure the phone
143# has sufficient time to reconfigure based on new network
144WAIT_TIME_BETWEEN_REG_AND_CALL = 5
145
146# Wait time for data pdn to be up on CBRS
147WAIT_TIME_FOR_CBRS_DATA_SWITCH = 60
148
149# Time to wait for 1xrtt voice attach check
150# After DUT voice network type report 1xrtt (from unknown), it need to wait for
151# several seconds before the DUT can receive incoming call.
152WAIT_TIME_1XRTT_VOICE_ATTACH = 30
153
154# Time to wait for data status change during wifi tethering,.
155WAIT_TIME_DATA_STATUS_CHANGE_DURING_WIFI_TETHERING = 30
156
157# Time to wait for rssi calibration.
158# This is the delay between <WiFi Connected> and <Turn on Screen to get RSSI>.
159WAIT_TIME_WIFI_RSSI_CALIBRATION_WIFI_CONNECTED = 10
160# This is the delay between <Turn on Screen> and <Call API to get WiFi RSSI>.
161WAIT_TIME_WIFI_RSSI_CALIBRATION_SCREEN_ON = 2
162
163# Time to wait for each operation on voice mail box.
164WAIT_TIME_VOICE_MAIL_SERVER_RESPONSE = 10
165
166# Time to wait for radio to up and running after reboot
167WAIT_TIME_AFTER_REBOOT = 10
168
169# Time to wait for radio to up and running after force crash
170WAIT_TIME_AFTER_CRASH = 60
171
172# Time to wait for factory data reset
173WAIT_TIME_AFTER_FDR = 60
174
175# Time to wait for boot complete after reboot
176WAIT_TIME_FOR_BOOT_COMPLETE = 75
177
178# Time to wait for tethering test after reboot
179WAIT_TIME_TETHERING_AFTER_REBOOT = 10
180
181# Time to wait after changing data sub id
182WAIT_TIME_CHANGE_DATA_SUB_ID = 30
183
184# Time to wait after changing voice sub id
185WAIT_TIME_CHANGE_VOICE_SUB_ID = 5
186
187# Time to wait after changing message sub id
188WAIT_TIME_CHANGE_MESSAGE_SUB_ID = 5
189
190# Wait time for Data Stall to detect
191WAIT_TIME_FOR_DATA_STALL = 300
192
193# Wait time for Network Validation Failed detection
194WAIT_TIME_FOR_NW_VALID_FAIL = 300
195
196# Wait time for Data Stall to recover
197WAIT_TIME_FOR_DATA_STALL_RECOVERY = 360
198
199# Callbox Power level which will cause no service on device
200POWER_LEVEL_OUT_OF_SERVICE = -100
201
202# Callbox Power level which will ensure full service on device
203POWER_LEVEL_FULL_SERVICE = -20
204
205# These are used in phone_number_formatter
206PHONE_NUMBER_STRING_FORMAT_7_DIGIT = 7
207PHONE_NUMBER_STRING_FORMAT_10_DIGIT = 10
208PHONE_NUMBER_STRING_FORMAT_11_DIGIT = 11
209PHONE_NUMBER_STRING_FORMAT_12_DIGIT = 12
210
211# MAX screen-on time during test (in unit of second)
212MAX_SCREEN_ON_TIME = 1800
213
214# In Voice Mail box, press this digit to delete one message.
215VOICEMAIL_DELETE_DIGIT = '7'
216
217# MAX number of saved voice mail in voice mail box.
218MAX_SAVED_VOICE_MAIL = 25
219
220# SIM1 slot index
221SIM1_SLOT_INDEX = 0
222
223# SIM2 slot index
224SIM2_SLOT_INDEX = 1
225
226# invalid Subscription ID
227INVALID_SUB_ID = -1
228
229# invalid SIM slot index
230INVALID_SIM_SLOT_INDEX = -1
231
232# WiFI RSSI is -127 if WiFi is not connected
233INVALID_WIFI_RSSI = -127
234
235# MAX and MIN value for attenuator settings
236ATTEN_MAX_VALUE = 95
237ATTEN_MIN_VALUE = 0
238
239MAX_RSSI_RESERVED_VALUE = 100
240MIN_RSSI_RESERVED_VALUE = -200
241
242# cellular weak RSSI value
243CELL_WEAK_RSSI_VALUE = -105
244# cellular strong RSSI value
245CELL_STRONG_RSSI_VALUE = -70
246# WiFi weak RSSI value
247WIFI_WEAK_RSSI_VALUE = -63
248
249# Emergency call number
250DEFAULT_EMERGENCY_CALL_NUMBER = "911"
251
252EMERGENCY_CALL_NUMBERS = [
253    "08", "000", "110", "112", "118", "119", "911", "999", "*911", "#911"
254]
255
256AOSP_PREFIX = "aosp_"
257
258INCALL_UI_DISPLAY_FOREGROUND = "foreground"
259INCALL_UI_DISPLAY_BACKGROUND = "background"
260INCALL_UI_DISPLAY_DEFAULT = "default"
261
262NETWORK_CONNECTION_TYPE_WIFI = 'wifi'
263NETWORK_CONNECTION_TYPE_CELL = 'cell'
264NETWORK_CONNECTION_TYPE_MMS = 'mms'
265NETWORK_CONNECTION_TYPE_HIPRI = 'hipri'
266NETWORK_CONNECTION_TYPE_UNKNOWN = 'unknown'
267
268TETHERING_MODE_WIFI = 'wifi'
269
270# Tether interface types defined in ConnectivityManager
271TETHERING_INVALID = -1
272TETHERING_WIFI = 0
273TETHERING_USB = 1
274TETHERING_BLUETOOTH = 2
275
276NETWORK_SERVICE_VOICE = 'voice'
277NETWORK_SERVICE_DATA = 'data'
278
279CARRIER_VZW = 'vzw'
280CARRIER_ATT = 'att'
281CARRIER_TMO = 'tmo'
282CARRIER_SPT = 'spt'
283CARRIER_EEUK = 'eeuk'
284CARRIER_VFUK = 'vfuk'
285CARRIER_UNKNOWN = 'unknown'
286CARRIER_GMBH = 'gmbh'
287CARRIER_ITA = 'ita'
288CARRIER_ESP = 'esp'
289CARRIER_ORG = 'org'
290CARRIER_TEL = 'tel'
291CARRIER_TSA = 'tsa'
292CARRIER_USCC = 'uscc'
293CARRIER_ROGERS = 'ROGERS'
294CARRIER_TELUS = 'tls'
295CARRIER_KOODO = 'kdo'
296CARRIER_VIDEOTRON = 'vtrn'
297CARRIER_BELL = 'bell'
298CARRIER_FRE = 'fre'
299CARRIER_FI = 'fi'
300
301RAT_FAMILY_CDMA = 'cdma'
302RAT_FAMILY_CDMA2000 = 'cdma2000'
303RAT_FAMILY_IDEN = 'iden'
304RAT_FAMILY_GSM = 'gsm'
305RAT_FAMILY_WCDMA = 'wcdma'
306RAT_FAMILY_UMTS = RAT_FAMILY_WCDMA
307RAT_FAMILY_WLAN = 'wlan'
308RAT_FAMILY_LTE = 'lte'
309RAT_FAMILY_TDSCDMA = 'tdscdma'
310RAT_FAMILY_UNKNOWN = 'unknown'
311
312CAPABILITY_PHONE = 'phone'
313CAPABILITY_VOLTE = 'volte'
314CAPABILITY_VT = 'vt'
315CAPABILITY_WFC = 'wfc'
316CAPABILITY_MSIM = 'msim'
317CAPABILITY_OMADM = 'omadm'
318CAPABILITY_WFC_MODE_CHANGE = 'wfc_mode_change'
319CAPABILITY_CONFERENCE = 'conference'
320CAPABILITY_VOLTE_PROVISIONING = 'volte_provisioning'
321CAPABILITY_VOLTE_OVERRIDE_WFC_PROVISIONING = 'volte_override_wfc_provisioning'
322CAPABILITY_HIDE_ENHANCED_4G_LTE_BOOL = 'hide_enhanced_4g_lte'
323
324# Carrier Config Versions
325VZW_CARRIER_CONFIG_VERSION = "29999999999.1"
326ATT_CARRIER_CONFIG_VERSION = "28888888888.1"
327
328# Constant for operation direction
329DIRECTION_MOBILE_ORIGINATED = "MO"
330DIRECTION_MOBILE_TERMINATED = "MT"
331
332# Constant for call teardown side
333CALL_TEARDOWN_PHONE = "PHONE"
334CALL_TEARDOWN_REMOTE = "REMOTE"
335
336WIFI_VERBOSE_LOGGING_ENABLED = 1
337WIFI_VERBOSE_LOGGING_DISABLED = 0
338"""
339Begin shared constant define for both Python and Java
340"""
341
342# Constant for WiFi Calling WFC mode
343WFC_MODE_WIFI_ONLY = "WIFI_ONLY"
344WFC_MODE_CELLULAR_PREFERRED = "CELLULAR_PREFERRED"
345WFC_MODE_WIFI_PREFERRED = "WIFI_PREFERRED"
346WFC_MODE_DISABLED = "DISABLED"
347WFC_MODE_UNKNOWN = "UNKNOWN"
348
349# Constant for Video Telephony VT state
350VT_STATE_AUDIO_ONLY = "AUDIO_ONLY"
351VT_STATE_TX_ENABLED = "TX_ENABLED"
352VT_STATE_RX_ENABLED = "RX_ENABLED"
353VT_STATE_BIDIRECTIONAL = "BIDIRECTIONAL"
354VT_STATE_TX_PAUSED = "TX_PAUSED"
355VT_STATE_RX_PAUSED = "RX_PAUSED"
356VT_STATE_BIDIRECTIONAL_PAUSED = "BIDIRECTIONAL_PAUSED"
357VT_STATE_STATE_INVALID = "INVALID"
358
359# Constant for Video Telephony Video quality
360VT_VIDEO_QUALITY_DEFAULT = "DEFAULT"
361VT_VIDEO_QUALITY_UNKNOWN = "UNKNOWN"
362VT_VIDEO_QUALITY_HIGH = "HIGH"
363VT_VIDEO_QUALITY_MEDIUM = "MEDIUM"
364VT_VIDEO_QUALITY_LOW = "LOW"
365VT_VIDEO_QUALITY_INVALID = "INVALID"
366
367# Constant for Call State (for call object)
368CALL_STATE_ACTIVE = "ACTIVE"
369CALL_STATE_NEW = "NEW"
370CALL_STATE_DIALING = "DIALING"
371CALL_STATE_RINGING = "RINGING"
372CALL_STATE_HOLDING = "HOLDING"
373CALL_STATE_DISCONNECTED = "DISCONNECTED"
374CALL_STATE_PRE_DIAL_WAIT = "PRE_DIAL_WAIT"
375CALL_STATE_CONNECTING = "CONNECTING"
376CALL_STATE_DISCONNECTING = "DISCONNECTING"
377CALL_STATE_UNKNOWN = "UNKNOWN"
378CALL_STATE_INVALID = "INVALID"
379
380# Constant for PRECISE Call State (for call object)
381PRECISE_CALL_STATE_ACTIVE = "ACTIVE"
382PRECISE_CALL_STATE_ALERTING = "ALERTING"
383PRECISE_CALL_STATE_DIALING = "DIALING"
384PRECISE_CALL_STATE_INCOMING = "INCOMING"
385PRECISE_CALL_STATE_HOLDING = "HOLDING"
386PRECISE_CALL_STATE_DISCONNECTED = "DISCONNECTED"
387PRECISE_CALL_STATE_WAITING = "WAITING"
388PRECISE_CALL_STATE_DISCONNECTING = "DISCONNECTING"
389PRECISE_CALL_STATE_IDLE = "IDLE"
390PRECISE_CALL_STATE_UNKNOWN = "UNKNOWN"
391PRECISE_CALL_STATE_INVALID = "INVALID"
392
393# Constant for DC POWER STATE
394DC_POWER_STATE_LOW = "LOW"
395DC_POWER_STATE_HIGH = "HIGH"
396DC_POWER_STATE_MEDIUM = "MEDIUM"
397DC_POWER_STATE_UNKNOWN = "UNKNOWN"
398
399# Constant for Audio Route
400AUDIO_ROUTE_EARPIECE = "EARPIECE"
401AUDIO_ROUTE_BLUETOOTH = "BLUETOOTH"
402AUDIO_ROUTE_SPEAKER = "SPEAKER"
403AUDIO_ROUTE_WIRED_HEADSET = "WIRED_HEADSET"
404AUDIO_ROUTE_WIRED_OR_EARPIECE = "WIRED_OR_EARPIECE"
405
406# Constant for Call Capability
407CALL_CAPABILITY_HOLD = "HOLD"
408CALL_CAPABILITY_SUPPORT_HOLD = "SUPPORT_HOLD"
409CALL_CAPABILITY_MERGE_CONFERENCE = "MERGE_CONFERENCE"
410CALL_CAPABILITY_SWAP_CONFERENCE = "SWAP_CONFERENCE"
411CALL_CAPABILITY_UNUSED_1 = "UNUSED_1"
412CALL_CAPABILITY_RESPOND_VIA_TEXT = "RESPOND_VIA_TEXT"
413CALL_CAPABILITY_MUTE = "MUTE"
414CALL_CAPABILITY_MANAGE_CONFERENCE = "MANAGE_CONFERENCE"
415CALL_CAPABILITY_SUPPORTS_VT_LOCAL_RX = "SUPPORTS_VT_LOCAL_RX"
416CALL_CAPABILITY_SUPPORTS_VT_LOCAL_TX = "SUPPORTS_VT_LOCAL_TX"
417CALL_CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = "SUPPORTS_VT_LOCAL_BIDIRECTIONAL"
418CALL_CAPABILITY_SUPPORTS_VT_REMOTE_RX = "SUPPORTS_VT_REMOTE_RX"
419CALL_CAPABILITY_SUPPORTS_VT_REMOTE_TX = "SUPPORTS_VT_REMOTE_TX"
420CALL_CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = "SUPPORTS_VT_REMOTE_BIDIRECTIONAL"
421CALL_CAPABILITY_SEPARATE_FROM_CONFERENCE = "SEPARATE_FROM_CONFERENCE"
422CALL_CAPABILITY_DISCONNECT_FROM_CONFERENCE = "DISCONNECT_FROM_CONFERENCE"
423CALL_CAPABILITY_SPEED_UP_MT_AUDIO = "SPEED_UP_MT_AUDIO"
424CALL_CAPABILITY_CAN_UPGRADE_TO_VIDEO = "CAN_UPGRADE_TO_VIDEO"
425CALL_CAPABILITY_CAN_PAUSE_VIDEO = "CAN_PAUSE_VIDEO"
426CALL_CAPABILITY_UNKOWN = "UNKOWN"
427
428# Constant for Call Property
429CALL_PROPERTY_HIGH_DEF_AUDIO = "HIGH_DEF_AUDIO"
430CALL_PROPERTY_CONFERENCE = "CONFERENCE"
431CALL_PROPERTY_GENERIC_CONFERENCE = "GENERIC_CONFERENCE"
432CALL_PROPERTY_WIFI = "WIFI"
433CALL_PROPERTY_EMERGENCY_CALLBACK_MODE = "EMERGENCY_CALLBACK_MODE"
434CALL_PROPERTY_UNKNOWN = "UNKNOWN"
435
436# Constant for Call Presentation
437CALL_PRESENTATION_ALLOWED = "ALLOWED"
438CALL_PRESENTATION_RESTRICTED = "RESTRICTED"
439CALL_PRESENTATION_PAYPHONE = "PAYPHONE"
440CALL_PRESENTATION_UNKNOWN = "UNKNOWN"
441
442# Constant for Network Generation
443GEN_2G = "2G"
444GEN_3G = "3G"
445GEN_4G = "4G"
446GEN_UNKNOWN = "UNKNOWN"
447
448# Constant for Network RAT
449RAT_IWLAN = "IWLAN"
450RAT_LTE = "LTE"
451RAT_4G = "4G"
452RAT_3G = "3G"
453RAT_2G = "2G"
454RAT_WCDMA = "WCDMA"
455RAT_UMTS = "UMTS"
456RAT_1XRTT = "1XRTT"
457RAT_EDGE = "EDGE"
458RAT_GPRS = "GPRS"
459RAT_HSDPA = "HSDPA"
460RAT_HSUPA = "HSUPA"
461RAT_CDMA = "CDMA"
462RAT_EVDO = "EVDO"
463RAT_EVDO_0 = "EVDO_0"
464RAT_EVDO_A = "EVDO_A"
465RAT_EVDO_B = "EVDO_B"
466RAT_IDEN = "IDEN"
467RAT_EHRPD = "EHRPD"
468RAT_HSPA = "HSPA"
469RAT_HSPAP = "HSPAP"
470RAT_GSM = "GSM"
471RAT_TD_SCDMA = "TD_SCDMA"
472RAT_GLOBAL = "GLOBAL"
473RAT_LTE_CA = "LTE_CA"  # LTE Carrier Aggregation
474RAT_UNKNOWN = "UNKNOWN"
475
476# Constant for Phone Type
477PHONE_TYPE_GSM = "GSM"
478PHONE_TYPE_NONE = "NONE"
479PHONE_TYPE_CDMA = "CDMA"
480PHONE_TYPE_SIP = "SIP"
481
482# Constant for SIM Power State
483CARD_POWER_DOWN = 0
484CARD_POWER_UP = 1
485CARD_POWER_UP_PASS_THROUGH = 2
486
487# Constant for SIM State
488SIM_STATE_READY = "READY"
489SIM_STATE_UNKNOWN = "UNKNOWN"
490SIM_STATE_ABSENT = "ABSENT"
491SIM_STATE_PUK_REQUIRED = "PUK_REQUIRED"
492SIM_STATE_PIN_REQUIRED = "PIN_REQUIRED"
493SIM_STATE_NETWORK_LOCKED = "NETWORK_LOCKED"
494SIM_STATE_NOT_READY = "NOT_READY"
495SIM_STATE_PERM_DISABLED = "PERM_DISABLED"
496SIM_STATE_CARD_IO_ERROR = "CARD_IO_ERROR"
497SIM_STATE_LOADED = "LOADED"
498
499SINGLE_SIM_CONFIG = "ssss"
500MULTI_SIM_CONFIG = "dsds"
501
502# Constant for Data Connection State
503DATA_STATE_CONNECTED = "CONNECTED"
504DATA_STATE_DISCONNECTED = "DISCONNECTED"
505DATA_STATE_CONNECTING = "CONNECTING"
506DATA_STATE_SUSPENDED = "SUSPENDED"
507DATA_STATE_UNKNOWN = "UNKNOWN"
508
509# Constant for Data Roaming State
510DATA_ROAMING_ENABLE = 1
511DATA_ROAMING_DISABLE = 0
512
513# Constant for ConnectivityManager Data Connection
514TYPE_MOBILE = 0
515TYPE_WIFI = 1
516
517# Constant for Telephony Manager Call State
518TELEPHONY_STATE_RINGING = "RINGING"
519TELEPHONY_STATE_IDLE = "IDLE"
520TELEPHONY_STATE_OFFHOOK = "OFFHOOK"
521TELEPHONY_STATE_UNKNOWN = "UNKNOWN"
522
523# Constant for TTY Mode
524TTY_MODE_FULL = "FULL"
525TTY_MODE_HCO = "HCO"
526TTY_MODE_OFF = "OFF"
527TTY_MODE_VCO = "VCO"
528
529# Constant for Service State
530SERVICE_STATE_EMERGENCY_ONLY = "EMERGENCY_ONLY"
531SERVICE_STATE_IN_SERVICE = "IN_SERVICE"
532SERVICE_STATE_OUT_OF_SERVICE = "OUT_OF_SERVICE"
533SERVICE_STATE_POWER_OFF = "POWER_OFF"
534SERVICE_STATE_UNKNOWN = "UNKNOWN"
535
536# Service State Mapping
537SERVICE_STATE_MAPPING = {
538    "-1": SERVICE_STATE_UNKNOWN,
539    "0": SERVICE_STATE_IN_SERVICE,
540    "1": SERVICE_STATE_OUT_OF_SERVICE,
541    "2": SERVICE_STATE_EMERGENCY_ONLY,
542    "3": SERVICE_STATE_POWER_OFF
543}
544
545# Constant for VoLTE Hand-over Service State
546VOLTE_SERVICE_STATE_HANDOVER_STARTED = "STARTED"
547VOLTE_SERVICE_STATE_HANDOVER_COMPLETED = "COMPLETED"
548VOLTE_SERVICE_STATE_HANDOVER_FAILED = "FAILED"
549VOLTE_SERVICE_STATE_HANDOVER_CANCELED = "CANCELED"
550VOLTE_SERVICE_STATE_HANDOVER_UNKNOWN = "UNKNOWN"
551
552# Constant for precise call state state listen level
553PRECISE_CALL_STATE_LISTEN_LEVEL_FOREGROUND = "FOREGROUND"
554PRECISE_CALL_STATE_LISTEN_LEVEL_RINGING = "RINGING"
555PRECISE_CALL_STATE_LISTEN_LEVEL_BACKGROUND = "BACKGROUND"
556
557# Constants used to register or de-register for call callback events
558EVENT_CALL_STATE_CHANGED = "EVENT_STATE_CHANGED"
559EVENT_CALL_CHILDREN_CHANGED = "EVENT_CHILDREN_CHANGED"
560
561# Constants used to register or de-register for video call callback events
562EVENT_VIDEO_SESSION_MODIFY_REQUEST_RECEIVED = "EVENT_VIDEO_SESSION_MODIFY_REQUEST_RECEIVED"
563EVENT_VIDEO_SESSION_MODIFY_RESPONSE_RECEIVED = "EVENT_VIDEO_SESSION_MODIFY_RESPONSE_RECEIVED"
564EVENT_VIDEO_SESSION_EVENT = "EVENT_VIDEO_SESSION_EVENT"
565EVENT_VIDEO_PEER_DIMENSIONS_CHANGED = "EVENT_VIDEO_PEER_DIMENSIONS_CHANGED"
566EVENT_VIDEO_QUALITY_CHANGED = "EVENT_VIDEO_QUALITY_CHANGED"
567EVENT_VIDEO_DATA_USAGE_CHANGED = "EVENT_VIDEO_DATA_USAGE_CHANGED"
568EVENT_VIDEO_CAMERA_CAPABILITIES_CHANGED = "EVENT_VIDEO_CAMERA_CAPABILITIES_CHANGED"
569EVENT_VIDEO_INVALID = "EVENT_VIDEO_INVALID"
570
571# Constant for Video Call Session Event Name
572SESSION_EVENT_RX_PAUSE = "SESSION_EVENT_RX_PAUSE"
573SESSION_EVENT_RX_RESUME = "SESSION_EVENT_RX_RESUME"
574SESSION_EVENT_TX_START = "SESSION_EVENT_TX_START"
575SESSION_EVENT_TX_STOP = "SESSION_EVENT_TX_STOP"
576SESSION_EVENT_CAMERA_FAILURE = "SESSION_EVENT_CAMERA_FAILURE"
577SESSION_EVENT_CAMERA_READY = "SESSION_EVENT_CAMERA_READY"
578SESSION_EVENT_UNKNOWN = "SESSION_EVENT_UNKNOWN"
579
580NETWORK_MODE_WCDMA_PREF = "NETWORK_MODE_WCDMA_PREF"
581NETWORK_MODE_GSM_ONLY = "NETWORK_MODE_GSM_ONLY"
582NETWORK_MODE_WCDMA_ONLY = "NETWORK_MODE_WCDMA_ONLY"
583NETWORK_MODE_GSM_UMTS = "NETWORK_MODE_GSM_UMTS"
584NETWORK_MODE_CDMA = "NETWORK_MODE_CDMA"
585NETWORK_MODE_CDMA_NO_EVDO = "NETWORK_MODE_CDMA_NO_EVDO"
586NETWORK_MODE_EVDO_NO_CDMA = "NETWORK_MODE_EVDO_NO_CDMA"
587NETWORK_MODE_GLOBAL = "NETWORK_MODE_GLOBAL"
588NETWORK_MODE_LTE_CDMA_EVDO = "NETWORK_MODE_LTE_CDMA_EVDO"
589NETWORK_MODE_LTE_GSM_WCDMA = "NETWORK_MODE_LTE_GSM_WCDMA"
590NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = "NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA"
591NETWORK_MODE_LTE_ONLY = "NETWORK_MODE_LTE_ONLY"
592NETWORK_MODE_LTE_WCDMA = "NETWORK_MODE_LTE_WCDMA"
593NETWORK_MODE_TDSCDMA_ONLY = "NETWORK_MODE_TDSCDMA_ONLY"
594NETWORK_MODE_TDSCDMA_WCDMA = "NETWORK_MODE_TDSCDMA_WCDMA"
595NETWORK_MODE_LTE_TDSCDMA = "NETWORK_MODE_LTE_TDSCDMA"
596NETWORK_MODE_TDSCDMA_GSM = "NETWORK_MODE_TDSCDMA_GSM"
597NETWORK_MODE_LTE_TDSCDMA_GSM = "NETWORK_MODE_LTE_TDSCDMA_GSM"
598NETWORK_MODE_TDSCDMA_GSM_WCDMA = "NETWORK_MODE_TDSCDMA_GSM_WCDMA"
599NETWORK_MODE_LTE_TDSCDMA_WCDMA = "NETWORK_MODE_LTE_TDSCDMA_WCDMA"
600NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA = "NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA"
601NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA = "NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA"
602NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = "NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA"
603
604# Carrier Config Update
605CARRIER_ID_VERSION = "3"
606CARRIER_ID_VERSION_P = "5"
607WAIT_TIME_FOR_CARRIERID_CHANGE = 6
608CARRIER_ID_METADATA_URL = "am broadcast -a com.google.android.gms." \
609     "phenotype.FLAG_OVERRIDE --es package 'com.google.android.configupdater'" \
610     " --es user '\*' --esa flags 'CarrierIdentification__metadata_url' " \
611     "--esa values 'https://www.gstatic.com/android/config_update/110618-" \
612     "carrier-id-metadata.txt' --esa types 'string' com.google.android.gms"
613
614CARRIER_ID_METADATA_URL_P = "am broadcast -a com.google.android.gms." \
615     "phenotype.FLAG_OVERRIDE --es package 'com.google.android.configupdater'" \
616     " --es user '\*' --esa flags 'CarrierIdentification__metadata_url' " \
617     "--esa values 'https://www.gstatic.com/android/telephony/carrierid/" \
618     "030419-p-carrier-id-metadata.txt' --esa types 'string' com.google.android.gms"
619
620CARRIER_ID_CONTENT_URL = "am broadcast -a com.google.android.gms." \
621     "phenotype.FLAG_OVERRIDE --es package 'com.google.android.configupdater'" \
622     " --es user '\*' --esa flags 'CarrierIdentification__content_url' " \
623     "--esa values 'https://www.gstatic.com/android/config_update/110618-" \
624     "carrier-id.pb' --esa types 'string' com.google.android.gms"
625
626CARRIER_ID_CONTENT_URL_P = "am broadcast -a com.google.android.gms." \
627     "phenotype.FLAG_OVERRIDE --es package 'com.google.android.configupdater'" \
628     " --es user '\*' --esa flags 'CarrierIdentification__content_url' " \
629     "--esa values 'https://www.gstatic.com/android/telephony/carrierid/" \
630     "030419-p-carrier-id.pb' --esa types 'string' com.google.android.gms"
631
632# Constant for Messaging Event Name
633EventSmsDeliverSuccess = "SmsDeliverSuccess"
634EventSmsDeliverFailure = "SmsDeliverFailure"
635EventSmsSentSuccess = "SmsSentSuccess"
636EventSmsSentFailure = "SmsSentFailure"
637EventSmsReceived = "SmsReceived"
638EventMmsSentSuccess = "MmsSentSuccess"
639EventMmsSentFailure = "MmsSentFailure"
640EventMmsDownloaded = "MmsDownloaded"
641EventWapPushReceived = "WapPushReceived"
642EventDataSmsReceived = "DataSmsReceived"
643EventCmasReceived = "CmasReceived"
644EventEtwsReceived = "EtwsReceived"
645
646# Constants for Telecom Call Management Event Name (see InCallService.java).
647EventTelecomCallAdded = "TelecomCallAdded"
648EventTelecomCallRemoved = "TelecomCallRemoved"
649
650# Constant for Telecom Call Event Name (see Call.java)
651EventTelecomCallStateChanged = "TelecomCallStateChanged"
652EventTelecomCallParentChanged = "TelecomCallParentChanged"
653EventTelecomCallChildrenChanged = "TelecomCallChildrenChanged"
654EventTelecomCallDetailsChanged = "TelecomCallDetailsChanged"
655EventTelecomCallCannedTextResponsesLoaded = "TelecomCallCannedTextResponsesLoaded"
656EventTelecomCallPostDialWait = "TelecomCallPostDialWait"
657EventTelecomCallVideoCallChanged = "TelecomCallVideoCallChanged"
658EventTelecomCallDestroyed = "TelecomCallDestroyed"
659EventTelecomCallConferenceableCallsChanged = "TelecomCallConferenceableCallsChanged"
660
661# Constant for Video Call Event Name
662EventTelecomVideoCallSessionModifyRequestReceived = "TelecomVideoCallSessionModifyRequestReceived"
663EventTelecomVideoCallSessionModifyResponseReceived = "TelecomVideoCallSessionModifyResponseReceived"
664EventTelecomVideoCallSessionEvent = "TelecomVideoCallSessionEvent"
665EventTelecomVideoCallPeerDimensionsChanged = "TelecomVideoCallPeerDimensionsChanged"
666EventTelecomVideoCallVideoQualityChanged = "TelecomVideoCallVideoQualityChanged"
667EventTelecomVideoCallDataUsageChanged = "TelecomVideoCallDataUsageChanged"
668EventTelecomVideoCallCameraCapabilities = "TelecomVideoCallCameraCapabilities"
669
670# Constant for Other Event Name
671EventCallStateChanged = "CallStateChanged"
672EventPreciseStateChanged = "PreciseStateChanged"
673EventDataConnectionRealTimeInfoChanged = "DataConnectionRealTimeInfoChanged"
674EventDataConnectionStateChanged = "DataConnectionStateChanged"
675EventServiceStateChanged = "ServiceStateChanged"
676EventSignalStrengthChanged = "SignalStrengthChanged"
677EventVolteServiceStateChanged = "VolteServiceStateChanged"
678EventMessageWaitingIndicatorChanged = "MessageWaitingIndicatorChanged"
679EventConnectivityChanged = "ConnectivityChanged"
680EventActiveDataSubIdChanged = "ActiveDataSubIdChanged"
681
682# Constant for Packet Keep Alive Call Back
683EventPacketKeepaliveCallback = "PacketKeepaliveCallback"
684PacketKeepaliveCallbackStarted = "Started"
685PacketKeepaliveCallbackStopped = "Stopped"
686PacketKeepaliveCallbackError = "Error"
687PacketKeepaliveCallbackInvalid = "Invalid"
688
689# Constant for Network Call Back
690EventNetworkCallback = "NetworkCallback"
691NetworkCallbackPreCheck = "PreCheck"
692NetworkCallbackAvailable = "Available"
693NetworkCallbackLosing = "Losing"
694NetworkCallbackLost = "Lost"
695NetworkCallbackUnavailable = "Unavailable"
696NetworkCallbackCapabilitiesChanged = "CapabilitiesChanged"
697NetworkCallbackSuspended = "Suspended"
698NetworkCallbackResumed = "Resumed"
699NetworkCallbackLinkPropertiesChanged = "LinkPropertiesChanged"
700NetworkCallbackInvalid = "Invalid"
701
702class SignalStrengthContainer:
703    SIGNAL_STRENGTH_GSM = "gsmSignalStrength"
704    SIGNAL_STRENGTH_GSM_DBM = "gsmDbm"
705    SIGNAL_STRENGTH_GSM_LEVEL = "gsmLevel"
706    SIGNAL_STRENGTH_GSM_ASU_LEVEL = "gsmAsuLevel"
707    SIGNAL_STRENGTH_GSM_BIT_ERROR_RATE = "gsmBitErrorRate"
708    SIGNAL_STRENGTH_CDMA_DBM = "cdmaDbm"
709    SIGNAL_STRENGTH_CDMA_LEVEL = "cdmaLevel"
710    SIGNAL_STRENGTH_CDMA_ASU_LEVEL = "cdmaAsuLevel"
711    SIGNAL_STRENGTH_CDMA_ECIO = "cdmaEcio"
712    SIGNAL_STRENGTH_EVDO_DBM = "evdoDbm"
713    SIGNAL_STRENGTH_EVDO_ECIO = "evdoEcio"
714    SIGNAL_STRENGTH_LTE = "lteSignalStrength"
715    SIGNAL_STRENGTH_LTE_DBM = "lteDbm"
716    SIGNAL_STRENGTH_LTE_LEVEL = "lteLevel"
717    SIGNAL_STRENGTH_LTE_ASU_LEVEL = "lteAsuLevel"
718    SIGNAL_STRENGTH_DBM = "dbm"
719    SIGNAL_STRENGTH_LEVEL = "level"
720    SIGNAL_STRENGTH_ASU_LEVEL = "asuLevel"
721
722
723class MessageWaitingIndicatorContainer:
724    IS_MESSAGE_WAITING = "isMessageWaiting"
725
726
727class CallStateContainer:
728    INCOMING_NUMBER = "incomingNumber"
729    SUBSCRIPTION_ID = "subscriptionId"
730    CALL_STATE = "callState"
731
732
733class PreciseCallStateContainer:
734    TYPE = "type"
735    CAUSE = "cause"
736    SUBSCRIPTION_ID = "subscriptionId"
737    PRECISE_CALL_STATE = "preciseCallState"
738
739
740class DataConnectionRealTimeInfoContainer:
741    TYPE = "type"
742    TIME = "time"
743    SUBSCRIPTION_ID = "subscriptionId"
744    DATA_CONNECTION_POWER_STATE = "dataConnectionPowerState"
745
746
747class DataConnectionStateContainer:
748    TYPE = "type"
749    DATA_NETWORK_TYPE = "dataNetworkType"
750    STATE_CODE = "stateCode"
751    SUBSCRIPTION_ID = "subscriptionId"
752    DATA_CONNECTION_STATE = "dataConnectionState"
753
754
755class ServiceStateContainer:
756    VOICE_REG_STATE = "voiceRegState"
757    VOICE_NETWORK_TYPE = "voiceNetworkType"
758    DATA_REG_STATE = "dataRegState"
759    DATA_NETWORK_TYPE = "dataNetworkType"
760    OPERATOR_NAME = "operatorName"
761    OPERATOR_ID = "operatorId"
762    IS_MANUAL_NW_SELECTION = "isManualNwSelection"
763    ROAMING = "roaming"
764    IS_EMERGENCY_ONLY = "isEmergencyOnly"
765    NETWORK_ID = "networkId"
766    SYSTEM_ID = "systemId"
767    SUBSCRIPTION_ID = "subscriptionId"
768    SERVICE_STATE = "serviceState"
769
770
771class PacketKeepaliveContainer:
772    ID = "id"
773    PACKET_KEEPALIVE_EVENT = "packetKeepaliveEvent"
774
775
776class NetworkCallbackContainer:
777    ID = "id"
778    NETWORK_CALLBACK_EVENT = "networkCallbackEvent"
779    MAX_MS_TO_LIVE = "maxMsToLive"
780    RSSI = "rssi"
781
782
783class CarrierConfigs:
784    NAME_STRING = "carrier_name_string"
785    SUPPORT_CONFERENCE_CALL_BOOL = "support_conference_call_bool"
786    VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool"
787    VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool"
788    VOLTE_PROVISIONING_REQUIRED_BOOL = "carrier_volte_provisioning_required_bool"
789    VOLTE_OVERRIDE_WFC_BOOL = "carrier_volte_override_wfc_provisioning_bool"
790    VT_AVAILABLE_BOOL = "carrier_vt_available_bool"
791    ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL = "enhanced_4g_lte_on_by_default_bool"
792    HIDE_ENHANCED_4G_LTE_BOOL = "hide_enhanced_4g_lte_bool"
793    WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"
794    WFC_SUPPORTS_WIFI_ONLY_BOOL = "carrier_wfc_supports_wifi_only_bool"
795    EDITABLE_ENHANCED_4G_LTE_BOOL = "editable_enhanced_4g_lte_bool"
796    EDITABLE_WFC_MODE_BOOL = "editable_wfc_mode_bool"
797    EDITABLE_WFC_ROAMING_MODE_BOOL = "editable_wfc_roaming_mode_bool"
798    DEFAULT_DATA_ROAMING_ENABLED_BOOL = "carrier_default_data_roaming_enabled_bool"
799    DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL = "carrier_default_wfc_ims_roaming_enabled_bool"
800    DEFAULT_WFC_IMS_ENABLED_BOOL = "carrier_default_wfc_ims_enabled_bool"
801    DEFAULT_WFC_IMS_MODE_INT = "carrier_default_wfc_ims_mode_int"
802    DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL = "carrier_default_wfc_ims_roaming_enabled_bool"
803    DEFAULT_WFC_IMS_ROAMING_MODE_INT = "carrier_default_wfc_ims_roaming_mode_int"
804
805
806"""
807End shared constant define for both Python and Java
808"""
809