mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge changes I45e60f32,I2c8d3a16
* changes: wait for response before running next TC set SIM slots mapping based on current mapping
This commit is contained in:
@@ -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,31 +168,60 @@ TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) {
|
||||
* Test IRadioConfig.setSimSlotsMapping() for the response returned.
|
||||
*/
|
||||
TEST_P(RadioConfigTest, setSimSlotsMapping) {
|
||||
serial = GetRandomSerialNumber();
|
||||
SlotPortMapping slotPortMapping;
|
||||
slotPortMapping.physicalSlotId = 0;
|
||||
slotPortMapping.portId = 0;
|
||||
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);
|
||||
}
|
||||
ndk::ScopedAStatus res = radio_config->setSimSlotsMapping(serial, slotPortMappingList);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
|
||||
ALOGI("setSimSlotsMapping, rspInfo.error = %s\n",
|
||||
toString(radioRsp_config->rspInfo.error).c_str());
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error, {RadioError::NONE}));
|
||||
// get slot status and set SIM slots mapping based on the result.
|
||||
updateSimSlotStatus();
|
||||
if (radioRsp_config->rspInfo.error == RadioError::NONE) {
|
||||
SlotPortMapping slotPortMapping;
|
||||
// put invalid value at first and adjust by slotStatusResponse.
|
||||
slotPortMapping.physicalSlotId = -1;
|
||||
slotPortMapping.portId = -1;
|
||||
std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping};
|
||||
if (isDsDsEnabled()) {
|
||||
slotPortMappingList.push_back(slotPortMapping);
|
||||
} else if (isTsTsEnabled()) {
|
||||
slotPortMappingList.push_back(slotPortMapping);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Give some time for modem to fully switch SIM configuration
|
||||
sleep(MODEM_SET_SIM_SLOT_MAPPING_DELAY_IN_SECONDS);
|
||||
// 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());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
|
||||
ALOGI("setSimSlotsMapping, rspInfo.error = %s\n",
|
||||
toString(radioRsp_config->rspInfo.error).c_str());
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error, {RadioError::NONE}));
|
||||
|
||||
// Give some time for modem to fully switch SIM configuration
|
||||
sleep(MODEM_SET_SIM_SLOT_MAPPING_DELAY_IN_SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user