Merge changes I079bd2da,Idd49f134,I29c21d25,I7bbf0403 into nyc-mr1-dev
* changes:
Fix Formatting And Syntax Issues with tel_test_utils.WiFiUtils
Error Check the Airplane Mode Setting in setup_iwlan
Improve the consistency of hanging up calls
Update File Formatting with YAPF
diff --git a/acts/framework/acts/test_utils/tel/tel_test_utils.py b/acts/framework/acts/test_utils/tel/tel_test_utils.py
index 68ce987..4215989 100644
--- a/acts/framework/acts/test_utils/tel/tel_test_utils.py
+++ b/acts/framework/acts/test_utils/tel/tel_test_utils.py
@@ -323,14 +323,17 @@
# FIXME: These event names should be defined in a common location
_BLUETOOTH_STATE_ON_EVENT = 'BluetoothStateChangedOn'
_BLUETOOTH_STATE_OFF_EVENT = 'BluetoothStateChangedOff'
+ ad.ed.clear_events(_BLUETOOTH_STATE_ON_EVENT)
+ ad.ed.clear_events(_BLUETOOTH_STATE_OFF_EVENT)
+
ad.droid.bluetoothStartListeningForAdapterStateChange()
try:
bt_state = ad.droid.bluetoothCheckState()
if bt_state == state:
return True
if max_wait <= 0:
- log.error("Time out: bluetooth state still {}, expecting {}".format(
- bt_state, state))
+ log.error("Time out: bluetooth state still {}, expecting {}".
+ format(bt_state, state))
return False
event = {False: _BLUETOOTH_STATE_OFF_EVENT,
@@ -364,7 +367,6 @@
Returns:
result: True if operation succeed. False if error happens.
"""
- serial_number = ad.serial
ad.ed.clear_all_events()
sub_id_list = []
@@ -376,7 +378,7 @@
cur_state = ad.droid.connectivityCheckAirplaneMode()
if cur_state == new_state:
log.info("Airplane mode already <{}> on {}".format(new_state,
- serial_number))
+ ad.serial))
return True
elif new_state is None:
log.info("Current State {} New state {}".format(cur_state, new_state))
@@ -387,7 +389,7 @@
service_state_list = []
if new_state:
service_state_list.append(SERVICE_STATE_POWER_OFF)
- log.info("Turn on airplane mode: " + serial_number)
+ log.info("Turn on airplane mode on {}".format(ad.serial))
else:
# If either one of these 3 events show up, it should be OK.
@@ -396,7 +398,7 @@
# NO SIM, or Dead SIM, or no Roaming coverage.
service_state_list.append(SERVICE_STATE_OUT_OF_SERVICE)
service_state_list.append(SERVICE_STATE_EMERGENCY_ONLY)
- log.info("Turn off airplane mode: " + serial_number)
+ log.info("Turn off airplane mode on {}.".format(ad.serial))
for sub_id in sub_id_list:
ad.droid.telephonyStartTrackingServiceStateChangeForSubscription(
@@ -418,9 +420,11 @@
except Empty:
pass
if event is None:
- log.error("Did not get expected service state {}".format(
- service_state_list))
- log.info("Received event: {}".format(event))
+ log.error("Did not get expected service state {} on {}".format(
+ service_state_list, ad.serial))
+ return False
+ else:
+ log.info("Received event: {} on {}".format(event, ad.serial))
finally:
for sub_id in sub_id_list:
ad.droid.telephonyStopTrackingServiceStateChangeForSubscription(
@@ -429,13 +433,16 @@
# APM on (new_state=True) will turn off bluetooth but may not turn it on
if new_state and not _wait_for_bluetooth_in_state(
log, ad, False, timeout_time - time.time()):
- log.error("Failed waiting for bluetooth during airplane mode toggle")
+ log.error(
+ "Failed waiting for bluetooth during airplane mode toggle on {}".
+ format(ad.serial))
return False
# APM on (new_state=True) will turn off wifi but may not turn it on
- if new_state and not _wait_for_wifi_in_state(
- log, ad, False, timeout_time - time.time()):
- log.error("Failed waiting for wifi during airplane mode toggle")
+ if new_state and not _wait_for_wifi_in_state(log, ad, False,
+ timeout_time - time.time()):
+ log.error("Failed waiting for wifi during airplane mode toggle on {}.".
+ format(ad.serial))
return False
if ad.droid.connectivityCheckAirplaneMode() != new_state:
@@ -726,9 +733,12 @@
ad: android device object.
Returns:
- True: if incoming call is received and reject successfully.
+ True: if all calls are cleared
False: for errors
"""
+ # short circuit in case no calls are active
+ if not ad.droid.telecomIsInCall():
+ return True
ad.ed.clear_all_events()
ad.droid.telephonyStartTrackingCallState()
log.info("Hangup call.")
@@ -3468,7 +3478,7 @@
from acts.test_utils.wifi.wifi_test_utils \
import WifiEnums as _WifiEnums
from acts.test_utils.wifi.wifi_test_utils \
- import WifiEventNames
+ import WifiEventNames as _WifiEventNames
WIFI_CONFIG_APBAND_2G = _WifiEnums.WIFI_CONFIG_APBAND_2G
WIFI_CONFIG_APBAND_5G = _WifiEnums.WIFI_CONFIG_APBAND_5G
@@ -3511,12 +3521,12 @@
for network in networks:
ad.droid.wifiForgetNetwork(network['networkId'])
try:
- event = ad.ed.pop_event(WifiEventNames.WIFI_FORGET_NW_SUCCESS,
- SHORT_TIMEOUT)
+ event = ad.ed.pop_event(
+ WifiUtils._WifiEventNames.WIFI_FORGET_NW_SUCCESS)
except Empty:
log.warning("Could not confirm the removal of network {}.".
format(network))
- networks = ad.droid.ad.droid.wifiGetConfiguredNetworks()
+ networks = ad.droid.wifiGetConfiguredNetworks()
if len(networks):
log.error("Failed to forget all networks {}.".format(networks))
return False
diff --git a/acts/framework/acts/test_utils/tel/tel_voice_utils.py b/acts/framework/acts/test_utils/tel/tel_voice_utils.py
index 43e04de..30dbf09 100644
--- a/acts/framework/acts/test_utils/tel/tel_voice_utils.py
+++ b/acts/framework/acts/test_utils/tel/tel_voice_utils.py
@@ -328,8 +328,10 @@
True if success. False if fail.
"""
+ # VoLTE settings are unavailable in airplane mode
toggle_airplane_mode(log, ad, False)
+ # Now that we are out of APM, toggle VoLTE if necessary
if ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform():
toggle_volte(log, ad, True)
@@ -345,7 +347,9 @@
log.error("{} set WFC mode failed.".format(ad.serial))
return False
- toggle_airplane_mode(log, ad, is_airplane_mode)
+ if not toggle_airplane_mode(log, ad, is_airplane_mode):
+ log.error("Failed to enable airplane mode on {}".format(ad.serial))
+ return False
if wifi_ssid is not None:
if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd):
diff --git a/acts/tests/google/tel/live/TelLiveVideoTest.py b/acts/tests/google/tel/live/TelLiveVideoTest.py
index f4eb6ba..ed7f100 100644
--- a/acts/tests/google/tel/live/TelLiveVideoTest.py
+++ b/acts/tests/google/tel/live/TelLiveVideoTest.py
@@ -398,8 +398,8 @@
if not call_id_requester or not call_id_responder:
self.log.error("Couldn't find a candidate call id {}:{}, {}:{}"
- .format(ads[0].serial, call_id_requester, ads[
- 1].serial, call_id_responder))
+ .format(ads[0].serial, call_id_requester, ads[1]
+ .serial, call_id_responder))
return False
if not video_call_modify_video(self.log, ads[0], call_id_requester,
@@ -504,8 +504,8 @@
if not call_id_requester or not call_id_responder:
self.log.error("Couldn't find a candidate call id {}:{}, {}:{}"
- .format(ads[0].serial, call_id_requester, ads[
- 1].serial, call_id_responder))
+ .format(ads[0].serial, call_id_requester, ads[1]
+ .serial, call_id_responder))
return False
if not video_call_modify_video(
@@ -611,13 +611,13 @@
MAX_WAIT_TIME_VIDEO_SESSION_EVENT)
if event_on_responder['data']['Event'] != SESSION_EVENT_RX_PAUSE:
self.log.error(
- "Event not correct. event_on_responder: {}. Expected :{}".format(
- event_on_responder, SESSION_EVENT_RX_PAUSE))
+ "Event not correct. event_on_responder: {}. Expected :{}".
+ format(event_on_responder, SESSION_EVENT_RX_PAUSE))
return False
if event_on_requester['data']['Event'] != SESSION_EVENT_RX_PAUSE:
self.log.error(
- "Event not correct. event_on_requester: {}. Expected :{}".format(
- event_on_requester, SESSION_EVENT_RX_PAUSE))
+ "Event not correct. event_on_requester: {}. Expected :{}".
+ format(event_on_requester, SESSION_EVENT_RX_PAUSE))
return False
except Empty:
self.log.error("Expected event not received.")
@@ -654,13 +654,13 @@
MAX_WAIT_TIME_VIDEO_SESSION_EVENT)
if event_on_responder['data']['Event'] != SESSION_EVENT_RX_RESUME:
self.log.error(
- "Event not correct. event_on_responder: {}. Expected :{}".format(
- event_on_responder, SESSION_EVENT_RX_RESUME))
+ "Event not correct. event_on_responder: {}. Expected :{}".
+ format(event_on_responder, SESSION_EVENT_RX_RESUME))
return False
if event_on_requester['data']['Event'] != SESSION_EVENT_RX_RESUME:
self.log.error(
- "Event not correct. event_on_requester: {}. Expected :{}".format(
- event_on_requester, SESSION_EVENT_RX_RESUME))
+ "Event not correct. event_on_requester: {}. Expected :{}".
+ format(event_on_requester, SESSION_EVENT_RX_RESUME))
return False
except Empty:
self.log.error("Expected event not received.")
@@ -789,12 +789,13 @@
return False
self.log.info("Step2: Initiate Voice Call PhoneA->PhoneC.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[2],
- None,
- verify_caller_func=None,
- verify_callee_func=is_phone_in_call_volte):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[2],
+ None,
+ verify_caller_func=None,
+ verify_callee_func=is_phone_in_call_volte):
self.log.error("Failed to setup a call")
return False
@@ -857,12 +858,13 @@
return False
self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.")
- if not call_setup_teardown(self.log,
- ads[2],
- ads[0],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=None):
+ if not call_setup_teardown(
+ self.log,
+ ads[2],
+ ads[0],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=None):
self.log.error("Failed to setup a call")
return False
@@ -910,12 +912,13 @@
return False
self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[1],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=is_phone_in_call_volte):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[1],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=is_phone_in_call_volte):
self.log.error("Failed to setup a call")
return False
calls = ads[0].droid.telecomCallGetCallIds()
@@ -983,12 +986,13 @@
return False
self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[1],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=is_phone_in_call_volte):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[1],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=is_phone_in_call_volte):
self.log.error("Failed to setup a call")
return False
calls = ads[0].droid.telecomCallGetCallIds()
@@ -1075,12 +1079,13 @@
return False
self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.")
- if not call_setup_teardown(self.log,
- ads[2],
- ads[0],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=None):
+ if not call_setup_teardown(
+ self.log,
+ ads[2],
+ ads[0],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=None):
self.log.error("Failed to setup a call")
return False
@@ -1184,12 +1189,13 @@
return False
self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.")
- if not call_setup_teardown(self.log,
- ads[2],
- ads[0],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=None):
+ if not call_setup_teardown(
+ self.log,
+ ads[2],
+ ads[0],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=None):
self.log.error("Failed to setup a call")
return False
@@ -1643,15 +1649,16 @@
# Check if Conf Call is currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return False
self.log.info(
"Merge - Step2: End call on PhoneB and verify call continues.")
- ads[1].droid.telecomEndCall()
+ if not hangup_call(self.log, ads[1]):
+ self.log.error("Failed to end the call on PhoneB")
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = ads[0].droid.telecomCallGetCallIds()
self.log.info("Calls in PhoneA{}".format(calls))
@@ -1660,8 +1667,10 @@
if not verify_incall_state(self.log, [ads[1]], False):
return False
- ads[1].droid.telecomEndCall()
- ads[0].droid.telecomEndCall()
+ if not (hangup_call(self.log, ads[2]) and
+ hangup_call(self.log, ads[0])):
+ self.log.error("Failed to clean up remaining calls")
+ return False
return True
def _test_vt_conference_merge_drop_cep(self, ads, call_ab_id, call_ac_id):
@@ -1721,15 +1730,14 @@
# Check if Conf Call is currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return False
- self.log.info(
- "End call on PhoneB and verify call continues.")
- ads[1].droid.telecomEndCall()
+ if not hangup_call(self.log, ads[1]):
+ self.log.error("Failed to end call on PhoneB")
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = ads[0].droid.telecomCallGetCallIds()
self.log.info("Calls in PhoneA{}".format(calls))
@@ -1738,8 +1746,10 @@
if not verify_incall_state(self.log, [ads[1]], False):
return False
- ads[1].droid.telecomEndCall()
- ads[0].droid.telecomEndCall()
+ if not (hangup_call(self.log, ads[2]) and
+ hangup_call(self.log, ads[0])):
+ self.log.error("Failed to clean up remaining calls")
+ return False
return True
@@ -1778,8 +1788,7 @@
True)
def _test_call_volte_add_mo_video_accept_as_voice_merge_drop(
- self,
- use_cep=False):
+ self, use_cep=False):
# This test case is not supported by VZW.
ads = self.android_devices
tasks = [(phone_setup_video, (self.log, ads[0])),
@@ -1873,8 +1882,7 @@
True)
def _test_call_volte_add_mt_video_accept_as_voice_merge_drop(
- self,
- use_cep=False):
+ self, use_cep=False):
ads = self.android_devices
tasks = [(phone_setup_video, (self.log, ads[0])),
(phone_setup_volte, (self.log, ads[1])), (phone_setup_video,
@@ -1997,12 +2005,13 @@
return False
self.log.info("Step2: Initiate Voice Call PhoneA->PhoneC.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[2],
- None,
- verify_caller_func=None,
- verify_callee_func=is_phone_in_call_volte):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[2],
+ None,
+ verify_caller_func=None,
+ verify_callee_func=is_phone_in_call_volte):
self.log.error("Failed to setup a call")
return False
@@ -2145,12 +2154,13 @@
return False
self.log.info("Step2: Initiate Voice Call PhoneC->PhoneA.")
- if not call_setup_teardown(self.log,
- ads[2],
- ads[0],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=None):
+ if not call_setup_teardown(
+ self.log,
+ ads[2],
+ ads[0],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=None):
self.log.error("Failed to setup a call")
return False
@@ -2272,12 +2282,13 @@
return False
self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[1],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=is_phone_in_call_volte):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[1],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=is_phone_in_call_volte):
self.log.error("Failed to setup a call")
return False
calls = ads[0].droid.telecomCallGetCallIds()
@@ -2399,12 +2410,13 @@
return False
self.log.info("Step1: Initiate VoLTE Call PhoneA->PhoneB.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[1],
- None,
- verify_caller_func=is_phone_in_call_volte,
- verify_callee_func=is_phone_in_call_volte):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[1],
+ None,
+ verify_caller_func=is_phone_in_call_volte,
+ verify_callee_func=is_phone_in_call_volte):
self.log.error("Failed to setup a call")
return False
calls = ads[0].droid.telecomCallGetCallIds()
diff --git a/acts/tests/google/tel/live/TelLiveVoiceConfTest.py b/acts/tests/google/tel/live/TelLiveVoiceConfTest.py
index ca77613..3982ea0 100644
--- a/acts/tests/google/tel/live/TelLiveVoiceConfTest.py
+++ b/acts/tests/google/tel/live/TelLiveVoiceConfTest.py
@@ -40,6 +40,7 @@
ensure_network_generation_for_subscription
from acts.test_utils.tel.tel_test_utils import get_call_uri
from acts.test_utils.tel.tel_test_utils import get_phone_number
+from acts.test_utils.tel.tel_test_utils import hangup_call
from acts.test_utils.tel.tel_test_utils import is_uri_equivalent
from acts.test_utils.tel.tel_test_utils import multithread_func
from acts.test_utils.tel.tel_test_utils import num_active_calls
@@ -384,7 +385,7 @@
# Airplane Mode, WiFi Preferred
"test_epdg_mo_mt_add_epdg_swap_once_merge_drop_second_call_from_host_wfc_apm_wifi_preferred_cep",
"test_epdg_mo_mt_add_epdg_swap_once_merge_drop_second_call_from_participant_wfc_apm_wifi_preferred_cep",
- )
+ )
self.wifi_network_ssid = self.user_params["wifi_network_ssid"]
@@ -395,6 +396,13 @@
""" Private Test Utils """
+ def _hangup_call(self, ad, device_description='Device'):
+ if not hangup_call(self.log, ad):
+ self.log.error("Failed to hang up on {}: {}".format(
+ device_description, ad.serial))
+ return False
+ return True
+
def _three_phone_call_mo_add_mo(self, ads, phone_setups, verify_funcs):
"""Use 3 phones to make MO calls.
@@ -434,12 +442,13 @@
raise _CallException("Clear call list failed.")
self.log.info("Step1: Call From PhoneA to PhoneB.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[1],
- ad_hangup=None,
- verify_caller_func=verify_func_a,
- verify_callee_func=verify_func_b):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[1],
+ ad_hangup=None,
+ verify_caller_func=verify_func_a,
+ verify_callee_func=verify_func_b):
raise _CallException("PhoneA call PhoneB failed.")
calls = ads[0].droid.telecomCallGetCallIds()
@@ -449,12 +458,13 @@
call_ab_id = calls[0]
self.log.info("Step2: Call From PhoneA to PhoneC.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[2],
- ad_hangup=None,
- verify_caller_func=verify_func_a,
- verify_callee_func=verify_func_c):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[2],
+ ad_hangup=None,
+ verify_caller_func=verify_func_a,
+ verify_callee_func=verify_func_c):
raise _CallException("PhoneA call PhoneC failed.")
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]],
True):
@@ -504,12 +514,13 @@
raise _CallException("Clear call list failed.")
self.log.info("Step1: Call From PhoneA to PhoneB.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[1],
- ad_hangup=None,
- verify_caller_func=verify_func_a,
- verify_callee_func=verify_func_b):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[1],
+ ad_hangup=None,
+ verify_caller_func=verify_func_a,
+ verify_callee_func=verify_func_b):
raise _CallException("PhoneA call PhoneB failed.")
calls = ads[0].droid.telecomCallGetCallIds()
@@ -519,12 +530,13 @@
call_ab_id = calls[0]
self.log.info("Step2: Call From PhoneC to PhoneA.")
- if not call_setup_teardown(self.log,
- ads[2],
- ads[0],
- ad_hangup=None,
- verify_caller_func=verify_func_c,
- verify_callee_func=verify_func_a):
+ if not call_setup_teardown(
+ self.log,
+ ads[2],
+ ads[0],
+ ad_hangup=None,
+ verify_caller_func=verify_func_c,
+ verify_callee_func=verify_func_a):
raise _CallException("PhoneA call PhoneC failed.")
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]],
True):
@@ -559,12 +571,13 @@
try:
verify_func_a, verify_func_b = verify_funcs
self.log.info("Step1: Call From PhoneA to PhoneB.")
- if not call_setup_teardown(self.log,
- ads[0],
- ads[1],
- ad_hangup=None,
- verify_caller_func=verify_func_a,
- verify_callee_func=verify_func_b):
+ if not call_setup_teardown(
+ self.log,
+ ads[0],
+ ads[1],
+ ad_hangup=None,
+ verify_caller_func=verify_func_a,
+ verify_callee_func=verify_func_b):
raise _CallException("PhoneA call PhoneB failed.")
self.log.info("Step2: Call From PhoneC to PhoneA then decline.")
@@ -618,12 +631,13 @@
raise _CallException("Clear call list failed.")
self.log.info("Step1: Call From PhoneB to PhoneA.")
- if not call_setup_teardown(self.log,
- ads[1],
- ads[0],
- ad_hangup=None,
- verify_caller_func=verify_func_b,
- verify_callee_func=verify_func_a):
+ if not call_setup_teardown(
+ self.log,
+ ads[1],
+ ads[0],
+ ad_hangup=None,
+ verify_caller_func=verify_func_b,
+ verify_callee_func=verify_func_a):
raise _CallException("PhoneB call PhoneA failed.")
calls = ads[0].droid.telecomCallGetCallIds()
@@ -633,12 +647,13 @@
call_ab_id = calls[0]
self.log.info("Step2: Call From PhoneC to PhoneA.")
- if not call_setup_teardown(self.log,
- ads[2],
- ads[0],
- ad_hangup=None,
- verify_caller_func=verify_func_c,
- verify_callee_func=verify_func_a):
+ if not call_setup_teardown(
+ self.log,
+ ads[2],
+ ads[0],
+ ad_hangup=None,
+ verify_caller_func=verify_func_c,
+ verify_callee_func=verify_func_a):
raise _CallException("PhoneA call PhoneC failed.")
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]],
True):
@@ -731,12 +746,13 @@
if num_swaps > 0:
self.log.info("Step3: Begin Swap x{} test.".format(num_swaps))
- if not swap_calls(self.log,
- ads,
- call_ab_id,
- call_ac_id,
- num_swaps,
- check_call_status=False):
+ if not swap_calls(
+ self.log,
+ ads,
+ call_ab_id,
+ call_ac_id,
+ num_swaps,
+ check_call_status=False):
self.log.error("Swap test failed.")
return None, None, None
@@ -784,12 +800,13 @@
if num_swaps > 0:
self.log.info("Step3: Begin Swap x{} test.".format(num_swaps))
- if not swap_calls(self.log,
- ads,
- call_ab_id,
- call_ac_id,
- num_swaps,
- check_call_status=False):
+ if not swap_calls(
+ self.log,
+ ads,
+ call_ab_id,
+ call_ac_id,
+ num_swaps,
+ check_call_status=False):
self.log.error("Swap test failed.")
return None, None, None
@@ -815,7 +832,8 @@
True if no error happened. Otherwise False.
"""
self.log.info("Drop 1st call.")
- first_drop_ad.droid.telecomEndCall()
+ if not self._hangup_call(first_drop_ad):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = host.droid.telecomCallGetCallIds()
self.log.info("Calls in Host{}".format(calls))
@@ -827,7 +845,8 @@
return False
self.log.info("Drop 2nd call.")
- second_drop_ad.droid.telecomEndCall()
+ if not self._hangup_call(second_drop_ad):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(
self.log, [host, second_drop_ad, first_drop_ad], False):
@@ -853,8 +872,9 @@
Returns:
True if no error happened. Otherwise False.
"""
- self.log.info("Drop current call on DUT.")
- host.droid.telecomEndCall()
+ self.log.info("Drop current call on Host.")
+ if not self._hangup_call(host, "Host"):
+ return False
if not wait_and_answer_call(self.log, host, get_phone_number(
self.log, held_participant_ad)):
self.log.error("Did not receive call back.")
@@ -866,8 +886,9 @@
if not verify_incall_state(self.log, [active_participant_ad], False):
return False
- self.log.info("Drop current call on DUT.")
- host.droid.telecomEndCall()
+ self.log.info("Drop current call on Host.")
+ if not self._hangup_call(host, "Host"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [host, held_participant_ad,
active_participant_ad], False):
@@ -888,8 +909,9 @@
Returns:
True if no error happened. Otherwise False.
"""
- self.log.info("Drop conference call on host.")
- host.droid.telecomEndCall()
+ self.log.info("Drop conference call on Host.")
+ if not self._hangup_call(host, "Host"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [host], False):
return False
@@ -1085,9 +1107,8 @@
# make sure PhoneB and PhoneC are GSM phone before proceed.
for ad in [ads[1], ads[2]]:
if (ad.droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
- self.log.error(
- "{} not GSM phone, abort wcdma swap test.".format(
- ad.serial))
+ self.log.error("{} not GSM phone, abort wcdma swap test.".
+ format(ad.serial))
return None, None
call_ab_id = self._three_phone_call_mo_add_mo(
@@ -1138,9 +1159,8 @@
# make sure PhoneB and PhoneC are GSM phone before proceed.
for ad in [ads[1], ads[2]]:
if (ad.droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
- self.log.error(
- "{} not GSM phone, abort wcdma swap test.".format(
- ad.serial))
+ self.log.error("{} not GSM phone, abort wcdma swap test.".
+ format(ad.serial))
return None, None
call_ab_id = self._three_phone_call_mo_add_mt(
@@ -1191,9 +1211,8 @@
# make sure PhoneB and PhoneC are GSM phone before proceed.
for ad in [ads[1], ads[2]]:
if (ad.droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
- self.log.error(
- "{} not GSM phone, abort wcdma swap test.".format(
- ad.serial))
+ self.log.error("{} not GSM phone, abort wcdma swap test.".
+ format(ad.serial))
return None, None
call_ab_id = self._three_phone_call_mt_add_mt(
@@ -1672,14 +1691,14 @@
# Check if Conf Call is currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return False
self.log.info("Step5: End call on PhoneC and verify call continues.")
- ads[2].droid.telecomEndCall()
+ if not self._hangup_call(ads[2], "PhoneC"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = ads[0].droid.telecomCallGetCallIds()
self.log.info("Calls in PhoneA{}".format(calls))
@@ -1693,7 +1712,8 @@
# providing such information to DUT.
# So this test probably will fail on the last step for VZW.
self.log.info("Step6: End call on PhoneB and verify PhoneA end.")
- ads[1].droid.telecomEndCall()
+ if not self._hangup_call(ads[1], "PhoneB"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
return False
@@ -1757,10 +1777,9 @@
# Check if Conf Call is currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return None
return call_conf_id
@@ -1791,7 +1810,8 @@
return False
self.log.info("Step5: End call on PhoneC and verify call continues.")
- ads[2].droid.telecomEndCall()
+ if not self._hangup_call(ads[2], "PhoneC"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = ads[0].droid.telecomCallGetCallIds()
self.log.info("Calls in PhoneA{}".format(calls))
@@ -1801,7 +1821,8 @@
return False
self.log.info("Step6: End call on PhoneB and verify PhoneA end.")
- ads[1].droid.telecomEndCall()
+ if not self._hangup_call(ads[1], "PhoneB"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
return False
@@ -1833,7 +1854,8 @@
return False
self.log.info("Step5: End call on PhoneB and verify call continues.")
- ads[1].droid.telecomEndCall()
+ if not self._hangup_call(ads[1], "PhoneB"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [ads[0], ads[2]], True):
return False
@@ -1841,7 +1863,8 @@
return False
self.log.info("Step6: End call on PhoneC and verify PhoneA end.")
- ads[2].droid.telecomEndCall()
+ if not self._hangup_call(ads[2], "PhoneC"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
return False
@@ -2022,14 +2045,14 @@
# Check if Conf Call is currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return False
self.log.info("Step5: End call on PhoneC and verify call continues.")
- ads[2].droid.telecomEndCall()
+ if not self._hangup_call(ads[2], "PhoneC"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = ads[0].droid.telecomCallGetCallIds()
self.log.info("Calls in PhoneA{}".format(calls))
@@ -2041,7 +2064,8 @@
return False
self.log.info("Step6: End call on PhoneB and verify PhoneA end.")
- ads[1].droid.telecomEndCall()
+ if not self._hangup_call(ads[1], "PhoneB"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
return False
@@ -2071,7 +2095,8 @@
self.log.info("Hangup at {}, verify call continues.".format(
ad_hangup.serial))
- ad_hangup.droid.telecomEndCall()
+ if not self._hangup_call(ad_hangup):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if ad_verify.droid.telecomCallGetCallState(call_id) != call_state:
@@ -2385,9 +2410,8 @@
# make sure PhoneB and PhoneC are GSM phone before proceed.
for ad in [ads[1], ads[2]]:
if (ad.droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
- self.log.error(
- "{} not GSM phone, abort wcdma swap test.".format(
- ad.serial))
+ self.log.error("{} not GSM phone, abort wcdma swap test.".
+ format(ad.serial))
return None, None
# To make thing simple, for epdg, setup should be called before calling
@@ -2439,9 +2463,8 @@
# make sure PhoneB and PhoneC are GSM phone before proceed.
for ad in [ads[1], ads[2]]:
if (ad.droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
- self.log.error(
- "{} not GSM phone, abort wcdma swap test.".format(
- ad.serial))
+ self.log.error("{} not GSM phone, abort wcdma swap test.".
+ format(ad.serial))
return None, None
# To make thing simple, for epdg, setup should be called before calling
@@ -2493,9 +2516,8 @@
# make sure PhoneB and PhoneC are GSM phone before proceed.
for ad in [ads[1], ads[2]]:
if (ad.droid.telephonyGetPhoneType() != PHONE_TYPE_GSM):
- self.log.error(
- "{} not GSM phone, abort wcdma swap test.".format(
- ad.serial))
+ self.log.error("{} not GSM phone, abort wcdma swap test.".
+ format(ad.serial))
return None, None
# To make thing simple, for epdg, setup should be called before calling
@@ -2724,14 +2746,14 @@
# Check if Conf Call is currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return False
self.log.info("Step5: End call on PhoneC and verify call continues.")
- ads[2].droid.telecomEndCall()
+ if not self._hangup_call(ads[2], "PhoneC"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = ads[0].droid.telecomCallGetCallIds()
self.log.info("Calls in PhoneA{}".format(calls))
@@ -2741,7 +2763,8 @@
return False
self.log.info("Step6: End call on PhoneB and verify PhoneA end.")
- ads[1].droid.telecomEndCall()
+ if not self._hangup_call(ads[1], "PhoneB"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
return False
@@ -7282,10 +7305,9 @@
# Check if Conf Call currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return False
# Unmerge
@@ -7309,10 +7331,9 @@
# Unmerged call in call state ACTIVE?
if ads[0].droid.telecomCallGetCallState(
call_ab_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_ab_id, ads[0].droid.telecomCallGetCallState(
- call_ab_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_ab_id, ads[0]
+ .droid.telecomCallGetCallState(call_ab_id)))
return False
# Swap call
@@ -7325,10 +7346,9 @@
# Other call in call state ACTIVE?
if ads[0].droid.telecomCallGetCallState(
call_ac_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_ac_id, ads[0].droid.telecomCallGetCallState(
- call_ac_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_ac_id, ads[0]
+ .droid.telecomCallGetCallState(call_ac_id)))
return False
# All calls still CONNECTED?
@@ -7831,8 +7851,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -7861,8 +7881,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -7891,8 +7911,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8430,8 +8450,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8460,8 +8480,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8490,8 +8510,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8521,8 +8541,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8550,8 +8570,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8580,8 +8600,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8610,8 +8630,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8641,8 +8661,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8670,8 +8690,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8699,8 +8719,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8729,8 +8749,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8759,8 +8779,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8788,8 +8808,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8817,8 +8837,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8847,8 +8867,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -8877,8 +8897,8 @@
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
self.wifi_network_ssid, self.wifi_network_pass)),
- (phone_setup_voice_3g, (self.log, ads[1])), (phone_setup_voice_3g,
- (self.log, ads[2]))]
+ (phone_setup_voice_3g, (self.log, ads[1])), (
+ phone_setup_voice_3g, (self.log, ads[2]))]
if not multithread_func(self.log, tasks):
self.log.error("Phone Failed to Set Up Properly.")
return False
@@ -9726,14 +9746,14 @@
# Check if Conf Call is currently active
if ads[0].droid.telecomCallGetCallState(
call_conf_id) != CALL_STATE_ACTIVE:
- self.log.error(
- "Call_id:{}, state:{}, expected: STATE_ACTIVE".format(
- call_conf_id, ads[0].droid.telecomCallGetCallState(
- call_conf_id)))
+ self.log.error("Call_id:{}, state:{}, expected: STATE_ACTIVE".
+ format(call_conf_id, ads[
+ 0].droid.telecomCallGetCallState(call_conf_id)))
return False
self.log.info("Step5: End call on PhoneC and verify call continues.")
- ads[2].droid.telecomEndCall()
+ if not self._hangup_call(ads[2], "PhoneC"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
calls = ads[0].droid.telecomCallGetCallIds()
self.log.info("Calls in PhoneA{}".format(calls))
@@ -9745,7 +9765,8 @@
return False
self.log.info("Step6: End call on PhoneB and verify PhoneA end.")
- ads[1].droid.telecomEndCall()
+ if not self._hangup_call(ads[1], "PhoneB"):
+ return False
time.sleep(WAIT_TIME_IN_CALL)
if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
return False
diff --git a/acts/tests/google/tel/live/TelPowerTest.py b/acts/tests/google/tel/live/TelPowerTest.py
index 37b88d9..18b6969 100644
--- a/acts/tests/google/tel/live/TelPowerTest.py
+++ b/acts/tests/google/tel/live/TelPowerTest.py
@@ -22,6 +22,7 @@
from acts.test_utils.tel.tel_test_utils import ensure_phone_default_state
from acts.test_utils.tel.tel_test_utils import ensure_phones_idle
from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected
+from acts.test_utils.tel.tel_test_utils import hangup_call
from acts.test_utils.tel.tel_test_utils import is_wfc_enabled
from acts.test_utils.tel.tel_test_utils import set_phone_screen_on
from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode
@@ -110,8 +111,7 @@
"test_power_mobile_data_always_on_lte_wifi_on",
"test_power_mobile_data_always_on_wcdma_wifi_on",
"test_power_mobile_data_always_on_gsm_wifi_on",
- "test_power_mobile_data_always_on_1x_wifi_on"
- )
+ "test_power_mobile_data_always_on_1x_wifi_on")
def setup_class(self):
super().setup_class()
@@ -166,16 +166,13 @@
self.log.error("DUT Failed to Set Up Properly.")
return False
result = self.mon.measure_power(
- ACTIVE_CALL_TEST_SAMPLING_RATE,
- ACTIVE_CALL_TEST_SAMPLE_TIME,
- test_name,
- ACTIVE_CALL_TEST_OFFSET_TIME
- )
+ ACTIVE_CALL_TEST_SAMPLING_RATE, ACTIVE_CALL_TEST_SAMPLE_TIME,
+ test_name, ACTIVE_CALL_TEST_OFFSET_TIME)
self._save_logs_for_power_test(test_name, result)
average_current = result.average_current
- if not verify_incall_state(self.log, [self.android_devices[0],
- self.android_devices[1]],
- True):
+ if not verify_incall_state(self.log, [
+ self.android_devices[0], self.android_devices[1]
+ ], True):
self.log.error("Call drop during power test.")
return False
if ((phone_check_func_after_power_test is not None) and
@@ -186,7 +183,7 @@
return False
return (average_current <= pass_criteria)
finally:
- self.android_devices[1].droid.telecomEndCall()
+ hangup_call(self.log, self.android_devices[1])
self.log.info("Result: {} mA, pass criteria: {} mA".format(
average_current, pass_criteria))
@@ -203,12 +200,9 @@
if not test_setup_func(self.android_devices[0], *args, **kwargs):
self.log.error("DUT Failed to Set Up Properly.")
return False
- result = self.mon.measure_power(
- IDLE_TEST_SAMPLING_RATE,
- IDLE_TEST_SAMPLE_TIME,
- test_name,
- IDLE_TEST_OFFSET_TIME
- )
+ result = self.mon.measure_power(IDLE_TEST_SAMPLING_RATE,
+ IDLE_TEST_SAMPLE_TIME, test_name,
+ IDLE_TEST_OFFSET_TIME)
self._save_logs_for_power_test(test_name, result)
average_current = result.average_current
if ((phone_check_func_after_power_test is not None) and
@@ -241,7 +235,9 @@
ad.droid.goToSleepNow()
return True
- def _setup_phone_mobile_data_always_on(self, ad, phone_setup_func,
+ def _setup_phone_mobile_data_always_on(self,
+ ad,
+ phone_setup_func,
connect_wifi,
wifi_ssid=None,
wifi_password=None,
@@ -251,8 +247,8 @@
self.log.error("Phone failed to setup {}.".format(
phone_setup_func.__name__))
return False
- if (connect_wifi and
- not ensure_wifi_connected(self.log, ad, wifi_ssid, wifi_password)):
+ if (connect_wifi and not ensure_wifi_connected(self.log, ad, wifi_ssid,
+ wifi_password)):
self.log.error("WiFi connect failed")
return False
# simulate normal user behavior -- wake up every 1 minutes and do ping
@@ -303,11 +299,12 @@
if not phone_idle_iwlan(self.log, ad):
self.log.error("DUT not in WFC enabled state.")
return False
- if not call_setup_teardown(self.log,
- ad,
- self.android_devices[1],
- ad_hangup=None,
- verify_caller_func=is_phone_in_call_iwlan):
+ if not call_setup_teardown(
+ self.log,
+ ad,
+ self.android_devices[1],
+ ad_hangup=None,
+ verify_caller_func=is_phone_in_call_iwlan):
self.log.error("Setup Call failed.")
return False
ad.droid.goToSleepNow()
@@ -555,8 +552,8 @@
Pass criteria info should be in test config file.
"""
try:
- PASS_CRITERIA = int(self.user_params[
- "pass_criteria_idle_baseline"]["pass_criteria"])
+ PASS_CRITERIA = int(self.user_params["pass_criteria_idle_baseline"]
+ ["pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
@@ -600,7 +597,8 @@
self.log.error("Phone failed to turn on airplane mode.")
return False
if not ensure_wifi_connected(self.log, ad,
- self.wifi_network_ssid_2g, self.wifi_network_pass_2g):
+ self.wifi_network_ssid_2g,
+ self.wifi_network_pass_2g):
self.log.error("WiFi connect failed")
return False
ad.droid.goToSleepNow()
@@ -897,10 +895,11 @@
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
# TODO: b/26338146 need a SL4A API to clear all existing alarms.
- result = self._test_power_idle("test_power_idle_3g_wakeup_ping",
- self._setup_phone_idle_and_wakeup_ping,
- PASS_CRITERIA,
- phone_setup_func=phone_setup_voice_3g)
+ result = self._test_power_idle(
+ "test_power_idle_3g_wakeup_ping",
+ self._setup_phone_idle_and_wakeup_ping,
+ PASS_CRITERIA,
+ phone_setup_func=phone_setup_voice_3g)
return result
# TODO: This one is not working right now. Requires SL4A API to start alarm.
@@ -911,11 +910,12 @@
"pass_criteria_mobile_data_always_on_lte"]["pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
- result = self._test_power_idle("test_power_mobile_data_always_on_lte",
- self._setup_phone_mobile_data_always_on,
- PASS_CRITERIA,
- phone_setup_func=phone_setup_csfb,
- connect_wifi=False)
+ result = self._test_power_idle(
+ "test_power_mobile_data_always_on_lte",
+ self._setup_phone_mobile_data_always_on,
+ PASS_CRITERIA,
+ phone_setup_func=phone_setup_csfb,
+ connect_wifi=False)
set_mobile_data_always_on(self.ad, False)
return result
@@ -927,11 +927,12 @@
"pass_criteria_mobile_data_always_on_wcdma"]["pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
- result = self._test_power_idle("test_power_mobile_data_always_on_wcdma",
- self._setup_phone_mobile_data_always_on,
- PASS_CRITERIA,
- phone_setup_func=phone_setup_voice_3g,
- connect_wifi=False)
+ result = self._test_power_idle(
+ "test_power_mobile_data_always_on_wcdma",
+ self._setup_phone_mobile_data_always_on,
+ PASS_CRITERIA,
+ phone_setup_func=phone_setup_voice_3g,
+ connect_wifi=False)
set_mobile_data_always_on(self.ad, False)
return result
@@ -943,11 +944,12 @@
"pass_criteria_mobile_data_always_on_1xevdo"]["pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
- result = self._test_power_idle("test_power_mobile_data_always_on_1xevdo",
- self._setup_phone_mobile_data_always_on,
- PASS_CRITERIA,
- phone_setup_func=phone_setup_voice_3g,
- connect_wifi=False)
+ result = self._test_power_idle(
+ "test_power_mobile_data_always_on_1xevdo",
+ self._setup_phone_mobile_data_always_on,
+ PASS_CRITERIA,
+ phone_setup_func=phone_setup_voice_3g,
+ connect_wifi=False)
set_mobile_data_always_on(self.ad, False)
return result
@@ -959,11 +961,12 @@
"pass_criteria_mobile_data_always_on_gsm"]["pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
- result = self._test_power_idle("test_power_mobile_data_always_on_gsm",
- self._setup_phone_mobile_data_always_on,
- PASS_CRITERIA,
- phone_setup_func=phone_setup_voice_2g,
- connect_wifi=False)
+ result = self._test_power_idle(
+ "test_power_mobile_data_always_on_gsm",
+ self._setup_phone_mobile_data_always_on,
+ PASS_CRITERIA,
+ phone_setup_func=phone_setup_voice_2g,
+ connect_wifi=False)
set_mobile_data_always_on(self.ad, False)
return result
@@ -973,7 +976,7 @@
try:
PASS_CRITERIA = int(self.user_params[
"pass_criteria_mobile_data_always_on_lte_wifi_on"][
- "pass_criteria"])
+ "pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
result = self._test_power_idle(
@@ -993,7 +996,7 @@
try:
PASS_CRITERIA = int(self.user_params[
"pass_criteria_mobile_data_always_on_wcdma_wifi_on"][
- "pass_criteria"])
+ "pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
result = self._test_power_idle(
@@ -1013,7 +1016,7 @@
try:
PASS_CRITERIA = int(self.user_params[
"pass_criteria_mobile_data_always_on_1xevdo_wifi_on"][
- "pass_criteria"])
+ "pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
result = self._test_power_idle(
@@ -1033,7 +1036,7 @@
try:
PASS_CRITERIA = int(self.user_params[
"pass_criteria_mobile_data_always_on_gsm_wifi_on"][
- "pass_criteria"])
+ "pass_criteria"])
except KeyError:
PASS_CRITERIA = DEFAULT_POWER_PASS_CRITERIA
result = self._test_power_idle(