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

Commit ff582423 authored by Shuo Qian's avatar Shuo Qian Committed by Automerger Merge Worker
Browse files

Skip slot 2 for other radio modules in single sim mode am: 07f1c21f

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

Change-Id: Ic0dd661931458dcc598886b417e74a5f04bae9d1
parents 29a7e8c9 07f1c21f
Loading
Loading
Loading
Loading
+31 −2
Original line number Diff line number Diff line
@@ -16,11 +16,40 @@

#include <radio_hidl_hal_utils_v1_1.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_1::SetUp() {
    radio_v1_1 = ::android::hardware::radio::V1_1::IRadio::getService(GetParam());
    hidl_string serviceName = GetParam();
    if (!isServiceValidForDeviceConfiguration(serviceName)) {
        ALOGI("Skipped the test due to device configuration.");
        GTEST_SKIP();
    }
    radio_v1_1 = ::android::hardware::radio::V1_1::IRadio::getService(serviceName);
    if (radio_v1_1 == NULL) {
        sleep(60);
        radio_v1_1 = ::android::hardware::radio::V1_1::IRadio::getService(GetParam());
        radio_v1_1 = ::android::hardware::radio::V1_1::IRadio::getService(serviceName);
    }
    ASSERT_NE(nullptr, radio_v1_1.get());

+9 −0
Original line number Diff line number Diff line
@@ -43,6 +43,15 @@ using ::android::sp;
#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(__ver__) \
    SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, radio_v1_1, radioRsp_v1_1)

// 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_v1_1;
extern CardStatus cardStatus;

+31 −2
Original line number Diff line number Diff line
@@ -16,11 +16,40 @@

#include <radio_hidl_hal_utils_v1_2.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_2::SetUp() {
    radio_v1_2 = ::android::hardware::radio::V1_2::IRadio::getService(GetParam());
    hidl_string serviceName = GetParam();
    if (!isServiceValidForDeviceConfiguration(serviceName)) {
        ALOGI("Skipped the test due to device configuration.");
        GTEST_SKIP();
    }
    radio_v1_2 = ::android::hardware::radio::V1_2::IRadio::getService(serviceName);
    if (radio_v1_2 == NULL) {
        sleep(60);
        radio_v1_2 = ::android::hardware::radio::V1_2::IRadio::getService(GetParam());
        radio_v1_2 = ::android::hardware::radio::V1_2::IRadio::getService(serviceName);
    }
    ASSERT_NE(nullptr, radio_v1_2.get());

+9 −1
Original line number Diff line number Diff line
@@ -49,10 +49,18 @@ using ::android::hardware::radio::V1_0::RadioResponseInfo;
using ::android::hardware::radio::V1_0::RadioResponseType;

#define TIMEOUT_PERIOD 75
#define RADIO_SERVICE_NAME "slot1"
#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(__ver__) \
    SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, radio_v1_2, radioRsp_v1_2)

// 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_v1_2;
extern ::android::hardware::radio::V1_2::CardStatus cardStatus;

+31 −2
Original line number Diff line number Diff line
@@ -16,11 +16,40 @@

#include <radio_hidl_hal_utils_v1_3.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_3::SetUp() {
    radio_v1_3 = ::android::hardware::radio::V1_3::IRadio::getService(GetParam());
    hidl_string serviceName = GetParam();
    if (!isServiceValidForDeviceConfiguration(serviceName)) {
        ALOGI("Skipped the test due to device configuration.");
        GTEST_SKIP();
    }
    radio_v1_3 = ::android::hardware::radio::V1_3::IRadio::getService(serviceName);
    if (radio_v1_3 == NULL) {
        sleep(60);
        radio_v1_3 = ::android::hardware::radio::V1_3::IRadio::getService(GetParam());
        radio_v1_3 = ::android::hardware::radio::V1_3::IRadio::getService(serviceName);
    }
    ASSERT_NE(nullptr, radio_v1_3.get());

Loading