def testST_AUDIOCOMMS_CSV_DTMF_002(self): ''' Short DTMF tone played to a local user during voice call ''' self.start_mo_call() syms = dtmf_random_str(5) wav = self.local_press_dtmf(syms, long_click=False) self.assert_dtmf_exists(wav, syms, exists=True, similar=0.6) syms = dtmf_random_str(5) wav = self.remote_press_dtmf(syms, long_click=False) self.assert_dtmf_exists(wav, syms, exists=True, similar=0.6)
def assert_audio_active_both_side(self): self.logger.info("check if audio active in both side") syms = dtmf_random_str(8) record = self.local_press_dtmf(syms) self.assert_dtmf_exists(record, syms, similar=0.6) record = self.remote_press_dtmf(syms) self.assert_dtmf_exists(record, syms, similar=0.6)
def testST_AUDIOCOMMS_VOIP_WLAN_134(self): ''' MO VOIP call over WLAN using Android Phone App ''' self.mo_call_sip(answer=True) syms = dtmf_random_str(5) self.check_dtmf_remote(syms)
def testST_AUDIOCOMMS_CSV_DTMF_006(self): ''' The purpose is to verify that the handset is able to generate short DTMF tone generation during a voice call. Iteratively (at least 10 times) ''' count = 1 # indicator for local / remote device self.start_mo_call() try: for i in range(1, 11): self.logger.info("Loop: %d" % i) syms = dtmf_random_str(5) wav = self.local_press_dtmf(syms) self.assert_dtmf_exists(wav, syms, exists=True, similar=0.4) count += 1 time.sleep(2) wav2 = self.remote_press_dtmf(syms) self.assert_dtmf_exists(wav2, syms, exists=True, similar=0.4) count += 1 finally: if count > 20: self.logger.info("No exception in all loops!") return tg = "local" if count % 2 == 1 else "remote" self.logger.info("Oops, failed in loop %d from %s DTMF!" % (i, tg))
def testST_AUDIOCOMMS_CSV_MT_402(self): ''' Mute-Hold-Unhold-Unmute MT CSV Call through Phone App on Headphone ''' # start a MT call and answer self.start_mt_call() # mute the call self.d.telephony.mute_call(True) time.sleep(2) self.assert_voice_mute() # hold the call self.d.telephony.hold_call(True) # check no audio heard in both side syms = dtmf_random_str(5) record = self.local_press_dtmf(syms) self.assert_dtmf_exists(record, syms, exists=False, similar=0.4) record = self.remote_press_dtmf(syms) self.assert_dtmf_exists(record, syms, exists=False, similar=0.4) # unhold the call self.d.telephony.hold_call(False) time.sleep(1) # check call still unmute self.assert_voice_mute() # unmute call, check if call working self.d.telephony.mute_call(False) time.sleep(2) assert not self.d.telephony.is_audio_mute(), 'Unmute fails'
def testST_AUDIOCOMMS_CSV_DTMF_010(self): """Long DTMF tone play to local user during voice call""" self.start_mt_call(answer=True) syms = dtmf_random_str(5) dtmf = self.remote_press_dtmf(syms, long_click=True) time.sleep(1) self.d.telephony.hangup_call() time.sleep(.5) self.assert_dtmf_exists(dtmf, syms, True, similar=0.6)
def assert_hs_active(active, errmsg): syms = dtmf_random_str(10) wav = self.mktemp_wav() self.hs.start_record(wav, rate=44100) self.dut_play_dtmf(syms, effect=effect) self.hs.stop_record() if active: self.assert_dtmf_exists(wav, syms, exists=True, similar=0.6, msg=errmsg) else: self.assert_dtmf_exists(wav, syms, exists=False, similar=0.2, msg=errmsg)
def assert_ihf_active(active, errmsg): syms = dtmf_random_str(10) dut_wav = self.dut_record(0) self.dut_play_dtmf(syms, effect=effect) self.rpc.stopWavRecording() record = self.mktemp_wav() self.adb.pull_file(record, dut_wav) if active: self.assert_dtmf_exists(record, syms, exists=True, similar=0.5, msg=errmsg) else: self.assert_dtmf_exists(record, syms, exists=False, similar=0.3, msg=errmsg)
def assert_voice_mute(self): ''' check if voice is muted ''' assert self.d.telephony.is_audio_mute(), 'Voice is not muted' # the remote peer should not heard sound self.d.record_call() time.sleep(10) record = self.d.stop_record_call() pos = WaveHelper.find_sound(record) assert pos < 0, 'remote can still heard sound after mute' # remote can still be heard in local syms = dtmf_random_str(5) record = self.remote_press_dtmf(syms) self.assert_dtmf_exists(record, syms, similar= 0.7)
def testST_AUDIOCOMMS_CSV_MO_056(self): ''' Mute-Unmute MO 3G CSV Call through Phone App on IHF ''' self.start_mo_call() self.d.telephony.speaker_on(True) for i in range(3): self.d.telephony.mute_call(True) time.sleep(1) self.assert_voice_mute() self.d.telephony.mute_call(False) time.sleep(1) syms = dtmf_random_str(5) record = self.local_press_dtmf(syms) self.assert_dtmf_exists(record, syms, similar=0.6)
def check_multi_call_status(self, ongoing, onhold): ''' Check the status of ongoing call and secondary call @param ongoing: AudioDevice object with telephony propt @param holdon: AudioDevice object with telephony propt ''' self.logger.debug('Check DTMF tone on ongoing call and onhold call') assert ongoing.telephony.is_in_call() assert onhold.telephony.is_in_call() self.d.telephony.enter_dial_pad() ongoing.record_call() onhold.record_call() syms = dtmf_random_str(5) self.press_dtmf(self.d, syms) ongoing_record = ongoing.stop_record_call() holdon_record = onhold.stop_record_call() self.assert_dtmf_exists(ongoing_record, syms, similar=0.6) self.assert_dtmf_exists(holdon_record, syms, exists = False, similar=0.3)
def testST_AUDIOCOMMS_CSV_MT_139(self): ''' Receive and answer/mute/unmute a CSV call through Phone App ''' # start a MT call and answer self.start_mt_call() # mute call self.d.telephony.mute_call(True) time.sleep(2) self.assert_voice_mute() # unmute self.d.telephony.mute_call(False) time.sleep(2) assert not self.d.telephony.is_audio_mute(), 'Unmute fails' syms = dtmf_random_str(6) record = self.local_press_dtmf(syms) self.assert_dtmf_exists(record, syms, similar=0.7)
def __testVoiceCall_MusicPlayback(self): ''' Verify that music playback normally during voice call ''' rpc = self.d.rpc self.start_mo_call() # check if audio is OK under music playback rpc.playLong() self.assert_audio_active_both_side() rpc.resetPlayer() # check if music can be heard in local side # record local sound from MIC # (need set speaker on to have better record) self.d.telephony.speaker_on(True) syms = dtmf_random_str(15) wav = self.d.mktemp_wav() DTMF.encode(syms, wav) self.d.record_mic() self.d.play_file(wav) record = self.d.stop_record_mic() self.assert_dtmf_exists(record, syms, similar=0.5)
def testST_AUDIOCOMMS_CSV_MO_009(self): ''' MO 2G Volume Control earpiece/mono MIC ''' # Initiate a MO CSV call self.start_mo_call() # check voice can be heard syms = dtmf_random_str(5) record = self.local_press_dtmf(syms) self.assert_dtmf_exists(record, syms, similar=0.6) # adjust volume level using HW keys start = self.d.rpc.getStreamVolume(self.VOICE_CALL) self.d.uia_device.press.volume_up() self.d.uia_device.press.volume_up() time.sleep(1) up = self.d.rpc.getStreamVolume(self.VOICE_CALL) assert up > start, 'Volume up failed. Before:%d, after: %d' % (start, up) self.d.uia_device.press.volume_down() self.d.uia_device.press.volume_down() time.sleep(1) down = self.d.rpc.getStreamVolume(self.VOICE_CALL) assert down < up, 'Volume down failed, Before:%d, after: %d' % (up, down)
def testBTA2DPDecode_DialPanelTouchTone(self): ''' Verify that music play smoothly on BT A2DP during play Dial panel touch tone ''' DIALERPAD = 'com.android.dialer' bt = None self.deploy_play_music_content() try: bt = BTAudioAdapter() bt.setup() bt.connect(True) self.launch_play_music_n_play("mp3_sample2") assert self.bt.a2dp_sink.is_active(), "No sound in BT a2dp" self.test_device.adb_cmd("am start -W %s" % DIALERPAD) time.sleep(2) syms = dtmf_random_str(5) for sym in syms: self.d(descriptionContains="%s" % sym).click.wait() time.sleep(.5) wav = bt.a2dp_sink.get_last_wav() self.assert_dtmf_exists(wav, syms, similar=0.6) finally: if bt: bt.teardown()