1# Copyright (C) 2023 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""Constants class contains final variables using by other classes.""" 15 16LOCAL_MAC_ADDRESS_PERMISSION = 'android.permission.LOCAL_MAC_ADDRESS' 17APS_PACKAGE = 'android.platform.snippets' 18DIAL_A_NUMBER = 'Dial a number' 19DEFAULT_WAIT_TIME_FIVE_SECS = 5 20DEFAULT_WAIT_TIME_FIFTEEN_SECS = 15 21WAIT_FOR_LOAD = 2 22YOUTUBE_SYNC_TIME = 10 23BT_DEFAULT_TIMEOUT = 15 24WAIT_ONE_SEC = 1 25WAIT_TWO_SECONDS = 2 26WAIT_THIRTY_SECONDS = 30 27SYNC_WAIT_TIME = 15 # Sometimes syncing between devices can take a while 28DEVICE_CONNECT_WAIT_TIME = 20 # Waiting for device pairing to complete. 29MOBILE_DEVICE_NAME = 'target' 30AUTOMOTIVE_DEVICE_NAME = 'discoverer' 31REBOOT = 'reboot' 32DIALER_THREE_DIGIT_NUMBER = "511" 33INFORMATION_THREE_DIGIT_NUMBER = "411" 34EXPECTED_CONTACT_FULL_NAME = "John Smith" 35EXPECTED_CONTACT_FIRST_NAME = "John" 36EXPECTED_CONTACT_LAST_NAME = "Smith" 37FIRST_DIGIT_OF_SEARCH_CONTACT_NUMBER = "6" 38EXPECTED_PHONE_NUMBER = "611" 39ROOT = "root" 40DATE_CMD = "date" 41DEFAULT_DIAL_PAD_ENTRY = "Dial a number" 42# The word or phrase present in a device summary that is connected. 43CONNECTED_SUMMARY_STATUS = "Connected" 44DISCONNECTED_SUMMARY_STATUS = "Disconnected" 45DECLINE_CALL_TEXT = "Decline" 46ANSWER_CALL_TEXT = "Answer" 47ACCEPT_CALL_TEXT = "Accept" 48DISABLE_ANDROID_AUTO_POP_UP = "pm disable --user 10 com.google.android.embedded.projection" 49 50BTSNOOP_LOG_PATH_ON_DEVICE = '/data/misc/bluetooth/logs/btsnoop_hci.log' 51BTSNOOP_LAST_LOG_PATH_ON_DEVICE = ( 52 '/data/misc/bluetooth/logs/btsnoop_hci.log.last' 53) 54PHONE_CONTACTS_DESTINATION_PATH = ( 55 '/data/data/com.google.android.contacts/cache/contacts.vcf' 56) 57IMPOST_CONTACTS_SHELL_COMAND = ( 58 'am start-activity -W -t "text/x-vcard" -d file://' 59 + PHONE_CONTACTS_DESTINATION_PATH 60 + ' -a android.intent.action.VIEW com.google.android.contacts' 61) 62 63# Should be kept in sync with BluetoothProfile.java 64BT_PROFILE_CONSTANTS = { 65 'headset': 1, 66 'a2dp': 2, 67 'health': 3, 68 'input_device': 4, 69 'pan': 5, 70 'pbap_server': 6, 71 'gatt': 7, 72 'gatt_server': 8, 73 'map': 9, 74 'sap': 10, 75 'a2dp_sink': 11, 76 'avrcp_controller': 12, 77 'headset_client': 16, 78 'pbap_client': 17, 79 'map_mce': 18, 80} 81 82BLUETOOTH_PROFILE_CONNECTION_STATE_CHANGED = ( 83 'BluetoothProfileConnectionStateChanged' 84) 85 86BT_PROFILE_STATES = { 87 'disconnected': 0, 88 'connecting': 1, 89 'connected': 2, 90 'disconnecting': 3, 91} 92PATH_TO_CONTACTS_VCF_FILE = 'platform_testing/tests/automotive/mobly_tests/utilities/contacts_test.vcf' 93 94PHONE_CONTACTS_DESTINATION_PATH = ( 95 '/data/data/com.google.android.contacts/cache/contacts.vcf' 96) 97 98IMPOST_CONTACTS_SHELL_COMAND = ( 99 'am start-activity -W -t "text/x-vcard" -d file://' 100 + PHONE_CONTACTS_DESTINATION_PATH 101 + ' -a android.intent.action.VIEW com.google.android.contacts' 102) 103 104# Screen recording 105SCREEN_RECORDING_COMMAND = 'screenrecord' 106RECORDED_VIDEO_FILE_LOCATION = '/sdcard/' 107RECORDED_VIDEO_FILE_OUTPUT_FILE = '_screenrecord_output_mp4_' 108STOP_VIDEO_RECORDING = f'pkill -SIGINT {SCREEN_RECORDING_COMMAND}' 109DELETE_SCREEN_RECORDING = f'rm -f ' 110 111ONE_SEC = 1 112 113# KeyEvents 114KEYCODE_ENTER = 'input keyevent KEYCODE_ENTER' 115KEYCODE_TAB = 'input keyevent KEYCODE_TAB' 116KEYCODE_MEDIA_NEXT = 'input keyevent KEYCODE_MEDIA_NEXT' 117KEYCODE_MEDIA_PREVIOUS = 'input keyevent KEYCODE_MEDIA_PREVIOUS' 118KEYCODE_MEDIA_PAUSE = 'input keyevent KEYCODE_MEDIA_PAUSE' 119KEYCODE_MEDIA_PLAY = 'input keyevent KEYCODE_MEDIA_PLAY' 120KEYCODE_MEDIA_STOP = 'input keyevent KEYCODE_MEDIA_STOP' 121 122# YouTube Media 123YOUTUBE_MUSIC_PACKAGE = 'com.google.android.apps.youtube.music' 124START_YOUTUBE_MEDIA_SHELL = 'am start ' + YOUTUBE_MUSIC_PACKAGE 125STOP_YOUTUBE_MEDIA_SHELL = 'am force-stop ' + YOUTUBE_MUSIC_PACKAGE 126GET_DUMPSYS_METADATA = 'dumpsys media_session' 127SONG_METADATA_PATTERN = r"description=.[^\n]+" 128DEFAULT_YOUTUBE_MUSIC_PLAYLIST = 'am start -a android.intent.action.VIEW -d https://music.youtube.com/watch?v=nkBJzfHpq_A' 129BLUETOOTH_AUDIO_APP = "Bluetooth Audio" 130YOUTUBE_MUSIC_APP = "YouTube Music" 131BLUETOOTH_PLAYER = "Bluetooth Player" 132YOUTUBE_MUSIC_DOWNLOADS = "Downloads" 133RADIO_APP = "Radio" 134FM_FREQUENCY_PATTERN = '^(10[1-7][13579])|(8[789][1357])|(9\\d[1357])$' 135RADIO_FM_RANGE = "FM" 136CONFIRM_RADIO_FREQUENCY = "Enter" 137DEFAULT_FM_FREQUENCY = "1013" 138NULL_VALUE = 'null' 139 140# SMS 141SMS_TEXT = "sms_test" 142REPLY_SMS = "Okay" 143SMS_REPLY_TEXT = "SMS Reply" 144SMS_TEXT_DRIVE_MODE = "Tap to read aloud" 145TIMEZONE_DICT = { 146 "PST": "Pacific Standard Time", 147 "PDT": "Pacific Daylight Time", 148 "EST": "Eastern Standard Time", 149 "EDT": "Eastern Daylight Time" 150} 151CLEAR_MESSAGING_APP = 'pm clear com.google.android.apps.messaging' 152DELETE_MESSAGING_DB = 'rm /data/data/com.android.providers.telephony/databases/mmssms.db' 153OPEN_NOTIFICATION = 'service call statusbar 1' 154 155# Dialer Page 156NO_PHONE_MESSAGE = "To complete your call, first connect your phone to your car via Bluetooth." 157DIALER_RECENTS_LABEL = "Recents" 158DIALER_CONTACTS_LABEL = "Contacts" 159DIALER_FAVORITES_LABEL = "Favorites" 160DIALER_DIALPAD_LABEL = "Dialpad" 161 162# Bluetooth Logs 163BLUETOOTH_TAG="setprop persist.log.tag.bluetooth verbose" 164BLUETOOTH_NOOPERABLE="setprop persist.bluetooth.btsnoopenable true" 165BLUETOOTH_BTSNOOP_DEFAULT_MODE="settings put global bluetooth_btsnoop_default_mode full"