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

Commit a247d9f8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topics "presubmit-am-076a0ae4a9ac43fb986ada680ae53e89",...

Merge changes from topics "presubmit-am-076a0ae4a9ac43fb986ada680ae53e89", "presubmit-am-fc86299402a24233b0eba91a20955958" into tm-dev

* changes:
  wait for response before running next TC
  set SIM slots mapping based on current mapping
parents ba2190a5 4370ecf4
Loading
Loading
Loading
Loading
+55 −24
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ TEST_P(RadioConfigTest, getHalDeviceCapabilities) {
    serial = GetRandomSerialNumber();
    ndk::ScopedAStatus res = radio_config->getHalDeviceCapabilities(serial);
    ASSERT_OK(res);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n",
          toString(radioRsp_config->rspInfo.error).c_str());
}
@@ -70,6 +71,7 @@ TEST_P(RadioConfigTest, getSimSlotsStatus) {
    serial = GetRandomSerialNumber();
    ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial);
    ASSERT_OK(res);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    ALOGI("getSimSlotsStatus, rspInfo.error = %s\n",
          toString(radioRsp_config->rspInfo.error).c_str());
}
@@ -166,20 +168,48 @@ TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) {
 * Test IRadioConfig.setSimSlotsMapping() for the response returned.
 */
TEST_P(RadioConfigTest, setSimSlotsMapping) {
    serial = GetRandomSerialNumber();
    // get slot status and set SIM slots mapping based on the result.
    updateSimSlotStatus();
    if (radioRsp_config->rspInfo.error == RadioError::NONE) {
        SlotPortMapping slotPortMapping;
    slotPortMapping.physicalSlotId = 0;
    slotPortMapping.portId = 0;
        // put invalid value at first and adjust by slotStatusResponse.
        slotPortMapping.physicalSlotId = -1;
        slotPortMapping.portId = -1;
        std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping};
        if (isDsDsEnabled()) {
        slotPortMapping.physicalSlotId = 1;
            slotPortMappingList.push_back(slotPortMapping);
        } else if (isTsTsEnabled()) {
        slotPortMapping.physicalSlotId = 1;
            slotPortMappingList.push_back(slotPortMapping);
        slotPortMapping.physicalSlotId = 2;
            slotPortMappingList.push_back(slotPortMapping);
        }
        for (size_t i = 0; i < radioRsp_config->simSlotStatus.size(); i++) {
            ASSERT_TRUE(radioRsp_config->simSlotStatus[i].portInfo.size() > 0);
            for (size_t j = 0; j < radioRsp_config->simSlotStatus[i].portInfo.size(); j++) {
                if (radioRsp_config->simSlotStatus[i].portInfo[j].portActive) {
                    int32_t logicalSlotId =
                            radioRsp_config->simSlotStatus[i].portInfo[j].logicalSlotId;
                    // logicalSlotId should be 0 or positive numbers if the port
                    // is active.
                    EXPECT_GE(logicalSlotId, 0);
                    // logicalSlotId should be less than the maximum number of
                    // supported SIM slots.
                    EXPECT_LT(logicalSlotId, slotPortMappingList.size());
                    if (logicalSlotId >= 0 && logicalSlotId < slotPortMappingList.size()) {
                        slotPortMappingList[logicalSlotId].physicalSlotId = i;
                        slotPortMappingList[logicalSlotId].portId = j;
                    }
                }
            }
        }

        // set SIM slots mapping
        for (size_t i = 0; i < slotPortMappingList.size(); i++) {
            // physicalSlotId and portId should be 0 or positive numbers for the
            // input of setSimSlotsMapping.
            EXPECT_GE(slotPortMappingList[i].physicalSlotId, 0);
            EXPECT_GE(slotPortMappingList[i].portId, 0);
        }
        serial = GetRandomSerialNumber();
        ndk::ScopedAStatus res = radio_config->setSimSlotsMapping(serial, slotPortMappingList);
        ASSERT_OK(res);
        EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -192,6 +222,7 @@ TEST_P(RadioConfigTest, setSimSlotsMapping) {
        // Give some time for modem to fully switch SIM configuration
        sleep(MODEM_SET_SIM_SLOT_MAPPING_DELAY_IN_SECONDS);
    }
}

/*
 * Test IRadioConfig.getSimSlotStatus() for the response returned.