From 66df7fca4d10a9ba304f37cc37df4f509b16d52c Mon Sep 17 00:00:00 2001 From: Shuo Qian Date: Thu, 16 Sep 2021 16:40:26 -0700 Subject: [PATCH] Skip Slot 2 in Radio VTS 1.0 in single sim mode Test: atest VtsHalRadioV1_0TargetTest Bug: 199986032 Change-Id: If296df349aa7f87932f5bb24896f0a3fdd347f5d Merged-In: If296df349aa7f87932f5bb24896f0a3fdd347f5d --- .../vts/functional/radio_hidl_hal_test.cpp | 34 +++++++++++++++++-- .../functional/radio_hidl_hal_utils_v1_0.h | 10 ++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp index 3583514014..fee5ff3437 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp @@ -17,12 +17,42 @@ #include #include +bool isServiceValidForDeviceConfiguration(hidl_string& serviceName) { + if (isSsSsEnabled()) { + // Device is configured as SSSS. + if (serviceName != RADIO_SERVICE_SLOT1_NAME) { + ALOGI("%s instance is not valid for SSSS device.", serviceName.c_str()); + return false; + } + } else if (isDsDsEnabled()) { + // Device is configured as DSDS. + if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME) { + ALOGI("%s instance is not valid for DSDS device.", serviceName.c_str()); + return false; + } + } else if (isTsTsEnabled()) { + // Device is configured as TSTS. + if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME && + serviceName != RADIO_SERVICE_SLOT3_NAME) { + ALOGI("%s instance is not valid for TSTS device.", serviceName.c_str()); + return false; + } + } + return true; +} + void RadioHidlTest::SetUp() { - radio = IRadio::getService(GetParam()); + hidl_string serviceName = GetParam(); + if (!isServiceValidForDeviceConfiguration(serviceName)) { + ALOGI("Skipped the test due to device configuration."); + GTEST_SKIP(); + } + + radio = IRadio::getService(serviceName); if (radio == NULL) { LOG(DEBUG) << "Radio is NULL, waiting 1 minute to retry"; sleep(60); - radio = IRadio::getService(GetParam()); + radio = IRadio::getService(serviceName); } ASSERT_NE(nullptr, radio.get()); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h index 8a551f7c36..447b036d9c 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h +++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -39,6 +40,15 @@ using ::android::sp; #define TIMEOUT_PERIOD 75 #define RADIO_SERVICE_NAME "slot1" +// HAL instance name for SIM slot 1 or single SIM device +#define RADIO_SERVICE_SLOT1_NAME "slot1" + +// HAL instance name for SIM slot 2 on dual SIM device +#define RADIO_SERVICE_SLOT2_NAME "slot2" + +// HAL instance name for SIM slot 3 on triple SIM device +#define RADIO_SERVICE_SLOT3_NAME "slot3" + class RadioHidlTest; extern CardStatus cardStatus;