Merge "Add pixellogger support."
diff --git a/acts/framework/acts/test_utils/tel/TelephonyBaseTest.py b/acts/framework/acts/test_utils/tel/TelephonyBaseTest.py
index 0d634e8..81c1456 100644
--- a/acts/framework/acts/test_utils/tel/TelephonyBaseTest.py
+++ b/acts/framework/acts/test_utils/tel/TelephonyBaseTest.py
@@ -39,6 +39,7 @@
from acts.test_utils.tel.tel_test_utils import is_sim_locked
from acts.test_utils.tel.tel_test_utils import ensure_phones_default_state
from acts.test_utils.tel.tel_test_utils import ensure_phones_idle
+from acts.test_utils.tel.tel_test_utils import find_qxdm_logger_mask
from acts.test_utils.tel.tel_test_utils import run_multithread_func
from acts.test_utils.tel.tel_test_utils import print_radio_info
from acts.test_utils.tel.tel_test_utils import refresh_droid_config
@@ -55,8 +56,6 @@
from acts.test_utils.tel.tel_defines import WIFI_VERBOSE_LOGGING_DISABLED
from acts.utils import force_airplane_mode
-QXDM_LOG_PATH = "/data/vendor/radio/diag_logs/logs"
-
class TelephonyBaseTest(BaseTestClass):
def __init__(self, controllers):
@@ -74,15 +73,14 @@
qxdm_log_mask = getattr(ad, "qxdm_log_mask", None)
if ad.qxdm_log:
if qxdm_log_mask_cfg:
- qxdm_log_path = getattr(ad, "qxdm_log_path", QXDM_LOG_PATH)
- qxdm_cfg_path = os.path.join(
- os.path.split(qxdm_log_path)[0], "cfg")
- ad.adb.shell("mkdir -p %s" % qxdm_cfg_path)
+ qxdm_mask_path = find_qxdm_logger_mask(ad, "default.cfg")
+ qxdm_mask_path = os.path.split(qxdm_mask_path)[0]
ad.log.info("Push %s to %s", qxdm_log_mask_cfg,
- qxdm_cfg_path)
- ad.adb.push("%s %s" % (qxdm_log_mask_cfg, qxdm_cfg_path))
+ qxdm_mask_path)
+ ad.adb.push("%s %s" % (qxdm_log_mask_cfg, qxdm_mask_path))
mask_file_name = os.path.split(qxdm_log_mask_cfg)[-1]
- qxdm_log_mask = os.path.join(qxdm_cfg_path, mask_file_name)
+ qxdm_log_mask = os.path.join(qxdm_mask_path,
+ mask_file_name)
set_qxdm_logger_command(ad, mask=qxdm_log_mask)
print_radio_info(ad)
if not unlock_sim(ad):
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 2050535..60c61da 100644
--- a/acts/framework/acts/test_utils/tel/tel_test_utils.py
+++ b/acts/framework/acts/test_utils/tel/tel_test_utils.py
@@ -270,7 +270,7 @@
sub_info["phone_num"] = phone_number
ad.phone_number = phone_number
else:
- if sub_info["phone_num"]:
+ if sub_info.get("phone_num"):
ad.phone_number = sub_info["phone_num"]
else:
phone_number = get_phone_number_by_secret_code(
@@ -284,10 +284,11 @@
" from device or testbed config or sim_file %s",
sim_filename, sub_id, iccid)
result = False
- if not hasattr(ad, 'roaming') and sub_info["sim_plmn"] != sub_info[
- "network_plmn"] and (
- sub_info["sim_operator_name"].strip() not in sub_info[
- "network_operator_name"].strip()):
+ if not hasattr(
+ ad, 'roaming'
+ ) and sub_info["sim_plmn"] != sub_info["network_plmn"] and (
+ sub_info["sim_operator_name"].strip() not in
+ sub_info["network_operator_name"].strip()):
ad.log.info("roaming is not enabled, enable it")
setattr(ad, 'roaming', True)
ad.log.info("SubId %s info: %s", sub_id, sorted(sub_info.items()))
@@ -2232,8 +2233,8 @@
check.
timeout: timeout for file download to complete.
"""
- file_folder, file_name = _generate_file_directory_and_file_name(url,
- out_path)
+ file_folder, file_name = _generate_file_directory_and_file_name(
+ url, out_path)
file_path = os.path.join(file_folder, file_name)
try:
ad.log.info("Download file from %s to %s by sl4a RPC call", url,
@@ -2298,8 +2299,7 @@
connection_type, connection_type_string_in_event, cur_type)
return False
- if 'isConnected' in _event['data'] and _event['data'][
- 'isConnected'] == target_state:
+ if 'isConnected' in _event['data'] and _event['data']['isConnected'] == target_state:
return True
return False
@@ -2326,8 +2326,8 @@
False if failed.
"""
sub_id = get_default_data_sub_id(ad)
- return wait_for_cell_data_connection_for_subscription(log, ad, sub_id,
- state, timeout_value)
+ return wait_for_cell_data_connection_for_subscription(
+ log, ad, sub_id, state, timeout_value)
def _is_data_connection_state_match(log, ad, expected_data_connection_state):
@@ -2692,8 +2692,8 @@
# TODO: b/26293960 No framework API available to set IMS by SubId.
if not ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform():
ad.log.info("VoLTE not supported by platform.")
- raise TelTestUtilsError("VoLTE not supported by platform %s." %
- ad.serial)
+ raise TelTestUtilsError(
+ "VoLTE not supported by platform %s." % ad.serial)
current_state = ad.droid.imsIsEnhanced4gLteModeSettingEnabledByUser()
if new_state is None:
new_state = not current_state
@@ -4199,8 +4199,7 @@
False if wifi is not connected to wifi_ssid
"""
wifi_info = ad.droid.wifiGetConnectionInfo()
- if wifi_info["supplicant_state"] == "completed" and wifi_info[
- "SSID"] == wifi_ssid:
+ if wifi_info["supplicant_state"] == "completed" and wifi_info["SSID"] == wifi_ssid:
ad.log.info("Wifi is connected to %s", wifi_ssid)
ad.on_mobile_data = False
return True
@@ -4692,8 +4691,8 @@
try:
return (
(network_callback_id == event['data'][NetworkCallbackContainer.ID])
- and (network_callback_event == event['data'][
- NetworkCallbackContainer.NETWORK_CALLBACK_EVENT]))
+ and (network_callback_event == event['data']
+ [NetworkCallbackContainer.NETWORK_CALLBACK_EVENT]))
except KeyError:
return False
@@ -4875,24 +4874,30 @@
def start_nexuslogger(ad):
- """Start Nexus Logger Apk."""
- if ad.is_apk_running("com.android.nexuslogger"):
+ """Start Nexus/Pixel Logger Apk."""
+ qxdm_logger_apk = None
+ for apk, activity in (("com.android.nexuslogger", ".MainActivity"), (
+ "com.android.pixellogger", ".ui.main.MainActivity")):
+ if ad.is_apk_installed(apk):
+ qxdm_logger_apk = apk
+ break
+ if not qxdm_logger_apk: return
+ if ad.is_apk_running(qxdm_logger_apk):
if "granted=true" in ad.adb.shell(
- "dumpsys package com.android.nexuslogger | grep WRITE_EXTERN"):
+ "dumpsys package %s | grep WRITE_EXTERN" % qxdm_logger_apk):
return True
else:
- ad.log.info("Kill NexusLogger")
- ad.force_stop_apk("com.android.nexuslogger")
+ ad.log.info("Kill %s" % qxdm_logger_apk)
+ ad.force_stop_apk(qxdm_logger_apk)
time.sleep(5)
- if ad.is_apk_installed("com.android.nexuslogger"):
- for perm in ("READ", "WRITE"):
- ad.adb.shell("pm grant com.android.nexuslogger "
- "android.permission.%s_EXTERNAL_STORAGE" % perm)
- time.sleep(2)
- ad.log.info("Start NexusLogger")
- ad.adb.shell("am start -n com.android.nexuslogger/.MainActivity")
- time.sleep(5)
- return ad.is_apk_running("com.android.nexuslogger")
+ for perm in ("READ", "WRITE"):
+ ad.adb.shell("pm grant %s android.permission.%s_EXTERNAL_STORAGE" %
+ (qxdm_logger_apk, perm))
+ time.sleep(2)
+ ad.log.info("Start %s" % qxdm_logger_apk)
+ ad.adb.shell("am start -n %s/%s" % (qxdm_logger_apk, activity))
+ time.sleep(5)
+ return ad.is_apk_running(qxdm_logger_apk)
def check_qxdm_logger_mask(ad, mask_file="QC_Default.cfg"):