Skip tests for single SIM devices

When device is configured as single SIM device, skip
VTS on 2nd vendor radio service instance.

Fix: 187998097
Test: atest VtsHalRadioV1_6TargetTest
Merged-In: Ib634b22dd75f10e5059c9482764ca481184162be
Change-Id: Ib634b22dd75f10e5059c9482764ca481184162be
(cherry picked from commit efb934b15a)
This commit is contained in:
Jack Yu
2021-05-12 18:31:55 -07:00
parent 36b3af727d
commit ef0d87afcb
4 changed files with 49 additions and 4 deletions

View File

@@ -83,6 +83,13 @@ bool deviceSupportsFeature(const char* feature) {
return hasFeature;
}
bool isSsSsEnabled() {
// Do not use checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "")
// until b/148904287 is fixed. We need exact matching instead of partial matching. (i.e.
// by definition the empty string "" is a substring of any string).
return !isDsDsEnabled() && !isTsTsEnabled();
}
bool isDsDsEnabled() {
return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsds");
}

View File

@@ -80,12 +80,17 @@ int GetRandomSerialNumber();
bool deviceSupportsFeature(const char* feature);
/*
* Check if device is in DSDS.
* Check if device is in SsSs (Single SIM Single Standby).
*/
bool isSsSsEnabled();
/*
* Check if device is in DSDS (Dual SIM Dual Standby).
*/
bool isDsDsEnabled();
/*
* Check if device is in TSTS.
* Check if device is in TSTS (Triple SIM Triple Standby).
*/
bool isTsTsEnabled();

View File

@@ -16,8 +16,39 @@
#include <radio_hidl_hal_utils_v1_6.h>
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_v1_6::SetUp() {
radio_v1_6 = android::hardware::radio::V1_6::IRadio::getService(GetParam());
hidl_string serviceName = GetParam();
if (!isServiceValidForDeviceConfiguration(serviceName)) {
ALOGI("Skipped the test due to device configuration.");
GTEST_SKIP();
}
radio_v1_6 = android::hardware::radio::V1_6::IRadio::getService(serviceName);
ASSERT_NE(nullptr, radio_v1_6.get());
radioRsp_v1_6 = new (std::nothrow) RadioResponse_v1_6(*this);

View File

@@ -48,7 +48,9 @@ using ::android::hardware::Void;
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
#define RADIO_SERVICE_NAME "slot1"
#define RADIO_SERVICE_SLOT1_NAME "slot1" // HAL instance name for SIM slot 1 or single SIM device
#define RADIO_SERVICE_SLOT2_NAME "slot2" // HAL instance name for SIM slot 2 on dual SIM device
#define RADIO_SERVICE_SLOT3_NAME "slot3" // HAL instance name for SIM slot 3 on triple SIM device
class RadioHidlTest_v1_6;
extern ::android::hardware::radio::V1_5::CardStatus cardStatus;