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

Commit a16e677d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Run SAP tests on slots based on configs" am: ef8b4bee

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

Change-Id: Iee991178792841a72e3f48e68a1734d3181e8945
parents 930b7fa5 ef8b4bee
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -16,8 +16,37 @@

#include <sap_hidl_hal_utils.h>

bool isServiceValidForDeviceConfiguration(hidl_string& serviceName) {
    if (isSsSsEnabled()) {
        // Device is configured as SSSS.
        if (serviceName != SAP_SERVICE_SLOT1_NAME) {
            LOG(DEBUG) << "Not valid for SSSS device.";
            return false;
        }
    } else if (isDsDsEnabled()) {
        // Device is configured as DSDS.
        if (serviceName != SAP_SERVICE_SLOT1_NAME && serviceName != SAP_SERVICE_SLOT2_NAME) {
            LOG(DEBUG) << "Not valid for DSDS device.";
            return false;
        }
    } else if (isTsTsEnabled()) {
        // Device is configured as TSTS.
        if (serviceName != SAP_SERVICE_SLOT1_NAME && serviceName != SAP_SERVICE_SLOT2_NAME &&
            serviceName != SAP_SERVICE_SLOT3_NAME) {
            LOG(DEBUG) << "Not valid for TSTS device.";
            return false;
        }
    }
    return true;
}

void SapHidlTest::SetUp() {
    sap = ISap::getService(GetParam());
    hidl_string serviceName = GetParam();
    if (!isServiceValidForDeviceConfiguration(serviceName)) {
        LOG(DEBUG) << "Skipped the test due to device configuration.";
        GTEST_SKIP();
    }
    sap = ISap::getService(serviceName);
    ASSERT_NE(sap, nullptr);

    sapCb = new SapCallback(*this);
+9 −1
Original line number Diff line number Diff line
@@ -36,7 +36,15 @@ using ::android::hardware::Void;
using ::android::sp;

#define TIMEOUT_PERIOD 40
#define SAP_SERVICE_NAME "slot1"

// HAL instance name for SIM slot 1 or single SIM device
#define SAP_SERVICE_SLOT1_NAME "slot1"

// HAL instance name for SIM slot 2 on dual SIM device
#define SAP_SERVICE_SLOT2_NAME "slot2"

// HAL instance name for SIM slot 3 on triple SIM device
#define SAP_SERVICE_SLOT3_NAME "slot3"

class SapHidlTest;