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"""Test of basic calling with given digits 15 Steps include: 16 1) Precall state check on devices. 17 2) Make a call using Dial application on IVI device. 18 3) Assert calling number on IVI device same as called 19 4) Mute call 20 5) Unmute call 21 6) End call 22 7) Assert no any exceptions 23""" 24 25 26from bluetooth_test import bluetooth_base_test 27import logging 28from utilities import constants 29from utilities.main_utils import common_main 30 31class BluetoothMuteUnmuteCallTest(bluetooth_base_test.BluetoothBaseTest): 32 33 def setup_test(self): 34 # Pair the devices 35 self.bt_utils.pair_primary_to_secondary() 36 super().enable_recording() 37 38 def test_dial_phone_number(self): 39 """Tests mute and unmute during phone call functionality.""" 40 #Variable 41 dialer_test_phone_number = constants.INFORMATION_THREE_DIGIT_NUMBER 42 logging.info( 43 'Calling from %s calling to %s', 44 self.target.serial, 45 dialer_test_phone_number,) 46 self.call_utils.dial_a_number(dialer_test_phone_number) 47 self.call_utils.make_call() 48 self.call_utils.wait_with_log(5) 49 self.call_utils.verify_dialing_number(dialer_test_phone_number) 50 self.call_utils.wait_with_log(5) 51 52 # MicroPhone chip displays on status bar during unmuted ongoing call 53 self.call_utils.is_microphone_displayed_on_status_bar( 54 True) 55 56 self.call_utils.mute_call() 57 self.call_utils.wait_with_log(15) 58 59 # MicroPhone chip goes way after 10-15 seconds after call is muted 60 self.call_utils.is_microphone_displayed_on_status_bar( 61 False) 62 63 self.call_utils.unmute_call() 64 65 # MicroPhone chip displays on again status bar during when call is unmuted 66 self.call_utils.is_microphone_displayed_on_status_bar( 67 True) 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 self.call_utils.wait_with_log(5) 74 self.call_utils.press_home() 75 super().teardown_test() 76 77if __name__ == '__main__': 78 common_main()