Skip slot 2 for other radio modules in single sim mode

Bug: 199986032
Test: atest
Change-Id: Idc115954c8ccb26a6127a80d466f22559be641d2
Merged-In: Idc115954c8ccb26a6127a80d466f22559be641d2
(cherry picked from commit c6a7143b1d)
(cherry picked from commit 07f1c21f4a)
This commit is contained in:
Shuo Qian 2021-09-30 14:31:00 -07:00
parent 67103c0820
commit 5779890fd8
10 changed files with 198 additions and 13 deletions

View file

@ -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());

View file

@ -41,6 +41,15 @@ using ::android::sp;
#define TIMEOUT_PERIOD 75
#define RADIO_SERVICE_NAME "slot1"
// 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;

View file

@ -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());

View file

@ -49,7 +49,15 @@ using ::android::hardware::radio::V1_0::RadioResponseInfo;
using ::android::hardware::radio::V1_0::RadioResponseType;
#define TIMEOUT_PERIOD 75
#define RADIO_SERVICE_NAME "slot1"
// 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;

View file

@ -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());

View file

@ -41,7 +41,15 @@ using ::android::hardware::Return;
using ::android::hardware::Void;
#define TIMEOUT_PERIOD 75
#define RADIO_SERVICE_NAME "slot1"
// 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_3;
extern ::android::hardware::radio::V1_2::CardStatus cardStatus;

View file

@ -16,12 +16,41 @@
#include <radio_hidl_hal_utils_v1_4.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_4::SetUp() {
radio_v1_4 = ::android::hardware::radio::V1_4::IRadio::getService(GetParam());
hidl_string serviceName = GetParam();
if (!isServiceValidForDeviceConfiguration(serviceName)) {
ALOGI("Skipped the test due to device configuration.");
GTEST_SKIP();
}
radio_v1_4 = ::android::hardware::radio::V1_4::IRadio::getService(serviceName);
if (radio_v1_4 == NULL) {
sleep(60);
radio_v1_4 = ::android::hardware::radio::V1_4::IRadio::getService(GetParam());
radio_v1_4 = ::android::hardware::radio::V1_4::IRadio::getService(serviceName);
}
ASSERT_NE(nullptr, radio_v1_4.get());

View file

@ -47,7 +47,14 @@ using ::android::hardware::Void;
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
#define RADIO_SERVICE_NAME "slot1"
// 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_4;
extern ::android::hardware::radio::V1_4::CardStatus cardStatus;

View file

@ -16,8 +16,38 @@
#include <radio_hidl_hal_utils_v1_5.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_5::SetUp() {
radio_v1_5 = android::hardware::radio::V1_5::IRadio::getService(GetParam());
hidl_string serviceName = GetParam();
if (!isServiceValidForDeviceConfiguration(serviceName)) {
ALOGI("Skipped the test due to device configuration.");
GTEST_SKIP();
}
radio_v1_5 = android::hardware::radio::V1_5::IRadio::getService(serviceName);
ASSERT_NE(nullptr, radio_v1_5.get());
radioRsp_v1_5 = new (std::nothrow) RadioResponse_v1_5(*this);

View file

@ -52,7 +52,14 @@ using ::android::hardware::Void;
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
#define RADIO_SERVICE_NAME "slot1"
// 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_5;
extern ::android::hardware::radio::V1_5::CardStatus cardStatus;