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""" 15Procedure: 161. Make a phone call via Phone - Remote Phone call answer phone call 172. Launch Dialer 18Verify: Dialer page launched 19""" 20 21from bluetooth_sms_test import bluetooth_sms_base_test 22import logging 23from utilities import constants 24from utilities import phone_device_utils 25from utilities.main_utils import common_main 26 27from mobly import asserts 28 29class BTDialerPhoneCard(bluetooth_sms_base_test.BluetoothSMSBaseTest): 30 31 def setup_class(self): 32 super().setup_class() 33 self.phone_utils = (phone_device_utils.PhoneDeviceUtils(self.target)) 34 35 def setup_test(self): 36 # Pair the devices 37 self.bt_utils.pair_primary_to_secondary() 38 super().enable_recording() 39 40 41 def test_launch_dialer_from_phone_card(self): 42 # setup phones 43 # call from the unpaired phone to the paired phone 44 callee_number = self.phone_notpaired.mbs.getPhoneNumber() 45 self.phone_utils.call_number_from_home_screen(callee_number) 46 self.call_utils.wait_with_log(10) 47 48 # accept the call (on the unpaired phone) 49 self.phone_notpaired.mbs.clickUIElementWithText(constants.ANSWER_CALL_TEXT) 50 self.call_utils.wait_with_log(10) 51 self.call_utils.press_home() 52 53 # Confirm that a call is ongoing 54 asserts.assert_true( 55 self.discoverer.mbs.isOngoingCallDisplayedOnHome(), 56 "Expected ongoing call to be displayed on home, but found none." 57 ) 58 59 # Launch the dialer from the phone card 60 self.call_utils.press_dialer_button_on_phone_card() 61 # Verify that the in-progress call is displayed in full-screen view. 62 asserts.assert_true( 63 self.call_utils.is_active_call_ongoing_full_screen(), 64 "After enabling Active Call, expected received call to be fullscreen, " 65 "but it was not (i.e., no Active Call Control Bar found)" 66 ) 67 68 self.call_utils.end_call() 69 70 def teardown_test(self): 71 # End call if test failed 72 self.call_utils.end_call_using_adb_command(self.target) 73 super().teardown_test() 74 75if __name__ == '__main__': 76 common_main()