コード例 #1
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def multi_call_audio_routing(self, pri_dut, sec_dut, ter_dut):
     self.log.info(
         "Test 2 incomming calls scenario to phone, then test audio routing."
     )
     input("Press enter to execute this testcase...")
     if not self.setup_multi_call(sec_dut, ter_dut, pri_dut):
         return False
     input("Press enter to switch to earpiece...")
     self.log.info("Switching to earpiece.")
     set_audio_route(self.log, pri_dut, AUDIO_ROUTE_EARPIECE)
     time.sleep(self.short_timeout)
     if get_audio_route(self.log, pri_dut) != AUDIO_ROUTE_EARPIECE:
         self.log.error(
             "Audio Route not set to {}".format(AUDIO_ROUTE_EARPIECE))
         return False
     input("Press enter to switch to Bluetooth...")
     self.log.info("Switching to Bluetooth...")
     set_audio_route(self.log, pri_dut, AUDIO_ROUTE_BLUETOOTH)
     time.sleep(self.short_timeout)
     if get_audio_route(self.log, pri_dut) != AUDIO_ROUTE_BLUETOOTH:
         self.log.error(
             "Audio Route not set to {}".format(AUDIO_ROUTE_BLUETOOTH))
         return False
     input("Press enter to hangup call 1...")
     if not hangup_call(self.log, sec_dut):
         self.log.error("Failed to hangup call")
         return False
     input("Press enter to hangup call 2...")
     if not hangup_call(self.log, ter_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #2
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def multi_incomming_call(self, pri_dut, sec_dut, ter_dut):
     self.log.info("Test 2 incomming calls scenario to phone.")
     input("Press enter to execute this testcase...")
     if not self.setup_multi_call(sec_dut, ter_dut, pri_dut):
         return False
     input("Press enter to hangup call 1...")
     if not hangup_call(self.log, sec_dut):
         self.log.error("Failed to hangup call")
         return False
     input("Press enter to hangup call 2...")
     if not hangup_call(self.log, ter_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #3
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def outgoing_call_hsp_disabled_then_enabled_during_call(
         self, pri_dut, sec_dut):
     self.log.info(
         "Test outgoing call hsp disabled then enable during call.")
     input("Press enter to execute this testcase...")
     outgoing_num = get_phone_number(self.log, sec_dut)
     if not pri_dut.droid.bluetoothHspDisconnect(self.target_mac_address):
         self.log.error("Failed to disconnect HSP service...")
         return False
     time.sleep(self.short_timeout)
     if len(pri_dut.droid.bluetoothHspGetConnectedDevices()) != 0:
         self.log.error("Failed to disconnect from HSP service")
         return False
     if not initiate_call(self.log, pri_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     time.sleep(default_timeout)
     pri_dut.droid.bluetoothConnectBonded(self.target_mac_address)
     time.sleep(self.short_timeout)
     test_result = True
     if len(pri_dut.droid.bluetoothHspGetConnectedDevices()) != 1:
         self.log.error("Failed to reconnect to HSP service...")
         return
     if not hangup_call(self.log, pri_dut):
         self.log.error("Failed to hangup call")
         return False
     return test_result
コード例 #4
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def multi_call_swap_multiple_times(self, pri_dut, sec_dut, ter_dut):
     self.log.info(
         "Test 2 incomming calls scenario to phone, then test audio routing."
     )
     input("Press enter to execute this testcase...")
     if not self.setup_multi_call(sec_dut, ter_dut, pri_dut):
         return False
     input("Press enter to swap active calls...")
     calls = pri_dut.droid.telecomCallGetCallIds()
     if not swap_calls(self.log, [pri_dut, sec_dut, ter_dut], calls[0],
                       calls[1], 5):
         return False
     input("Press enter to hangup call 1...")
     if not hangup_call(self.log, sec_dut):
         self.log.error("Failed to hangup call")
         return False
     input("Press enter to hangup call 2...")
     if not hangup_call(self.log, ter_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #5
0
def initiate_disconnect_call_dut(pri_ad, sec_ad, duration, callee_number):
    """Initiates call and disconnect call on primary device.

    Steps:
    1. Initiate call from DUT.
    2. Wait for dialing state at DUT and wait for ringing at secondary device.
    3. Accepts call from secondary device.
    4. Wait for call active state at primary and secondary device.
    5. Sleeps until given duration.
    6. Disconnect call from primary device.
    7. Wait for call is not present state.

    Args:
        pri_ad: An android device to disconnect call.
        sec_ad: An android device accepting call.
        duration: Duration of call in seconds.
        callee_number: Secondary device's phone number.

    Returns:
        True if successful, False otherwise.
    """
    if not initiate_call(logging, pri_ad, callee_number):
        pri_ad.log.error("Failed to initiate call")
        return False
    time.sleep(2)

    flag = True
    flag &= wait_for_dialing(logging, pri_ad)
    flag &= wait_for_ringing(logging, sec_ad)
    if not flag:
        pri_ad.log.error("Outgoing call did not get established")
        return False

    if not wait_and_answer_call(logging, sec_ad):
        pri_ad.log.error("Failed to answer call in second device.")
        return False
    # Wait for AG, RE to go into an Active state.
    if not wait_for_active(logging, pri_ad):
        pri_ad.log.error("AG not in Active state.")
        return False
    if not wait_for_active(logging, sec_ad):
        pri_ad.log.error("RE not in Active state.")
        return False
    time.sleep(duration)
    if not hangup_call(logging, pri_ad):
        pri_ad.log.error("Failed to hangup call.")
        return False
    flag = True
    flag &= wait_for_not_in_call(logging, pri_ad)
    flag &= wait_for_not_in_call(logging, sec_ad)

    return flag
コード例 #6
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def multi_call_join_conference_call(self, pri_dut, sec_dut, ter_dut):
     self.log.info(
         "Test 2 incomming calls scenario to phone then join the calls.")
     input("Press enter to execute this testcase...")
     if not self.setup_multi_call(sec_dut, ter_dut, pri_dut):
         return False
     input("Press enter to join active calls...")
     calls = pri_dut.droid.telecomCallGetCallIds()
     pri_dut.droid.telecomCallJoinCallsInConf(calls[0], calls[1])
     time.sleep(WAIT_TIME_IN_CALL)
     if num_active_calls(self.log, pri_dut) != 4:
         self.log.error("Total number of call ids in {} is not 4.".format(
             pri_dut.serial))
         return False
     input("Press enter to hangup call 1...")
     if not hangup_call(self.log, sec_dut):
         self.log.error("Failed to hangup call")
         return False
     input("Press enter to hangup call 2...")
     if not hangup_call(self.log, ter_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #7
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def outgoing_multi_call_join_conference_call(self, pri_dut, sec_dut,
                                              ter_dut):
     self.log.info(
         "Test 2 outgoing calls scenario from phone then join the calls.")
     input("Press enter to execute this testcase...")
     outgoing_num = get_phone_number(self.log, sec_dut)
     if not initiate_call(self.log, pri_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, sec_dut):
         self.log.error("Failed to answer call.")
         return False
     time.sleep(self.short_timeout)
     outgoing_num = get_phone_number(self.log, ter_dut)
     if not initiate_call(self.log, pri_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, ter_dut):
         self.log.error("Failed to answer call.")
         return False
     input("Press enter to join active calls...")
     calls = pri_dut.droid.telecomCallGetCallIds()
     pri_dut.droid.telecomCallJoinCallsInConf(calls[0], calls[1])
     time.sleep(WAIT_TIME_IN_CALL)
     if num_active_calls(self.log, pri_dut) != 4:
         self.log.error("Total number of call ids in {} is not 4.".format(
             pri_dut.serial))
         return False
     input("Press enter to hangup call 1...")
     if not hangup_call(self.log, sec_dut):
         self.log.error("Failed to hangup call")
         return False
     input("Press enter to hangup call 2...")
     if not hangup_call(self.log, ter_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #8
0
def initiate_disconnect_from_hf(audio_receiver, pri_ad, sec_ad, duration):
    """Initiates call and disconnect call on primary device.

    Steps:
    1. Initiate call from HF.
    2. Wait for dialing state at DUT and wait for ringing at secondary device.
    3. Accepts call from secondary device.
    4. Wait for call active state at primary and secondary device.
    5. Sleeps until given duration.
    6. Disconnect call from primary device.
    7. Wait for call is not present state.

    Args:
        audio_receiver: An relay device object.
        pri_ad: An android device to disconnect call.
        sec_ad: An android device accepting call.
        duration: Duration of call in seconds.

    Returns:
        True if successful, False otherwise.
    """
    audio_receiver.press_initiate_call()
    time.sleep(2)
    flag = True
    flag &= wait_for_dialing(logging, pri_ad)
    flag &= wait_for_ringing(logging, sec_ad)
    if not flag:
        pri_ad.log.error("Outgoing call did not get established")
        return False

    if not wait_and_answer_call(logging, sec_ad):
        pri_ad.log.error("Failed to answer call in second device.")
        return False
    if not wait_for_active(logging, pri_ad):
        pri_ad.log.error("AG not in Active state.")
        return False
    if not wait_for_active(logging, sec_ad):
        pri_ad.log.error("RE not in Active state.")
        return False
    time.sleep(duration)
    if not hangup_call(logging, pri_ad):
        pri_ad.log.error("Failed to hangup call.")
        return False
    flag = True
    flag &= wait_for_not_in_call(logging, pri_ad)
    flag &= wait_for_not_in_call(logging, sec_ad)
    return flag
コード例 #9
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def incomming_call_unknown_contact(self, pri_dut, ter_dut):
     self.log.info(
         "Test incomming call scenario to phone from unknown contact")
     input("Press enter to execute this testcase...")
     outgoing_num = get_phone_number(self.log, pri_dut)
     if not initiate_call(self.log, ter_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, pri_dut):
         self.log.error("Failed to answer call.")
         return False
     time.sleep(self.short_timeout)
     input("Press enter to hangup call...")
     if not hangup_call(self.log, ter_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #10
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def outgoing_call_private_number(self, pri_dut, ter_dut):
     self.log.info(
         "Test outgoing call scenario from phone to private number")
     input("Press enter to execute this testcase...")
     outgoing_num = "*67" + get_phone_number(self.log, ter_dut)
     if not initiate_call(self.log, pri_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, ter_dut):
         self.log.error("Failed to answer call.")
         return False
     time.sleep(self.short_timeout)
     input("Press enter to hangup call...")
     if not hangup_call(self.log, pri_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #11
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def call_audio_routes(self, pri_dut, sec_dut):
     self.log.info("Test various audio routes scenario from phone.")
     input("Press enter to execute this testcase...")
     outgoing_num = get_phone_number(self.log, sec_dut)
     if not initiate_call(self.log, pri_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, sec_dut):
         self.log.error("Failed to answer call.")
         return False
     time.sleep(self.short_timeout)
     call_id = pri_dut.droid.telecomCallGetCallIds()[0]
     pri_dut.droid.telecomCallPlayDtmfTone(call_id, "9")
     input("Press enter to switch to speaker...")
     self.log.info("Switching to speaker.")
     set_audio_route(self.log, pri_dut, AUDIO_ROUTE_SPEAKER)
     time.sleep(self.short_timeout)
     if get_audio_route(self.log, pri_dut) != AUDIO_ROUTE_SPEAKER:
         self.log.error(
             "Audio Route not set to {}".format(AUDIO_ROUTE_SPEAKER))
         return False
     input("Press enter to switch to earpiece...")
     self.log.info("Switching to earpiece.")
     set_audio_route(self.log, pri_dut, AUDIO_ROUTE_EARPIECE)
     time.sleep(self.short_timeout)
     if get_audio_route(self.log, pri_dut) != AUDIO_ROUTE_EARPIECE:
         self.log.error(
             "Audio Route not set to {}".format(AUDIO_ROUTE_EARPIECE))
         return False
     input("Press enter to switch to Bluetooth...")
     self.log.info("Switching to Bluetooth...")
     set_audio_route(self.log, pri_dut, AUDIO_ROUTE_BLUETOOTH)
     time.sleep(self.short_timeout)
     if get_audio_route(self.log, pri_dut) != AUDIO_ROUTE_BLUETOOTH:
         self.log.error(
             "Audio Route not set to {}".format(AUDIO_ROUTE_BLUETOOTH))
         return False
     input("Press enter to hangup call...")
     self.log.info("Hanging up call...")
     pri_dut.droid.telecomCallStopDtmfTone(call_id)
     if not hangup_call(self.log, pri_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #12
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def outgoing_call_multiple_iterations(self, pri_dut, sec_dut):
     iteration_count = 3
     self.log.info(
         "Test outgoing call scenario from phone {} times from known contact"
         .format(iteration_count))
     input("Press enter to execute this testcase...")
     outgoing_num = get_phone_number(self.log, sec_dut)
     for _ in range(iteration_count):
         if not initiate_call(self.log, pri_dut, outgoing_num):
             self.log.error("Failed to initiate call")
             return False
         if not wait_and_answer_call(self.log, sec_dut):
             self.log.error("Failed to answer call.")
             return False
         time.sleep(self.short_timeout)
         if not hangup_call(self.log, pri_dut):
             self.log.error("Failed to hangup call")
             return False
     return True
コード例 #13
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def sms_during_incomming_call(self, pri_dut, sec_dut):
     self.log.info(
         "Test incomming call scenario to phone from unknown contact")
     input("Press enter to execute this testcase...")
     outgoing_num = get_phone_number(self.log, pri_dut)
     if not initiate_call(self.log, sec_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, pri_dut):
         self.log.error("Failed to answer call.")
         return False
     time.sleep(self.short_timeout)
     msg = [rand_ascii_str(10)]
     if not sms_send_receive_verify(self.log, sec_dut, pri_dut, msg):
         return False
     else:
         self.log.info("Successfully sent sms. Please verify on carkit.")
     input("Press enter to hangup call...")
     if not hangup_call(self.log, sec_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #14
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def multi_call_join_conference_call_audio_routes(self, pri_dut, sec_dut,
                                                  ter_dut):
     self.log.info(
         "Test 2 incomming calls scenario to phone then join the calls, then test different audio routes."
     )
     input("Press enter to execute this testcase...")
     if not self.setup_multi_call(sec_dut, ter_dut, pri_dut):
         return False
     input("Press enter to join active calls...")
     calls = pri_dut.droid.telecomCallGetCallIds()
     pri_dut.droid.telecomCallJoinCallsInConf(calls[0], calls[1])
     time.sleep(WAIT_TIME_IN_CALL)
     if num_active_calls(self.log, pri_dut) != 4:
         self.log.error("Total number of call ids in {} is not 4.".format(
             pri_dut.serial))
         return False
     input("Press enter to switch to phone speaker...")
     self.log.info("Switching to earpiece.")
     set_audio_route(self.log, pri_dut, AUDIO_ROUTE_EARPIECE)
     time.sleep(self.short_timeout)
     if get_audio_route(self.log, pri_dut) != AUDIO_ROUTE_EARPIECE:
         self.log.error(
             "Audio Route not set to {}".format(AUDIO_ROUTE_EARPIECE))
         return False
     input("Press enter to switch to Bluetooth...")
     self.log.info("Switching to Bluetooth...")
     set_audio_route(self.log, pri_dut, AUDIO_ROUTE_BLUETOOTH)
     time.sleep(self.short_timeout)
     if get_audio_route(self.log, pri_dut) != AUDIO_ROUTE_BLUETOOTH:
         self.log.error(
             "Audio Route not set to {}".format(AUDIO_ROUTE_BLUETOOTH))
         return False
     input("Press enter to hangup conf call...")
     if not hangup_call(self.log, pri_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
コード例 #15
0
ファイル: bt_carkit_lib.py プロジェクト: beylsp/android-acts
 def outgoing_call_a2dp_play_before_and_after(self, pri_dut, sec_dut):
     self.log.info(
         "Test outgoing call scenario while playing music. Music should resume after call."
     )
     pri_dut.adb.shell(KEYCODE_EVENT_PREVIOUS)
     input(
         "Press enter to execute this testcase when music is in a play state..."
     )
     outgoing_num = get_phone_number(self.log, sec_dut)
     if not initiate_call(self.log, pri_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, sec_dut):
         self.log.error("Failed to answer call.")
         return False
     time.sleep(self.short_timeout)
     input("Press enter to hangup call...")
     if not hangup_call(self.log, pri_dut):
         self.log.error("Failed to hangup call")
         return False
     input("Press enter when music continues to play.")
     self.log.info("Pausing Music...")
     pri_dut.adb.shell(KEYCODE_EVENT_PLAY_PAUSE)
     return True