diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-05-16 02:49:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-05-16 02:49:01 +0000 |
commit | 82dc3faca00d9087b1f3c6de3eb1e88c7f05eeda (patch) | |
tree | f71fafd40c8b196082b1f5c33ae22e362c7b0f51 /radio | |
parent | 728455da658b28733d9446d92e284555b1ef62e6 (diff) | |
parent | 8a9e5a645b3da0092e7380482e7a3c3838a82e08 (diff) | |
download | android_hardware_interfaces-82dc3faca00d9087b1f3c6de3eb1e88c7f05eeda.tar.gz android_hardware_interfaces-82dc3faca00d9087b1f3c6de3eb1e88c7f05eeda.tar.bz2 android_hardware_interfaces-82dc3faca00d9087b1f3c6de3eb1e88c7f05eeda.zip |
Merge "Add mnc and mcc string check" into qt-dev
Diffstat (limited to 'radio')
-rw-r--r-- | radio/1.2/vts/functional/radio_hidl_hal_api.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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 c14720c45..a3073acca 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -723,6 +723,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { // Check the mcc [0, 999] and mnc [0, 999]. string hidl_mcc; string hidl_mnc; + bool checkMccMnc = true; int totalIdentitySizeExpected = 1; ::android::hardware::radio::V1_2::CellIdentity cellIdentities = radioRsp_v1_2->dataRegResp.cellIdentity; @@ -731,6 +732,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { if (cellInfoType == CellInfoType::NONE) { // All the fields are 0 totalIdentitySizeExpected = 0; + checkMccMnc = false; } else if (cellInfoType == CellInfoType::GSM) { EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size()); ::android::hardware::radio::V1_2::CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0]; @@ -757,6 +759,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { // 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. @@ -765,10 +768,13 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { cellIdentities.cellIdentityLte.size() + cellIdentities.cellIdentityWcdma.size() + cellIdentities.cellIdentityTdscdma.size()); - int mcc = stoi(hidl_mcc); - int mnc = stoi(hidl_mnc); - EXPECT_TRUE(mcc >= 0 && mcc <= 999); - EXPECT_TRUE(mnc >= 0 && mnc <= 999); + // 32 bit system might return invalid mcc and mnc hidl string "\xff\xff..." + if (checkMccMnc && 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); + } } /* |