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

Commit 582d3646 authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Merge "Skip tests for single SIM devices" am: cf76f68c

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1711732

Change-Id: I68b539d54d5e8b63776b3d4f126ae06869fbc528
parents 8d360f32 cf76f68c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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");
}
+7 −2
Original line number Diff line number Diff line
@@ -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();

+32 −1
Original line number Diff line number Diff line
@@ -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);
+3 −1
Original line number Diff line number Diff line
@@ -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;