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" 34DIALER_LARGE_DIGIT_NUMBER="8007770133" 35EXPECTED_CONTACT_FULL_NAME = "John Smith" 36EXPECTED_CONTACT_FIRST_NAME = "John" 37EXPECTED_CONTACT_LAST_NAME = "Smith" 38FIRST_DIGIT_OF_SEARCH_CONTACT_NUMBER = "6" 39EXPECTED_PHONE_NUMBER = "611" 40ROOT = "root" 41DATE_CMD = "date" 42DEFAULT_DIAL_PAD_ENTRY = "Dial a number" 43# The word or phrase present in a device summary that is connected. 44CONNECTED_SUMMARY_STATUS = "Connected" 45DISCONNECTED_SUMMARY_STATUS = "Disconnected" 46DECLINE_CALL_TEXT = "Decline" 47ANSWER_CALL_TEXT = "Answer" 48ACCEPT_CALL_TEXT = "Accept" 49DISABLE_ANDROID_AUTO_POP_UP = "pm disable --user 10 com.google.android.embedded.projection" 50NOT_NOW_TEXT ="Not Now" 51 52BTSNOOP_LOG_PATH_ON_DEVICE = '/data/misc/bluetooth/logs/btsnoop_hci.log' 53BTSNOOP_LAST_LOG_PATH_ON_DEVICE = ( 54 '/data/misc/bluetooth/logs/btsnoop_hci.log.last' 55) 56PHONE_CONTACTS_DESTINATION_PATH = ( 57 '/data/data/com.google.android.contacts/cache/contacts.vcf' 58) 59IMPOST_CONTACTS_SHELL_COMAND = ( 60 'am start-activity -W -t "text/x-vcard" -d file://' 61 + PHONE_CONTACTS_DESTINATION_PATH 62 + ' -a android.intent.action.VIEW com.google.android.contacts' 63) 64 65# Should be kept in sync with BluetoothProfile.java 66BT_PROFILE_CONSTANTS = { 67 'headset': 1, 68 'a2dp': 2, 69 'health': 3, 70 'input_device': 4, 71 'pan': 5, 72 'pbap_server': 6, 73 'gatt': 7, 74 'gatt_server': 8, 75 'map': 9, 76 'sap': 10, 77 'a2dp_sink': 11, 78 'avrcp_controller': 12, 79 'headset_client': 16, 80 'pbap_client': 17, 81 'map_mce': 18, 82} 83 84BLUETOOTH_PROFILE_CONNECTION_STATE_CHANGED = ( 85 'BluetoothProfileConnectionStateChanged' 86) 87 88BT_PROFILE_STATES = { 89 'disconnected': 0, 90 'connecting': 1, 91 'connected': 2, 92 'disconnecting': 3, 93} 94PATH_TO_CONTACTS_VCF_FILE = 'platform_testing/tests/automotive/mobly_tests/utilities/contacts_test.vcf' 95 96PHONE_CONTACTS_DESTINATION_PATH = ( 97 '/data/data/com.google.android.contacts/cache/contacts.vcf' 98) 99 100IMPOST_CONTACTS_SHELL_COMAND = ( 101 'am start-activity -W -t "text/x-vcard" -d file://' 102 + PHONE_CONTACTS_DESTINATION_PATH 103 + ' -a android.intent.action.VIEW com.google.android.contacts' 104) 105 106# Screen recording 107SCREEN_RECORDING_COMMAND = 'screenrecord --time-limit 180' 108RECORDED_VIDEO_FILE_LOCATION = '/sdcard/' 109RECORDED_VIDEO_FILE_OUTPUT_FILE = '_screenrecord_output_mp4_' 110STOP_VIDEO_RECORDING = f'pkill -SIGINT {SCREEN_RECORDING_COMMAND}' 111DELETE_SCREEN_RECORDING = f'rm -f ' 112 113ONE_SEC = 1 114 115# KeyEvents 116KEYCODE_ENTER = 'input keyevent KEYCODE_ENTER' 117KEYCODE_TAB = 'input keyevent KEYCODE_TAB' 118KEYCODE_MEDIA_NEXT = 'input keyevent KEYCODE_MEDIA_NEXT' 119KEYCODE_MEDIA_PREVIOUS = 'input keyevent KEYCODE_MEDIA_PREVIOUS' 120KEYCODE_MEDIA_PAUSE = 'input keyevent KEYCODE_MEDIA_PAUSE' 121KEYCODE_MEDIA_PLAY = 'input keyevent KEYCODE_MEDIA_PLAY' 122KEYCODE_MEDIA_STOP = 'input keyevent KEYCODE_MEDIA_STOP' 123KEYCODE_WAKEUP = 'input keyevent KEYCODE_WAKEUP' 124DUMPSYS_POWER= 'dumpsys power|grep mWakefulness' 125 126# YouTube Media 127YOUTUBE_MUSIC_PACKAGE = 'com.google.android.apps.youtube.music' 128START_YOUTUBE_MEDIA_SHELL = 'am start ' + YOUTUBE_MUSIC_PACKAGE 129STOP_YOUTUBE_MEDIA_SHELL = 'am force-stop ' + YOUTUBE_MUSIC_PACKAGE 130GET_DUMPSYS_METADATA = 'dumpsys media_session' 131GET_DUMPSYS_METADATA = 'dumpsys bluetooth_manager' 132SONG_METADATA_PATTERN = r"description=.[^\n]+" 133DEFAULT_YOUTUBE_MUSIC_PLAYLIST = 'am start -a android.intent.action.VIEW -d https://music.youtube.com/watch?v=nkBJzfHpq_A' 134BLUETOOTH_AUDIO_APP = "Bluetooth Audio" 135YOUTUBE_MUSIC_APP = "YouTube Music" 136BLUETOOTH_PLAYER = "Bluetooth Player" 137YOUTUBE_MUSIC_DOWNLOADS = "Downloads" 138RADIO_APP = "Radio" 139FM_FREQUENCY_PATTERN = '^(10[1-7][13579])|(8[789][1357])|(9\\d[1357])$' 140RADIO_FM_RANGE = "FM" 141CONFIRM_RADIO_FREQUENCY = "Enter" 142DEFAULT_FM_FREQUENCY = "1013" 143NULL_VALUE = 'null' 144 145# SMS 146SMS_TEXT = "sms_test" 147REPLY_SMS = "Okay" 148SMS_REPLY_TEXT = "SMS Reply" 149SMS_TEXT_DRIVE_MODE = "Tap to read aloud" 150TIMEZONE_DICT = { 151 "PST": "Pacific Standard Time", 152 "PDT": "Pacific Daylight Time", 153 "EST": "Eastern Standard Time", 154 "EDT": "Eastern Daylight Time" 155} 156CLEAR_MESSAGING_APP = 'pm clear com.google.android.apps.messaging' 157DELETE_MESSAGING_DB = 'rm /data/data/com.android.providers.telephony/databases/mmssms.db' 158OPEN_NOTIFICATION = 'service call statusbar 1' 159 160# Dialer Page 161NO_PHONE_MESSAGE = "To complete your call, first connect your phone to your car via Bluetooth." 162DIALER_RECENTS_LABEL = "Recents" 163DIALER_CONTACTS_LABEL = "Contacts" 164DIALER_FAVORITES_LABEL = "Favorites" 165DIALER_DIALPAD_LABEL = "Dialpad" 166 167# Bluetooth Logs 168BLUETOOTH_TAG="setprop persist.log.tag.bluetooth verbose" 169BLUETOOTH_NOOPERABLE="setprop persist.bluetooth.btsnoopenable true" 170BLUETOOTH_BTSNOOP_DEFAULT_MODE="settings put global bluetooth_btsnoop_default_mode full" 171 172# Media Logs 173PLAYBACK_VIEW_MODEL="setprop persist.log.tag.PlaybackViewModel DEBUG" 174MEDIA_BROWSER_CONNECTOR="setprop persist.log.tag.MediaBrowserConnector DEBUG" 175MEDIA_ITEM_REPOSITORY="setprop persist.log.tag.MediaItemsRepository DEBUG" 176MEDIA_SOURCE_MODEL="setprop persist.log.tag.MediaSourceViewModel DEBUG" 177MEDIA_ACTIVITY="setprop persist.log.tag.MediaActivity DEBUG" 178SETTINGS_CLOCK_SECONDS="settings put secure clock_seconds 1" 179 180# Bluetooth State Verification commands 181BLUETOOTH_CONNECTION_STATE = "dumpsys bluetooth_manager | grep ConnectionState" 182BLUETOOTH_MAP = "dumpsys bluetooth_manager | grep -E MceStateMachine" 183BLUETOOTH_HFP ="dumpsys bluetooth_manager | grep HfpClientConnectionService" 184BLUETOOTH_AVRCP = "dumpsys bluetooth_manager | grep AvrcpControllerStateMachine" 185 186