Sim Status Present VTS
Fix and enhance sim-present tests,
Save VTS running time,
Fix serial number inconsistancy issue
Fix and enhance sim-present tests:
In 1.0:
- setupDataCall timeout, need more waiting time
- requestIccSimAuthentication returns REQUEST_NOT_SUPPORTED,
need to check it
- sendSms timeout, would need more waiting time
- sendSMSExpectMore timeout, would need more waiting time
- getAllowedCarriers, getting CardState::RESTRICTED, the previous test
of setAllowedCarriers is doing resetting back to no carrier restriction,
but that needs some time to populate.
In 1.1:
- setSimCardPower_1_1 set sim card power down that makes other tests
fail, reset it back with sim card power on.
Save VTS running time,
- Use waiting loop and prevent unnecessary waiting to save the whole
running time.
Fix serial number inconsistancy issue
- During the enforcement running, it is liked the serial number is
not consistent. And it happens in b/78249227. Suspect that when sim
card is inserted, during the testing running time, the radio may
request some response that is not triggered from the test, but the
test may receive it and think it is what is triggered by the test. The
fix is to check serial number before notifying of unlock the test
lock.
Bug: 76125134
Bug: 78248071
Bug: 78139665
Bug: 78249227
Test: run vts -m VtsHalRadioV1_0Target; run vts -m VtsHalRadioV1_1Target
Change-Id: I08fe9d7ac16283c7ce1a5aeb6b3b372786a8d5c3
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
index 0febd38..9284fd8 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
@@ -23,7 +23,7 @@
* Test IRadio.startNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -51,7 +51,7 @@
* Test IRadio.startNetworkScan() with invalid specifier.
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
::android::hardware::radio::V1_2::NetworkScanRequest request = {.type = ScanType::ONE_SHOT,
.interval = 60};
@@ -77,7 +77,7 @@
* Test IRadio.startNetworkScan() with invalid interval (lower boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -113,7 +113,7 @@
* Test IRadio.startNetworkScan() with invalid interval (upper boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -149,7 +149,7 @@
* Test IRadio.startNetworkScan() with invalid max search time (lower boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -185,7 +185,7 @@
* Test IRadio.startNetworkScan() with invalid max search time (upper boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -221,7 +221,7 @@
* Test IRadio.startNetworkScan() with invalid periodicity (lower boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -257,7 +257,7 @@
* Test IRadio.startNetworkScan() with invalid periodicity (upper boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -293,7 +293,7 @@
* Test IRadio.startNetworkScan() with valid periodicity
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -328,7 +328,7 @@
* Test IRadio.startNetworkScan() with valid periodicity and plmns
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -364,7 +364,7 @@
* Test IRadio.setIndicationFilter_1_2()
*/
TEST_F(RadioHidlTest_v1_2, setIndicationFilter_1_2) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setIndicationFilter_1_2(
serial, static_cast<int>(::android::hardware::radio::V1_2::IndicationFilter::ALL));
@@ -382,7 +382,7 @@
* Test IRadio.setSignalStrengthReportingCriteria() with invalid hysteresisDb
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_invalidHysteresisDb) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000,
@@ -402,7 +402,7 @@
* Test IRadio.setSignalStrengthReportingCriteria() with empty parameters
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_EmptyParams) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 0, 0, {}, ::android::hardware::radio::V1_2::AccessNetwork::GERAN);
@@ -420,7 +420,7 @@
* Test IRadio.setSignalStrengthReportingCriteria() for GERAN
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Geran) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-109, -103, -97, -89},
@@ -439,7 +439,7 @@
* Test IRadio.setSignalStrengthReportingCriteria() for UTRAN
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Utran) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-110, -97, -73, -49, -25},
@@ -458,7 +458,7 @@
* Test IRadio.setSignalStrengthReportingCriteria() for EUTRAN
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Eutran) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-140, -128, -118, -108, -98, -44},
@@ -477,7 +477,7 @@
* Test IRadio.setSignalStrengthReportingCriteria() for CDMA2000
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Cdma2000) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-105, -90, -75, -65},
@@ -496,7 +496,7 @@
* Test IRadio.setLinkCapacityReportingCriteria() invalid hysteresisDlKbps
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlKbps) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 5000,
@@ -517,7 +517,7 @@
* Test IRadio.setLinkCapacityReportingCriteria() invalid hysteresisUlKbps
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlKbps) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 5000, 500,
@@ -538,7 +538,7 @@
* Test IRadio.setLinkCapacityReportingCriteria() empty params
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 0, 0, 0, {}, {}, ::android::hardware::radio::V1_2::AccessNetwork::GERAN);
@@ -556,7 +556,7 @@
* Test IRadio.setLinkCapacityReportingCriteria() GERAN
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 5000, 500, 100, {1000, 5000, 10000, 20000}, {500, 1000, 5000, 10000},
@@ -575,7 +575,7 @@
* Test IRadio.setupDataCall_1_2() for the response returned.
*/
TEST_F(RadioHidlTest_v1_2, setupDataCall_1_2) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
::android::hardware::radio::V1_2::AccessNetwork accessNetwork =
::android::hardware::radio::V1_2::AccessNetwork::EUTRAN;
@@ -635,7 +635,7 @@
* Test IRadio.deactivateDataCall_1_2() for the response returned.
*/
TEST_F(RadioHidlTest_v1_2, deactivateDataCall_1_2) {
- const int serial = GetRandomSerialNumber();
+ serial = GetRandomSerialNumber();
int cid = 1;
::android::hardware::radio::V1_2::DataRequestReason reason =
::android::hardware::radio::V1_2::DataRequestReason::NORMAL;
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
index edac1aa..b34f138 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
@@ -42,21 +42,24 @@
radio_v1_2->setResponseFunctions(radioRsp_v1_2, radioInd_v1_2);
- int serial = GetRandomSerialNumber();
- radio_v1_2->getIccCardStatus(serial);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
+ updateSimCardStatus();
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_v1_2->rspInfo.error);
+
+ /* Enforce Vts Testing with Sim Status Present only. */
+ EXPECT_EQ(CardState::PRESENT, cardStatus.base.cardState);
}
/*
* Notify that the response message is received.
*/
-void RadioHidlTest_v1_2::notify() {
+void RadioHidlTest_v1_2::notify(int receivedSerial) {
std::unique_lock<std::mutex> lock(mtx_);
- count_++;
- cv_.notify_one();
+ if (serial == receivedSerial) {
+ count_++;
+ cv_.notify_one();
+ }
}
/*
@@ -75,4 +78,10 @@
}
count_--;
return status;
+}
+
+void RadioHidlTest_v1_2::updateSimCardStatus() {
+ serial = GetRandomSerialNumber();
+ radio_v1_2->getIccCardStatus(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
}
\ No newline at end of file
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
index 2d0ea29..4712202 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
+++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
@@ -613,11 +613,17 @@
std::condition_variable cv_;
int count_;
+ /* Serial number for radio request */
+ int serial;
+
+ /* Update Sim Card Status */
+ void updateSimCardStatus();
+
public:
virtual void SetUp() override;
/* Used as a mechanism to inform the test about data/event callback */
- void notify();
+ void notify(int receivedSerial);
/* Test code calls this function to wait for response */
std::cv_status wait();
diff --git a/radio/1.2/vts/functional/radio_response.cpp b/radio/1.2/vts/functional/radio_response.cpp
index 85ec3e0..f6bead2 100644
--- a/radio/1.2/vts/functional/radio_response.cpp
+++ b/radio/1.2/vts/functional/radio_response.cpp
@@ -155,7 +155,7 @@
Return<void> RadioResponse_v1_2::setupDataCallResponse(const RadioResponseInfo& info,
const SetupDataCallResult& /*dcResponse*/) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -211,7 +211,7 @@
Return<void> RadioResponse_v1_2::deactivateDataCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -320,7 +320,7 @@
const RadioResponseInfo& info, const ::android::hardware::hidl_vec<RadioBandMode>& bandModes) {
rspInfo = info;
radioBandModes = bandModes;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -677,13 +677,13 @@
Return<void> RadioResponse_v1_2::startNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_2::stopNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -700,14 +700,14 @@
Return<void> RadioResponse_v1_2::setSignalStrengthReportingCriteriaResponse(
const RadioResponseInfo& info) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_2::setLinkCapacityReportingCriteriaResponse(
const RadioResponseInfo& info) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -716,7 +716,7 @@
const ::android::hardware::radio::V1_2::CardStatus& card_status) {
rspInfo = info;
cardStatus = card_status;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -724,7 +724,7 @@
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& /*calls*/) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -732,7 +732,7 @@
const RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::SignalStrength& /*sig_strength*/) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}
@@ -740,7 +740,7 @@
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>& /*cellInfo*/) {
rspInfo = info;
- parent_v1_2.notify();
+ parent_v1_2.notify(info.serial);
return Void();
}