1""" 2 Copyright (C) 2023 The Android Open Source Project 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 http://www.apache.org/licenses/LICENSE-2.0 7 Unless required by applicable law or agreed to in writing, software 8 distributed under the License is distributed on an "AS IS" BASIS, 9 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 See the License for the specific language governing permissions and 11 limitations under the License. 12 13 14 Test Steps: 15 161. Tap on Phone icon from facet rail or App launcher to launch Dialer app 172. Click on settings icon to launch Dialer ->Settings 183. Verify that Connected phone settings is showing 194. Verify BT mobile device name is showing if its connected 20 21""" 22 23 24import sys 25import logging 26import pprint 27from bluetooth_test import bluetooth_base_test 28from mobly import asserts 29from mobly import base_test 30 31from utilities import constants 32from utilities.main_utils import common_main 33 34# Number of seconds for the target to stay discoverable on Bluetooth. 35AUTO_LABEL = 'auto' 36PHONE_LABEL = 'phone' 37 38class ConnectedPhoneTest(bluetooth_base_test.BluetoothBaseTest): 39 40 41 def setup_test(self): 42 # Pair the devices 43 self.bt_utils.pair_primary_to_secondary() 44 super().enable_recording() 45 46 def test_connected_phone_displayed(self): 47 # Navigate to the Dialer App page 48 self.call_utils.open_phone_app() 49 self.call_utils.wait_with_log(constants.WAIT_TWO_SECONDS) 50 # Click on Settings icon to navigate to Dialer -> Settings 51 self.call_utils.open_dialer_settings() 52 self.call_utils.wait_with_log(constants.WAIT_TWO_SECONDS) 53 54 # Note that this call will fail if the "Connected Phone" title is not discovered, 55 # covering step #3 in the header of this test file 56 phoneNameInSettings = self.discoverer.mbs.getConnectedPhoneName() 57 58 # Verify displayed phone name matches the one we've given. 59 target_name = self.target.mbs.btGetName() 60 asserts.assert_true( 61 target_name == phoneNameInSettings, 62 "When looking for mobile name on phone settings," 63 "expected \'%s\' but found \'%s\'" % (target_name, phoneNameInSettings)) 64 65 66if __name__ == '__main__': 67 # Take test args 68 common_main()