Correct the comments for radio hal types
The type of mcc and mnc is String instead of Int now. They should be an
empty string if unknown. Also added a test case for their values.
Bug: 111703979
Test: Vts
Change-Id: Ie0426453dc426ccc6cf203b315806e78511ce14d
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 4f10f11..eaef3ed 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -32,6 +32,67 @@
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ } else if (cardStatus.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::NOT_PROVISIONED, RadioError::CANCELLED}));
+
+ // Check the mcc [0, 999] and mnc [0, 999].
+ string hidl_mcc;
+ string hidl_mnc;
+ bool checkMccMnc = true;
+ int totalIdentitySizeExpected = 1;
+ CellIdentity cellIdentities = radioRsp->dataRegResp.cellIdentity;
+ CellInfoType cellInfoType = cellIdentities.cellInfoType;
+
+ if (cellInfoType == CellInfoType::NONE) {
+ // All the fields are 0
+ totalIdentitySizeExpected = 0;
+ checkMccMnc = false;
+ } else if (cellInfoType == CellInfoType::GSM) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size());
+ CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0];
+ hidl_mcc = cig.mcc;
+ hidl_mnc = cig.mnc;
+ } else if (cellInfoType == CellInfoType::LTE) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityLte.size());
+ CellIdentityLte cil = cellIdentities.cellIdentityLte[0];
+ hidl_mcc = cil.mcc;
+ hidl_mnc = cil.mnc;
+ } else if (cellInfoType == CellInfoType::WCDMA) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityWcdma.size());
+ CellIdentityWcdma ciw = cellIdentities.cellIdentityWcdma[0];
+ hidl_mcc = ciw.mcc;
+ hidl_mnc = ciw.mnc;
+ } else if (cellInfoType == CellInfoType::TD_SCDMA) {
+ EXPECT_EQ(1, cellIdentities.cellIdentityTdscdma.size());
+ CellIdentityTdscdma cit = cellIdentities.cellIdentityTdscdma[0];
+ hidl_mcc = cit.mcc;
+ hidl_mnc = cit.mnc;
+ } else {
+ // CellIndentityCdma has no mcc and mnc.
+ EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
+ EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
+ checkMccMnc = false;
+ }
+
+ // Check only one CellIdentity is size 1, and others must be 0.
+ EXPECT_EQ(totalIdentitySizeExpected, cellIdentities.cellIdentityGsm.size() +
+ cellIdentities.cellIdentityCdma.size() +
+ cellIdentities.cellIdentityLte.size() +
+ cellIdentities.cellIdentityWcdma.size() +
+ cellIdentities.cellIdentityTdscdma.size());
+
+ if (checkMccMnc) {
+ // 32 bit system gets result: "\xff\xff\xff..." from RIL, which is not testable. Only
+ // test for 64 bit here. TODO: remove this limit after b/113181277 being fixed.
+ if (hidl_mcc.size() < 4 && hidl_mnc.size() < 4) {
+ int mcc = stoi(hidl_mcc);
+ int mnc = stoi(hidl_mnc);
+ EXPECT_TRUE(mcc >= 0 && mcc <= 999);
+ EXPECT_TRUE(mnc >= 0 && mnc <= 999);
+ }
+ }
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
index f5ce072..23bc434 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
@@ -60,6 +60,9 @@
uint32_t writeSmsToSimIndex;
uint32_t writeSmsToRuimIndex;
+ // Data
+ DataRegStateResult dataRegResp;
+
RadioResponse(RadioHidlTest& parent);
virtual ~RadioResponse() = default;
diff --git a/radio/1.0/vts/functional/radio_response.cpp b/radio/1.0/vts/functional/radio_response.cpp
index 93d5557..f3938a9 100644
--- a/radio/1.0/vts/functional/radio_response.cpp
+++ b/radio/1.0/vts/functional/radio_response.cpp
@@ -157,8 +157,9 @@
}
Return<void> RadioResponse::getDataRegistrationStateResponse(
- const RadioResponseInfo& info, const DataRegStateResult& /*dataRegResponse*/) {
+ const RadioResponseInfo& info, const DataRegStateResult& dataRegResponse) {
rspInfo = info;
+ dataRegResp = dataRegResponse;
parent.notify(info.serial);
return Void();
}
diff --git a/radio/1.0/vts/functional/vts_test_util.cpp b/radio/1.0/vts/functional/vts_test_util.cpp
index 7d15f35..ec96e5f 100644
--- a/radio/1.0/vts/functional/vts_test_util.cpp
+++ b/radio/1.0/vts/functional/vts_test_util.cpp
@@ -53,4 +53,4 @@
}
}
return testing::AssertionFailure() << "SapError:" + toString(err) + " is returned";
-}
+}
\ No newline at end of file