summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--radio/1.4/vts/functional/radio_hidl_hal_api.cpp113
-rw-r--r--radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h4
-rw-r--r--radio/1.4/vts/functional/radio_response.cpp12
3 files changed, 126 insertions, 3 deletions
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
index 15a8acc613..4f347cd53f 100644
--- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
@@ -563,3 +563,116 @@ TEST_F(RadioHidlTest_v1_4, setupDataCall_1_4) {
RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
}
}
+
+/*
+ * Test IRadio.getAllowedCarriers_1_4() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, getAllowedCarriers_1_4) {
+ serial = GetRandomSerialNumber();
+
+ radio_v1_4->getAllowedCarriers_1_4(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/**
+ * Test IRadio.setAllowedCarriers_1_4() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, setAllowedCarriers_1_4) {
+ serial = GetRandomSerialNumber();
+ CarrierRestrictionsWithPriority carrierRestrictions;
+ memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
+ carrierRestrictions.allowedCarriers.resize(1);
+ carrierRestrictions.excludedCarriers.resize(0);
+ carrierRestrictions.allowedCarriers[0].mcc = hidl_string("123");
+ carrierRestrictions.allowedCarriers[0].mnc = hidl_string("456");
+ carrierRestrictions.allowedCarriers[0].matchType = CarrierMatchType::ALL;
+ carrierRestrictions.allowedCarriers[0].matchData = hidl_string();
+ carrierRestrictions.allowedCarriersPrioritized = true;
+ SimLockMultiSimPolicy multisimPolicy = SimLockMultiSimPolicy::NO_MULTISIM_POLICY;
+
+ radio_v1_4->setAllowedCarriers_1_4(serial, carrierRestrictions, multisimPolicy);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+
+ if (radioRsp_v1_4->rspInfo.error == RadioError::NONE) {
+ /* Verify the update of the SIM status. This might need some time */
+ if (cardStatus.base.base.cardState != CardState::ABSENT) {
+ updateSimCardStatus();
+ auto startTime = std::chrono::system_clock::now();
+ while (cardStatus.base.base.cardState != CardState::RESTRICTED &&
+ std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
+ startTime)
+ .count() < 10) {
+ /* Set 2 seconds as interval to check card status */
+ sleep(2);
+ updateSimCardStatus();
+ }
+ EXPECT_EQ(CardState::RESTRICTED, cardStatus.base.base.cardState);
+ }
+
+ /* Verify that configuration was set correctly, retrieving it from the modem */
+ serial = GetRandomSerialNumber();
+
+ radio_v1_4->getAllowedCarriers_1_4(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+
+ EXPECT_EQ(1, radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers.size());
+ EXPECT_EQ(0, radioRsp_v1_4->carrierRestrictionsResp.excludedCarriers.size());
+ ASSERT_TRUE(hidl_string("123") ==
+ radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers[0].mcc);
+ ASSERT_TRUE(hidl_string("456") ==
+ radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers[0].mnc);
+ EXPECT_EQ(CarrierMatchType::ALL,
+ radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers[0].matchType);
+ ASSERT_TRUE(radioRsp_v1_4->carrierRestrictionsResp.allowedCarriersPrioritized);
+ EXPECT_EQ(SimLockMultiSimPolicy::NO_MULTISIM_POLICY, radioRsp_v1_4->multiSimPolicyResp);
+
+ sleep(10);
+
+ /**
+ * Another test case of the API to cover to allow carrier.
+ * If the API is supported, this is also used to reset to no carrier restriction
+ * status for cardStatus.
+ */
+ memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
+ carrierRestrictions.allowedCarriers.resize(0);
+ carrierRestrictions.excludedCarriers.resize(0);
+ carrierRestrictions.allowedCarriersPrioritized = false;
+
+ serial = GetRandomSerialNumber();
+ radio_v1_4->setAllowedCarriers_1_4(serial, carrierRestrictions, multisimPolicy);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+
+ if (cardStatus.base.base.cardState != CardState::ABSENT) {
+ /* Resetting back to no carrier restriction needs some time */
+ updateSimCardStatus();
+ auto startTime = std::chrono::system_clock::now();
+ while (cardStatus.base.base.cardState == CardState::RESTRICTED &&
+ std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
+ startTime)
+ .count() < 10) {
+ /* Set 2 seconds as interval to check card status */
+ sleep(2);
+ updateSimCardStatus();
+ }
+ EXPECT_NE(CardState::RESTRICTED, cardStatus.base.base.cardState);
+ sleep(10);
+ }
+ }
+}
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h
index ed689c6367..de7742c7ce 100644
--- a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h
+++ b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h
@@ -67,6 +67,10 @@ class RadioResponse_v1_4 : public ::android::hardware::radio::V1_4::IRadioRespon
// Data
::android::hardware::radio::V1_4::DataRegStateResult dataRegResp;
+ // SimLock status
+ ::android::hardware::radio::V1_4::CarrierRestrictionsWithPriority carrierRestrictionsResp;
+ ::android::hardware::radio::V1_4::SimLockMultiSimPolicy multiSimPolicyResp;
+
RadioResponse_v1_4(RadioHidlTest_v1_4& parent_v1_4);
virtual ~RadioResponse_v1_4() = default;
diff --git a/radio/1.4/vts/functional/radio_response.cpp b/radio/1.4/vts/functional/radio_response.cpp
index 6e9cd434c2..e7842a9621 100644
--- a/radio/1.4/vts/functional/radio_response.cpp
+++ b/radio/1.4/vts/functional/radio_response.cpp
@@ -862,12 +862,18 @@ Return<void> RadioResponse_v1_4::setupDataCallResponse_1_4(
return Void();
}
-Return<void> RadioResponse_v1_4::setAllowedCarriersResponse_1_4(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_4::setAllowedCarriersResponse_1_4(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_4.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_4::getAllowedCarriersResponse_1_4(
- const RadioResponseInfo& /*info*/, const CarrierRestrictionsWithPriority& /*carriers*/,
- SimLockMultiSimPolicy /*multiSimPolicy*/) {
+ const RadioResponseInfo& info, const CarrierRestrictionsWithPriority& carriers,
+ SimLockMultiSimPolicy multiSimPolicy) {
+ rspInfo = info;
+ carrierRestrictionsResp = carriers;
+ multiSimPolicyResp = multiSimPolicy;
+ parent_v1_4.notify(info.serial);
return Void();
}