Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efb934b1 authored by Jack Yu's avatar Jack Yu
Browse files

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
Change-Id: Ib634b22dd75f10e5059c9482764ca481184162be
parent 952cbec1
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -83,6 +83,13 @@ bool deviceSupportsFeature(const char* feature) {
    return hasFeature;
    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() {
bool isDsDsEnabled() {
    return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsds");
    return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsds");
}
}
+7 −2
Original line number Original line Diff line number Diff line
@@ -80,12 +80,17 @@ int GetRandomSerialNumber();
bool deviceSupportsFeature(const char* feature);
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();
bool isDsDsEnabled();


/*
/*
 * Check if device is in TSTS.
 * Check if device is in TSTS (Triple SIM Triple Standby).
 */
 */
bool isTsTsEnabled();
bool isTsTsEnabled();


+32 −1
Original line number Original line Diff line number Diff line
@@ -16,8 +16,39 @@


#include <radio_hidl_hal_utils_v1_6.h>
#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() {
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());
    ASSERT_NE(nullptr, radio_v1_6.get());


    radioRsp_v1_6 = new (std::nothrow) RadioResponse_v1_6(*this);
    radioRsp_v1_6 = new (std::nothrow) RadioResponse_v1_6(*this);
+3 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,9 @@ using ::android::hardware::Void;
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_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;
class RadioHidlTest_v1_6;
extern ::android::hardware::radio::V1_5::CardStatus cardStatus;
extern ::android::hardware::radio::V1_5::CardStatus cardStatus;