summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--radio/1.0/vts/functional/Android.bp6
-rw-r--r--radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp15
-rw-r--r--radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp17
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp232
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_data.cpp309
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_icc.cpp409
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_ims.cpp212
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_misc.cpp861
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_sms.cpp619
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_stk.cpp163
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_test.cpp53
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_utils.h514
-rw-r--r--radio/1.0/vts/functional/radio_hidl_hal_voice.cpp636
-rw-r--r--radio/1.0/vts/functional/radio_response.cpp1151
-rw-r--r--radio/1.0/vts/functional/sap_callback.cpp96
-rw-r--r--radio/1.0/vts/functional/sap_hidl_hal_api.cpp117
-rw-r--r--radio/1.0/vts/functional/sap_hidl_hal_test.cpp43
-rw-r--r--radio/1.0/vts/functional/sap_hidl_hal_utils.h86
-rw-r--r--radio/1.0/vts/functional/vts_test_util.cpp22
-rw-r--r--radio/1.0/vts/functional/vts_test_util.h17
20 files changed, 2753 insertions, 2825 deletions
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index 7808de16..54039717 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -27,7 +27,8 @@ cc_test {
27 "radio_hidl_hal_test.cpp", 27 "radio_hidl_hal_test.cpp",
28 "radio_hidl_hal_voice.cpp", 28 "radio_hidl_hal_voice.cpp",
29 "radio_response.cpp", 29 "radio_response.cpp",
30 "VtsHalRadioV1_0TargetTest.cpp"], 30 "VtsHalRadioV1_0TargetTest.cpp",
31 "vts_test_util.cpp"],
31 shared_libs: [ 32 shared_libs: [
32 "libbase", 33 "libbase",
33 "liblog", 34 "liblog",
@@ -51,7 +52,8 @@ cc_test {
51 srcs: ["sap_callback.cpp", 52 srcs: ["sap_callback.cpp",
52 "sap_hidl_hal_api.cpp", 53 "sap_hidl_hal_api.cpp",
53 "sap_hidl_hal_test.cpp", 54 "sap_hidl_hal_test.cpp",
54 "VtsHalSapV1_0TargetTest.cpp"], 55 "VtsHalSapV1_0TargetTest.cpp",
56 "vts_test_util.cpp"],
55 shared_libs: [ 57 shared_libs: [
56 "libbase", 58 "libbase",
57 "liblog", 59 "liblog",
diff --git a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
index e7c89d5b..59881eff 100644
--- a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
+++ b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
@@ -17,11 +17,16 @@
17#include <radio_hidl_hal_utils.h> 17#include <radio_hidl_hal_utils.h>
18 18
19int main(int argc, char** argv) { 19int main(int argc, char** argv) {
20 ::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment); 20 ::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
21 ::testing::InitGoogleTest(&argc, argv); 21 ::testing::InitGoogleTest(&argc, argv);
22 22
23 int status = RUN_ALL_TESTS(); 23 // setup seed for rand function
24 LOG(INFO) << "Test result = " << status; 24 int seedSrand = time(NULL);
25 std::cout << "seed setup for random function (radio):" + std::to_string(seedSrand) << std::endl;
26 srand(seedSrand);
25 27
26 return status; 28 int status = RUN_ALL_TESTS();
29 LOG(INFO) << "Test result = " << status;
30
31 return status;
27} \ No newline at end of file 32} \ No newline at end of file
diff --git a/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
index 53060765..5e5c50c7 100644
--- a/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
+++ b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
@@ -17,12 +17,17 @@
17#include <sap_hidl_hal_utils.h> 17#include <sap_hidl_hal_utils.h>
18 18
19int main(int argc, char** argv) { 19int main(int argc, char** argv) {
20 // Add Sim-access Profile Hidl Environment 20 // Add Sim-access Profile Hidl Environment
21 ::testing::AddGlobalTestEnvironment(new SapHidlEnvironment); 21 ::testing::AddGlobalTestEnvironment(new SapHidlEnvironment);
22 ::testing::InitGoogleTest(&argc, argv); 22 ::testing::InitGoogleTest(&argc, argv);
23 23
24 int status = RUN_ALL_TESTS(); 24 // setup seed for rand function
25 LOG(INFO) << "Test result = " << status; 25 int seedSrand = time(NULL);
26 std::cout << "seed setup for random function (sap):" + std::to_string(seedSrand) << std::endl;
27 srand(seedSrand);
26 28
27 return status; 29 int status = RUN_ALL_TESTS();
30 LOG(INFO) << "Test result = " << status;
31
32 return status;
28} 33}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
index bbca9e40..3bf7c9d6 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
@@ -22,165 +22,163 @@ using namespace ::android::hardware::radio::V1_0;
22 * Test IRadio.setGsmBroadcastConfig() for the response returned. 22 * Test IRadio.setGsmBroadcastConfig() for the response returned.
23 */ 23 */
24TEST_F(RadioHidlTest, setGsmBroadcastConfig) { 24TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
25 int serial = 0; 25 int serial = GetRandomSerialNumber();
26 26
27 // Create GsmBroadcastSmsConfigInfo #1 27 // Create GsmBroadcastSmsConfigInfo #1
28 GsmBroadcastSmsConfigInfo gbSmsConfig1; 28 GsmBroadcastSmsConfigInfo gbSmsConfig1;
29 gbSmsConfig1.fromServiceId = 4352; 29 gbSmsConfig1.fromServiceId = 4352;
30 gbSmsConfig1.toServiceId = 4354; 30 gbSmsConfig1.toServiceId = 4354;
31 gbSmsConfig1.fromCodeScheme = 0; 31 gbSmsConfig1.fromCodeScheme = 0;
32 gbSmsConfig1.toCodeScheme = 255; 32 gbSmsConfig1.toCodeScheme = 255;
33 gbSmsConfig1.selected = true; 33 gbSmsConfig1.selected = true;
34 34
35 // Create GsmBroadcastSmsConfigInfo #2 35 // Create GsmBroadcastSmsConfigInfo #2
36 GsmBroadcastSmsConfigInfo gbSmsConfig2; 36 GsmBroadcastSmsConfigInfo gbSmsConfig2;
37 gbSmsConfig2.fromServiceId = 4356; 37 gbSmsConfig2.fromServiceId = 4356;
38 gbSmsConfig2.toServiceId = 4356; 38 gbSmsConfig2.toServiceId = 4356;
39 gbSmsConfig2.fromCodeScheme = 0; 39 gbSmsConfig2.fromCodeScheme = 0;
40 gbSmsConfig2.toCodeScheme = 255; 40 gbSmsConfig2.toCodeScheme = 255;
41 gbSmsConfig2.selected = true; 41 gbSmsConfig2.selected = true;
42 42
43 // Create GsmBroadcastSmsConfigInfo #3 43 // Create GsmBroadcastSmsConfigInfo #3
44 GsmBroadcastSmsConfigInfo gbSmsConfig3; 44 GsmBroadcastSmsConfigInfo gbSmsConfig3;
45 gbSmsConfig3.fromServiceId = 4370; 45 gbSmsConfig3.fromServiceId = 4370;
46 gbSmsConfig3.toServiceId = 4379; 46 gbSmsConfig3.toServiceId = 4379;
47 gbSmsConfig3.fromCodeScheme = 0; 47 gbSmsConfig3.fromCodeScheme = 0;
48 gbSmsConfig3.toCodeScheme = 255; 48 gbSmsConfig3.toCodeScheme = 255;
49 gbSmsConfig3.selected = true; 49 gbSmsConfig3.selected = true;
50 50
51 // Create GsmBroadcastSmsConfigInfo #4 51 // Create GsmBroadcastSmsConfigInfo #4
52 GsmBroadcastSmsConfigInfo gbSmsConfig4; 52 GsmBroadcastSmsConfigInfo gbSmsConfig4;
53 gbSmsConfig4.fromServiceId = 4383; 53 gbSmsConfig4.fromServiceId = 4383;
54 gbSmsConfig4.toServiceId = 4391; 54 gbSmsConfig4.toServiceId = 4391;
55 gbSmsConfig4.fromCodeScheme = 0; 55 gbSmsConfig4.fromCodeScheme = 0;
56 gbSmsConfig4.toCodeScheme = 255; 56 gbSmsConfig4.toCodeScheme = 255;
57 gbSmsConfig4.selected = true; 57 gbSmsConfig4.selected = true;
58 58
59 // Create GsmBroadcastSmsConfigInfo #5 59 // Create GsmBroadcastSmsConfigInfo #5
60 GsmBroadcastSmsConfigInfo gbSmsConfig5; 60 GsmBroadcastSmsConfigInfo gbSmsConfig5;
61 gbSmsConfig5.fromServiceId = 4392; 61 gbSmsConfig5.fromServiceId = 4392;
62 gbSmsConfig5.toServiceId = 4392; 62 gbSmsConfig5.toServiceId = 4392;
63 gbSmsConfig5.fromCodeScheme = 0; 63 gbSmsConfig5.fromCodeScheme = 0;
64 gbSmsConfig5.toCodeScheme = 255; 64 gbSmsConfig5.toCodeScheme = 255;
65 gbSmsConfig5.selected = true; 65 gbSmsConfig5.selected = true;
66 66
67 android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo> 67 android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo> gsmBroadcastSmsConfigsInfoList = {
68 gsmBroadcastSmsConfigsInfoList = { 68 gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5};
69 gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5}; 69
70 70 radio->setGsmBroadcastConfig(serial, gsmBroadcastSmsConfigsInfoList);
71 radio->setGsmBroadcastConfig(++serial, gsmBroadcastSmsConfigsInfoList); 71
72 72 EXPECT_EQ(std::cv_status::no_timeout, wait());
73 EXPECT_EQ(std::cv_status::no_timeout, wait()); 73 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
74 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 74 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
75 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 75
76 76 if (cardStatus.cardState == CardState::ABSENT) {
77 if (cardStatus.cardState == CardState::ABSENT) { 77 ASSERT_TRUE(CheckGeneralError() ||
78 ASSERT_TRUE(CheckGeneralError() || 78 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
79 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 79 radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
80 radioRsp->rspInfo.error == RadioError::INVALID_STATE || 80 radioRsp->rspInfo.error == RadioError::NONE);
81 radioRsp->rspInfo.error == RadioError::NONE); 81 }
82 }
83} 82}
84 83
85/* 84/*
86 * Test IRadio.getGsmBroadcastConfig() for the response returned. 85 * Test IRadio.getGsmBroadcastConfig() for the response returned.
87 */ 86 */
88TEST_F(RadioHidlTest, getGsmBroadcastConfig) { 87TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
89 int serial = 0; 88 int serial = GetRandomSerialNumber();
90 89
91 radio->getGsmBroadcastConfig(++serial); 90 radio->getGsmBroadcastConfig(serial);
92 91
93 EXPECT_EQ(std::cv_status::no_timeout, wait()); 92 EXPECT_EQ(std::cv_status::no_timeout, wait());
94 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 93 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
95 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 94 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
96 95
97 if (cardStatus.cardState == CardState::ABSENT) { 96 if (cardStatus.cardState == CardState::ABSENT) {
98 ASSERT_TRUE(CheckGeneralError() || 97 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
99 radioRsp->rspInfo.error == RadioError::INVALID_STATE || 98 radioRsp->rspInfo.error == RadioError::NONE);
100 radioRsp->rspInfo.error == RadioError::NONE); 99 }
101 }
102} 100}
103 101
104/* 102/*
105 * Test IRadio.setCdmaBroadcastConfig() for the response returned. 103 * Test IRadio.setCdmaBroadcastConfig() for the response returned.
106 */ 104 */
107TEST_F(RadioHidlTest, setCdmaBroadcastConfig) { 105TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
108 int serial = 0; 106 int serial = GetRandomSerialNumber();
109 107
110 CdmaBroadcastSmsConfigInfo cbSmsConfig; 108 CdmaBroadcastSmsConfigInfo cbSmsConfig;
111 cbSmsConfig.serviceCategory = 4096; 109 cbSmsConfig.serviceCategory = 4096;
112 cbSmsConfig.language = 1; 110 cbSmsConfig.language = 1;
113 cbSmsConfig.selected = true; 111 cbSmsConfig.selected = true;
114 112
115 android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo> 113 android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo> cdmaBroadcastSmsConfigInfoList = {
116 cdmaBroadcastSmsConfigInfoList = {cbSmsConfig}; 114 cbSmsConfig};
117 115
118 radio->setCdmaBroadcastConfig(++serial, cdmaBroadcastSmsConfigInfoList); 116 radio->setCdmaBroadcastConfig(serial, cdmaBroadcastSmsConfigInfoList);
119 117
120 EXPECT_EQ(std::cv_status::no_timeout, wait()); 118 EXPECT_EQ(std::cv_status::no_timeout, wait());
121 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 119 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
122 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 120 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
123 121
124 if (cardStatus.cardState == CardState::ABSENT) { 122 if (cardStatus.cardState == CardState::ABSENT) {
125 ASSERT_TRUE(CheckGeneralError() || 123 ASSERT_TRUE(CheckGeneralError() ||
126 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS); 124 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
127 } 125 }
128} 126}
129 127
130/* 128/*
131 * Test IRadio.getCdmaBroadcastConfig() for the response returned. 129 * Test IRadio.getCdmaBroadcastConfig() for the response returned.
132 */ 130 */
133TEST_F(RadioHidlTest, getCdmaBroadcastConfig) { 131TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
134 int serial = 0; 132 int serial = GetRandomSerialNumber();
135 133
136 radio->getCdmaBroadcastConfig(++serial); 134 radio->getCdmaBroadcastConfig(serial);
137 135
138 EXPECT_EQ(std::cv_status::no_timeout, wait()); 136 EXPECT_EQ(std::cv_status::no_timeout, wait());
139 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 137 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
140 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 138 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
141 139
142 if (cardStatus.cardState == CardState::ABSENT) { 140 if (cardStatus.cardState == CardState::ABSENT) {
143 ASSERT_TRUE(CheckGeneralError()); 141 ASSERT_TRUE(CheckGeneralError());
144 } 142 }
145} 143}
146 144
147/* 145/*
148 * Test IRadio.setCdmaBroadcastActivation() for the response returned. 146 * Test IRadio.setCdmaBroadcastActivation() for the response returned.
149 */ 147 */
150TEST_F(RadioHidlTest, setCdmaBroadcastActivation) { 148TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
151 int serial = 0; 149 int serial = GetRandomSerialNumber();
152 bool activate = false; 150 bool activate = false;
153 151
154 radio->setCdmaBroadcastActivation(++serial, activate); 152 radio->setCdmaBroadcastActivation(serial, activate);
155 153
156 EXPECT_EQ(std::cv_status::no_timeout, wait()); 154 EXPECT_EQ(std::cv_status::no_timeout, wait());
157 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 155 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
158 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 156 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
159 157
160 if (cardStatus.cardState == CardState::ABSENT) { 158 if (cardStatus.cardState == CardState::ABSENT) {
161 ASSERT_TRUE(CheckGeneralError() || 159 ASSERT_TRUE(CheckGeneralError() ||
162 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS); 160 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
163 } 161 }
164} 162}
165 163
166/* 164/*
167 * Test IRadio.setGsmBroadcastActivation() for the response returned. 165 * Test IRadio.setGsmBroadcastActivation() for the response returned.
168 */ 166 */
169TEST_F(RadioHidlTest, setGsmBroadcastActivation) { 167TEST_F(RadioHidlTest, setGsmBroadcastActivation) {
170 int serial = 0; 168 int serial = GetRandomSerialNumber();
171 bool activate = false; 169 bool activate = false;
172 170
173 radio->setGsmBroadcastActivation(++serial, activate); 171 radio->setGsmBroadcastActivation(serial, activate);
174 172
175 EXPECT_EQ(std::cv_status::no_timeout, wait()); 173 EXPECT_EQ(std::cv_status::no_timeout, wait());
176 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 174 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
177 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 175 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
178 176
179 if (cardStatus.cardState == CardState::ABSENT) { 177 if (cardStatus.cardState == CardState::ABSENT) {
180 ASSERT_TRUE(CheckGeneralError() || 178 ASSERT_TRUE(CheckGeneralError() ||
181 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 179 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
182 radioRsp->rspInfo.error == RadioError::INVALID_STATE || 180 radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
183 radioRsp->rspInfo.error == RadioError::NONE || 181 radioRsp->rspInfo.error == RadioError::NONE ||
184 radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED); 182 radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
185 } 183 }
186} 184}
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 4eeabe84..108676b9 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -22,209 +22,204 @@ using namespace ::android::hardware::radio::V1_0;
22 * Test IRadio.getDataRegistrationState() for the response returned. 22 * Test IRadio.getDataRegistrationState() for the response returned.
23 */ 23 */
24TEST_F(RadioHidlTest, getDataRegistrationState) { 24TEST_F(RadioHidlTest, getDataRegistrationState) {
25 int serial = 0; 25 int serial = GetRandomSerialNumber();
26 26
27 radio->getDataRegistrationState(++serial); 27 radio->getDataRegistrationState(serial);
28 28
29 EXPECT_EQ(std::cv_status::no_timeout, wait()); 29 EXPECT_EQ(std::cv_status::no_timeout, wait());
30 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 30 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
31 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 31 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
32 32
33 if (cardStatus.cardState == CardState::ABSENT) { 33 if (cardStatus.cardState == CardState::ABSENT) {
34 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); 34 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
35 } 35 }
36} 36}
37 37
38/* 38/*
39 * Test IRadio.setupDataCall() for the response returned. 39 * Test IRadio.setupDataCall() for the response returned.
40 */ 40 */
41TEST_F(RadioHidlTest, setupDataCall) { 41TEST_F(RadioHidlTest, setupDataCall) {
42 int serial = 0; 42 int serial = GetRandomSerialNumber();
43 43
44 RadioTechnology radioTechnology = RadioTechnology::LTE; 44 RadioTechnology radioTechnology = RadioTechnology::LTE;
45 45
46 DataProfileInfo dataProfileInfo; 46 DataProfileInfo dataProfileInfo;
47 memset(&dataProfileInfo, 0, sizeof(dataProfileInfo)); 47 memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
48 dataProfileInfo.profileId = DataProfileId::IMS; 48 dataProfileInfo.profileId = DataProfileId::IMS;
49 dataProfileInfo.apn = hidl_string("VZWIMS"); 49 dataProfileInfo.apn = hidl_string("VZWIMS");
50 dataProfileInfo.protocol = hidl_string("IPV4V6"); 50 dataProfileInfo.protocol = hidl_string("IPV4V6");
51 dataProfileInfo.roamingProtocol = hidl_string("IPV6"); 51 dataProfileInfo.roamingProtocol = hidl_string("IPV6");
52 dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP; 52 dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
53 dataProfileInfo.user = ""; 53 dataProfileInfo.user = "";
54 dataProfileInfo.password = ""; 54 dataProfileInfo.password = "";
55 dataProfileInfo.type = DataProfileInfoType::THREE_GPP2; 55 dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
56 dataProfileInfo.maxConnsTime = 300; 56 dataProfileInfo.maxConnsTime = 300;
57 dataProfileInfo.maxConns = 20; 57 dataProfileInfo.maxConns = 20;
58 dataProfileInfo.waitTime = 0; 58 dataProfileInfo.waitTime = 0;
59 dataProfileInfo.enabled = true; 59 dataProfileInfo.enabled = true;
60 dataProfileInfo.supportedApnTypesBitmap = 320; 60 dataProfileInfo.supportedApnTypesBitmap = 320;
61 dataProfileInfo.bearerBitmap = 161543; 61 dataProfileInfo.bearerBitmap = 161543;
62 dataProfileInfo.mtu = 0; 62 dataProfileInfo.mtu = 0;
63 dataProfileInfo.mvnoType = MvnoType::NONE; 63 dataProfileInfo.mvnoType = MvnoType::NONE;
64 dataProfileInfo.mvnoMatchData = hidl_string(); 64 dataProfileInfo.mvnoMatchData = hidl_string();
65 65
66 bool modemCognitive = false; 66 bool modemCognitive = false;
67 bool roamingAllowed = false; 67 bool roamingAllowed = false;
68 bool isRoaming = false; 68 bool isRoaming = false;
69 69
70 radio->setupDataCall(++serial, radioTechnology, dataProfileInfo, 70 radio->setupDataCall(serial, radioTechnology, dataProfileInfo, modemCognitive, roamingAllowed,
71 modemCognitive, roamingAllowed, isRoaming); 71 isRoaming);
72 72
73 EXPECT_EQ(std::cv_status::no_timeout, wait()); 73 EXPECT_EQ(std::cv_status::no_timeout, wait());
74 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 74 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
75 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 75 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
76 76
77 if (cardStatus.cardState == CardState::ABSENT) { 77 if (cardStatus.cardState == CardState::ABSENT) {
78 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE || 78 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
79 radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE || 79 radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
80 radioRsp->rspInfo.error == 80 radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW ||
81 RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW || 81 radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_DURING_VOICE_CALL ||
82 radioRsp->rspInfo.error == 82 CheckOEMError());
83 RadioError::OP_NOT_ALLOWED_DURING_VOICE_CALL || 83 }
84 CheckOEMError());
85 }
86} 84}
87 85
88/* 86/*
89 * Test IRadio.deactivateDataCall() for the response returned. 87 * Test IRadio.deactivateDataCall() for the response returned.
90 */ 88 */
91TEST_F(RadioHidlTest, deactivateDataCall) { 89TEST_F(RadioHidlTest, deactivateDataCall) {
92 int serial = 0; 90 int serial = GetRandomSerialNumber();
93 int cid = 1; 91 int cid = 1;
94 bool reasonRadioShutDown = false; 92 bool reasonRadioShutDown = false;
95 93
96 radio->deactivateDataCall(++serial, cid, reasonRadioShutDown); 94 radio->deactivateDataCall(serial, cid, reasonRadioShutDown);
97 95
98 EXPECT_EQ(std::cv_status::no_timeout, wait()); 96 EXPECT_EQ(std::cv_status::no_timeout, wait());
99 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 97 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
100 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 98 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
101 99
102 if (cardStatus.cardState == CardState::ABSENT) { 100 if (cardStatus.cardState == CardState::ABSENT) {
103 EXPECT_EQ(RadioError::INVALID_CALL_ID, radioRsp->rspInfo.error); 101 EXPECT_EQ(RadioError::INVALID_CALL_ID, radioRsp->rspInfo.error);
104 } 102 }
105} 103}
106 104
107/* 105/*
108 * Test IRadio.getDataCallList() for the response returned. 106 * Test IRadio.getDataCallList() for the response returned.
109 */ 107 */
110TEST_F(RadioHidlTest, getDataCallList) { 108TEST_F(RadioHidlTest, getDataCallList) {
111 int serial = 0; 109 int serial = GetRandomSerialNumber();
112 110
113 radio->getDataCallList(++serial); 111 radio->getDataCallList(serial);
114 112
115 EXPECT_EQ(std::cv_status::no_timeout, wait()); 113 EXPECT_EQ(std::cv_status::no_timeout, wait());
116 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 114 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
117 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 115 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
118 116
119 if (cardStatus.cardState == CardState::ABSENT) { 117 if (cardStatus.cardState == CardState::ABSENT) {
120 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE || 118 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
121 radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE); 119 radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
122 } 120 }
123} 121}
124 122
125/* 123/*
126 * Test IRadio.setInitialAttachApn() for the response returned. 124 * Test IRadio.setInitialAttachApn() for the response returned.
127 */ 125 */
128TEST_F(RadioHidlTest, setInitialAttachApn) { 126TEST_F(RadioHidlTest, setInitialAttachApn) {
129 int serial = 0; 127 int serial = GetRandomSerialNumber();
130 128
131 DataProfileInfo dataProfileInfo; 129 DataProfileInfo dataProfileInfo;
132 memset(&dataProfileInfo, 0, sizeof(dataProfileInfo)); 130 memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
133 dataProfileInfo.profileId = DataProfileId::IMS; 131 dataProfileInfo.profileId = DataProfileId::IMS;
134 dataProfileInfo.apn = hidl_string("VZWIMS"); 132 dataProfileInfo.apn = hidl_string("VZWIMS");
135 dataProfileInfo.protocol = hidl_string("IPV4V6"); 133 dataProfileInfo.protocol = hidl_string("IPV4V6");
136 dataProfileInfo.roamingProtocol = hidl_string("IPV6"); 134 dataProfileInfo.roamingProtocol = hidl_string("IPV6");
137 dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP; 135 dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
138 dataProfileInfo.user = ""; 136 dataProfileInfo.user = "";
139 dataProfileInfo.password = ""; 137 dataProfileInfo.password = "";
140 dataProfileInfo.type = DataProfileInfoType::THREE_GPP2; 138 dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
141 dataProfileInfo.maxConnsTime = 300; 139 dataProfileInfo.maxConnsTime = 300;
142 dataProfileInfo.maxConns = 20; 140 dataProfileInfo.maxConns = 20;
143 dataProfileInfo.waitTime = 0; 141 dataProfileInfo.waitTime = 0;
144 dataProfileInfo.enabled = true; 142 dataProfileInfo.enabled = true;
145 dataProfileInfo.supportedApnTypesBitmap = 320; 143 dataProfileInfo.supportedApnTypesBitmap = 320;
146 dataProfileInfo.bearerBitmap = 161543; 144 dataProfileInfo.bearerBitmap = 161543;
147 dataProfileInfo.mtu = 0; 145 dataProfileInfo.mtu = 0;
148 dataProfileInfo.mvnoType = MvnoType::NONE; 146 dataProfileInfo.mvnoType = MvnoType::NONE;
149 dataProfileInfo.mvnoMatchData = hidl_string(); 147 dataProfileInfo.mvnoMatchData = hidl_string();
150 148
151 bool modemCognitive = true; 149 bool modemCognitive = true;
152 bool isRoaming = false; 150 bool isRoaming = false;
153 151
154 radio->setInitialAttachApn(++serial, dataProfileInfo, modemCognitive, 152 radio->setInitialAttachApn(serial, dataProfileInfo, modemCognitive, isRoaming);
155 isRoaming); 153
156 154 EXPECT_EQ(std::cv_status::no_timeout, wait());
157 EXPECT_EQ(std::cv_status::no_timeout, wait()); 155 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
158 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 156 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
159 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 157
160 158 if (cardStatus.cardState == CardState::ABSENT) {
161 if (cardStatus.cardState == CardState::ABSENT) { 159 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
162 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE || 160 radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
163 radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE || 161 radioRsp->rspInfo.error == RadioError::SUBSCRIPTION_NOT_AVAILABLE ||
164 radioRsp->rspInfo.error == 162 CheckOEMError());
165 RadioError::SUBSCRIPTION_NOT_AVAILABLE || 163 }
166 CheckOEMError());
167 }
168} 164}
169 165
170/* 166/*
171 * Test IRadio.setDataAllowed() for the response returned. 167 * Test IRadio.setDataAllowed() for the response returned.
172 */ 168 */
173TEST_F(RadioHidlTest, setDataAllowed) { 169TEST_F(RadioHidlTest, setDataAllowed) {
174 int serial = 0; 170 int serial = GetRandomSerialNumber();
175 bool allow = true; 171 bool allow = true;
176 172
177 radio->setDataAllowed(++serial, allow); 173 radio->setDataAllowed(serial, allow);
178 174
179 EXPECT_EQ(std::cv_status::no_timeout, wait()); 175 EXPECT_EQ(std::cv_status::no_timeout, wait());
180 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 176 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
181 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 177 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
182 178
183 if (cardStatus.cardState == CardState::ABSENT) { 179 if (cardStatus.cardState == CardState::ABSENT) {
184 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); 180 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
185 } 181 }
186} 182}
187 183
188/* 184/*
189 * Test IRadio.setDataProfile() for the response returned. 185 * Test IRadio.setDataProfile() for the response returned.
190 */ 186 */
191TEST_F(RadioHidlTest, setDataProfile) { 187TEST_F(RadioHidlTest, setDataProfile) {
192 int serial = 0; 188 int serial = GetRandomSerialNumber();
193 189
194 // Create a dataProfileInfo 190 // Create a dataProfileInfo
195 DataProfileInfo dataProfileInfo; 191 DataProfileInfo dataProfileInfo;
196 memset(&dataProfileInfo, 0, sizeof(dataProfileInfo)); 192 memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
197 dataProfileInfo.profileId = DataProfileId::IMS; 193 dataProfileInfo.profileId = DataProfileId::IMS;
198 dataProfileInfo.apn = hidl_string("VZWIMS"); 194 dataProfileInfo.apn = hidl_string("VZWIMS");
199 dataProfileInfo.protocol = hidl_string("IPV4V6"); 195 dataProfileInfo.protocol = hidl_string("IPV4V6");
200 dataProfileInfo.roamingProtocol = hidl_string("IPV6"); 196 dataProfileInfo.roamingProtocol = hidl_string("IPV6");
201 dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP; 197 dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
202 dataProfileInfo.user = ""; 198 dataProfileInfo.user = "";
203 dataProfileInfo.password = ""; 199 dataProfileInfo.password = "";
204 dataProfileInfo.type = DataProfileInfoType::THREE_GPP2; 200 dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
205 dataProfileInfo.maxConnsTime = 300; 201 dataProfileInfo.maxConnsTime = 300;
206 dataProfileInfo.maxConns = 20; 202 dataProfileInfo.maxConns = 20;
207 dataProfileInfo.waitTime = 0; 203 dataProfileInfo.waitTime = 0;
208 dataProfileInfo.enabled = true; 204 dataProfileInfo.enabled = true;
209 dataProfileInfo.supportedApnTypesBitmap = 320; 205 dataProfileInfo.supportedApnTypesBitmap = 320;
210 dataProfileInfo.bearerBitmap = 161543; 206 dataProfileInfo.bearerBitmap = 161543;
211 dataProfileInfo.mtu = 0; 207 dataProfileInfo.mtu = 0;
212 dataProfileInfo.mvnoType = MvnoType::NONE; 208 dataProfileInfo.mvnoType = MvnoType::NONE;
213 dataProfileInfo.mvnoMatchData = hidl_string(); 209 dataProfileInfo.mvnoMatchData = hidl_string();
214 210
215 // Create a dataProfileInfoList 211 // Create a dataProfileInfoList
216 android::hardware::hidl_vec<DataProfileInfo> dataProfileInfoList = { 212 android::hardware::hidl_vec<DataProfileInfo> dataProfileInfoList = {dataProfileInfo};
217 dataProfileInfo}; 213
218 214 bool isRoadming = false;
219 bool isRoadming = false; 215
220 216 radio->setDataProfile(serial, dataProfileInfoList, isRoadming);
221 radio->setDataProfile(++serial, dataProfileInfoList, isRoadming); 217
222 218 EXPECT_EQ(std::cv_status::no_timeout, wait());
223 EXPECT_EQ(std::cv_status::no_timeout, wait()); 219 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
224 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 220 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
225 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 221
226 222 if (cardStatus.cardState == CardState::ABSENT) {
227 if (cardStatus.cardState == CardState::ABSENT) { 223 // TODO(shuoq): Will add error check when we know the expected error from QC
228 // TODO(shuoq): Will add error check when we know the expected error from QC 224 }
229 }
230} 225}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
index 1547c33b..a8857c34 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -20,304 +20,303 @@
20 * Test IRadio.getIccCardStatus() for the response returned. 20 * Test IRadio.getIccCardStatus() for the response returned.
21 */ 21 */
22TEST_F(RadioHidlTest, getIccCardStatus) { 22TEST_F(RadioHidlTest, getIccCardStatus) {
23 EXPECT_LE(cardStatus.applications.size(), 23 EXPECT_LE(cardStatus.applications.size(), (unsigned int)RadioConst::CARD_MAX_APPS);
24 (unsigned int)RadioConst::CARD_MAX_APPS); 24 EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
25 EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, 25 EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
26 (int)RadioConst::CARD_MAX_APPS); 26 EXPECT_LT(cardStatus.imsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
27 EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex,
28 (int)RadioConst::CARD_MAX_APPS);
29 EXPECT_LT(cardStatus.imsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
30} 27}
31 28
32/* 29/*
33 * Test IRadio.supplyIccPinForApp() for the response returned 30 * Test IRadio.supplyIccPinForApp() for the response returned
34 */ 31 */
35TEST_F(RadioHidlTest, supplyIccPinForApp) { 32TEST_F(RadioHidlTest, supplyIccPinForApp) {
36 int serial = 1; 33 int serial = GetRandomSerialNumber();
37 34
38 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 35 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
39 // 3GPP2 apps only 36 // 3GPP2 apps only
40 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 37 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
41 if (cardStatus.applications[i].appType == AppType::SIM || 38 if (cardStatus.applications[i].appType == AppType::SIM ||
42 cardStatus.applications[i].appType == AppType::USIM || 39 cardStatus.applications[i].appType == AppType::USIM ||
43 cardStatus.applications[i].appType == AppType::RUIM || 40 cardStatus.applications[i].appType == AppType::RUIM ||
44 cardStatus.applications[i].appType == AppType::CSIM) { 41 cardStatus.applications[i].appType == AppType::CSIM) {
45 radio->supplyIccPinForApp(++serial, hidl_string("test1"), 42 radio->supplyIccPinForApp(serial, hidl_string("test1"),
46 cardStatus.applications[i].aidPtr); 43 cardStatus.applications[i].aidPtr);
47 EXPECT_EQ(std::cv_status::no_timeout, wait()); 44 EXPECT_EQ(std::cv_status::no_timeout, wait());
48 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 45 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
49 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 46 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
50 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); 47 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
48 }
51 } 49 }
52 }
53} 50}
54 51
55/* 52/*
56 * Test IRadio.supplyIccPukForApp() for the response returned. 53 * Test IRadio.supplyIccPukForApp() for the response returned.
57 */ 54 */
58TEST_F(RadioHidlTest, supplyIccPukForApp) { 55TEST_F(RadioHidlTest, supplyIccPukForApp) {
59 int serial = 1; 56 int serial = GetRandomSerialNumber();
60 57
61 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 58 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
62 // 3GPP2 apps only 59 // 3GPP2 apps only
63 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 60 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
64 if (cardStatus.applications[i].appType == AppType::SIM || 61 if (cardStatus.applications[i].appType == AppType::SIM ||
65 cardStatus.applications[i].appType == AppType::USIM || 62 cardStatus.applications[i].appType == AppType::USIM ||
66 cardStatus.applications[i].appType == AppType::RUIM || 63 cardStatus.applications[i].appType == AppType::RUIM ||
67 cardStatus.applications[i].appType == AppType::CSIM) { 64 cardStatus.applications[i].appType == AppType::CSIM) {
68 radio->supplyIccPukForApp(++serial, hidl_string("test1"), 65 radio->supplyIccPukForApp(serial, hidl_string("test1"), hidl_string("test2"),
69 hidl_string("test2"), 66 cardStatus.applications[i].aidPtr);
70 cardStatus.applications[i].aidPtr); 67 EXPECT_EQ(std::cv_status::no_timeout, wait());
71 EXPECT_EQ(std::cv_status::no_timeout, wait()); 68 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
72 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 69 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
73 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 70 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
74 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); 71 }
75 } 72 }
76 }
77} 73}
78 74
79/* 75/*
80 * Test IRadio.supplyIccPin2ForApp() for the response returned. 76 * Test IRadio.supplyIccPin2ForApp() for the response returned.
81 */ 77 */
82TEST_F(RadioHidlTest, supplyIccPin2ForApp) { 78TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
83 int serial = 1; 79 int serial = GetRandomSerialNumber();
84 80
85 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 81 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
86 // 3GPP2 apps only 82 // 3GPP2 apps only
87 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 83 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
88 if (cardStatus.applications[i].appType == AppType::SIM || 84 if (cardStatus.applications[i].appType == AppType::SIM ||
89 cardStatus.applications[i].appType == AppType::USIM || 85 cardStatus.applications[i].appType == AppType::USIM ||
90 cardStatus.applications[i].appType == AppType::RUIM || 86 cardStatus.applications[i].appType == AppType::RUIM ||
91 cardStatus.applications[i].appType == AppType::CSIM) { 87 cardStatus.applications[i].appType == AppType::CSIM) {
92 radio->supplyIccPin2ForApp(++serial, hidl_string("test1"), 88 radio->supplyIccPin2ForApp(serial, hidl_string("test1"),
93 cardStatus.applications[i].aidPtr); 89 cardStatus.applications[i].aidPtr);
94 EXPECT_EQ(std::cv_status::no_timeout, wait()); 90 EXPECT_EQ(std::cv_status::no_timeout, wait());
95 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 91 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
96 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 92 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
97 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); 93 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
94 }
98 } 95 }
99 }
100} 96}
101 97
102/* 98/*
103 * Test IRadio.supplyIccPuk2ForApp() for the response returned. 99 * Test IRadio.supplyIccPuk2ForApp() for the response returned.
104 */ 100 */
105TEST_F(RadioHidlTest, supplyIccPuk2ForApp) { 101TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
106 int serial = 1; 102 int serial = GetRandomSerialNumber();
107 103
108 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 104 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
109 // 3GPP2 apps only 105 // 3GPP2 apps only
110 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 106 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
111 if (cardStatus.applications[i].appType == AppType::SIM || 107 if (cardStatus.applications[i].appType == AppType::SIM ||
112 cardStatus.applications[i].appType == AppType::USIM || 108 cardStatus.applications[i].appType == AppType::USIM ||
113 cardStatus.applications[i].appType == AppType::RUIM || 109 cardStatus.applications[i].appType == AppType::RUIM ||
114 cardStatus.applications[i].appType == AppType::CSIM) { 110 cardStatus.applications[i].appType == AppType::CSIM) {
115 radio->supplyIccPuk2ForApp(++serial, hidl_string("test1"), 111 radio->supplyIccPuk2ForApp(serial, hidl_string("test1"), hidl_string("test2"),
116 hidl_string("test2"), 112 cardStatus.applications[i].aidPtr);
117 cardStatus.applications[i].aidPtr); 113 EXPECT_EQ(std::cv_status::no_timeout, wait());
118 EXPECT_EQ(std::cv_status::no_timeout, wait()); 114 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
119 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 115 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
120 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 116 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
121 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); 117 }
122 } 118 }
123 }
124} 119}
125 120
126/* 121/*
127 * Test IRadio.changeIccPinForApp() for the response returned. 122 * Test IRadio.changeIccPinForApp() for the response returned.
128 */ 123 */
129TEST_F(RadioHidlTest, changeIccPinForApp) { 124TEST_F(RadioHidlTest, changeIccPinForApp) {
130 int serial = 1; 125 int serial = GetRandomSerialNumber();
131 126
132 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 127 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
133 // 3GPP2 apps only 128 // 3GPP2 apps only
134 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 129 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
135 if (cardStatus.applications[i].appType == AppType::SIM || 130 if (cardStatus.applications[i].appType == AppType::SIM ||
136 cardStatus.applications[i].appType == AppType::USIM || 131 cardStatus.applications[i].appType == AppType::USIM ||
137 cardStatus.applications[i].appType == AppType::RUIM || 132 cardStatus.applications[i].appType == AppType::RUIM ||
138 cardStatus.applications[i].appType == AppType::CSIM) { 133 cardStatus.applications[i].appType == AppType::CSIM) {
139 radio->changeIccPinForApp(++serial, hidl_string("test1"), 134 radio->changeIccPinForApp(serial, hidl_string("test1"), hidl_string("test2"),
140 hidl_string("test2"), 135 cardStatus.applications[i].aidPtr);
141 cardStatus.applications[i].aidPtr); 136 EXPECT_EQ(std::cv_status::no_timeout, wait());
142 EXPECT_EQ(std::cv_status::no_timeout, wait()); 137 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
143 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 138 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
144 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 139 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
145 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); 140 }
146 } 141 }
147 }
148} 142}
149 143
150/* 144/*
151 * Test IRadio.changeIccPin2ForApp() for the response returned. 145 * Test IRadio.changeIccPin2ForApp() for the response returned.
152 */ 146 */
153TEST_F(RadioHidlTest, changeIccPin2ForApp) { 147TEST_F(RadioHidlTest, changeIccPin2ForApp) {
154 int serial = 1; 148 int serial = GetRandomSerialNumber();
155 149
156 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 150 // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
157 // 3GPP2 apps only 151 // 3GPP2 apps only
158 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 152 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
159 if (cardStatus.applications[i].appType == AppType::SIM || 153 if (cardStatus.applications[i].appType == AppType::SIM ||
160 cardStatus.applications[i].appType == AppType::USIM || 154 cardStatus.applications[i].appType == AppType::USIM ||
161 cardStatus.applications[i].appType == AppType::RUIM || 155 cardStatus.applications[i].appType == AppType::RUIM ||
162 cardStatus.applications[i].appType == AppType::CSIM) { 156 cardStatus.applications[i].appType == AppType::CSIM) {
163 radio->changeIccPin2ForApp(++serial, hidl_string("test1"), 157 radio->changeIccPin2ForApp(serial, hidl_string("test1"), hidl_string("test2"),
164 hidl_string("test2"), 158 cardStatus.applications[i].aidPtr);
165 cardStatus.applications[i].aidPtr); 159 EXPECT_EQ(std::cv_status::no_timeout, wait());
166 EXPECT_EQ(std::cv_status::no_timeout, wait()); 160 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
167 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 161 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
168 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 162 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
169 EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); 163 }
170 } 164 }
171 }
172} 165}
173 166
174/* 167/*
175 * Test IRadio.getImsiForApp() for the response returned. 168 * Test IRadio.getImsiForApp() for the response returned.
176 */ 169 */
177TEST_F(RadioHidlTest, getImsiForApp) { 170TEST_F(RadioHidlTest, getImsiForApp) {
178 int serial = 1; 171 int serial = GetRandomSerialNumber();
179 172
180 // Check success returned while getting imsi for 3GPP and 3GPP2 apps only 173 // Check success returned while getting imsi for 3GPP and 3GPP2 apps only
181 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 174 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
182 if (cardStatus.applications[i].appType == AppType::SIM || 175 if (cardStatus.applications[i].appType == AppType::SIM ||
183 cardStatus.applications[i].appType == AppType::USIM || 176 cardStatus.applications[i].appType == AppType::USIM ||
184 cardStatus.applications[i].appType == AppType::RUIM || 177 cardStatus.applications[i].appType == AppType::RUIM ||
185 cardStatus.applications[i].appType == AppType::CSIM) { 178 cardStatus.applications[i].appType == AppType::CSIM) {
186 radio->getImsiForApp(++serial, cardStatus.applications[i].aidPtr); 179 radio->getImsiForApp(serial, cardStatus.applications[i].aidPtr);
187 EXPECT_EQ(std::cv_status::no_timeout, wait()); 180 EXPECT_EQ(std::cv_status::no_timeout, wait());
188 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 181 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
189 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 182 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
190 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); 183 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
191 184
192 // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15 185 // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15
193 if (radioRsp->rspInfo.error == RadioError::NONE) { 186 if (radioRsp->rspInfo.error == RadioError::NONE) {
194 EXPECT_NE(radioRsp->imsi, hidl_string()); 187 EXPECT_NE(radioRsp->imsi, hidl_string());
195 EXPECT_GE((int)(radioRsp->imsi).size(), 6); 188 EXPECT_GE((int)(radioRsp->imsi).size(), 6);
196 EXPECT_LE((int)(radioRsp->imsi).size(), 15); 189 EXPECT_LE((int)(radioRsp->imsi).size(), 15);
197 } 190 }
191 }
198 } 192 }
199 }
200} 193}
201 194
202/* 195/*
203 * Test IRadio.iccIOForApp() for the response returned. 196 * Test IRadio.iccIOForApp() for the response returned.
204 */ 197 */
205TEST_F(RadioHidlTest, iccIOForApp) { 198TEST_F(RadioHidlTest, iccIOForApp) {
206 int serial = 1; 199 int serial = GetRandomSerialNumber();
207 200
208 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 201 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
209 IccIo iccIo; 202 IccIo iccIo;
210 iccIo.command = 0xc0; 203 iccIo.command = 0xc0;
211 iccIo.fileId = 0x6f11; 204 iccIo.fileId = 0x6f11;
212 iccIo.path = hidl_string("3F007FFF"); 205 iccIo.path = hidl_string("3F007FFF");
213 iccIo.p1 = 0; 206 iccIo.p1 = 0;
214 iccIo.p2 = 0; 207 iccIo.p2 = 0;
215 iccIo.p3 = 0; 208 iccIo.p3 = 0;
216 iccIo.data = hidl_string(); 209 iccIo.data = hidl_string();
217 iccIo.pin2 = hidl_string(); 210 iccIo.pin2 = hidl_string();
218 iccIo.aid = cardStatus.applications[i].aidPtr; 211 iccIo.aid = cardStatus.applications[i].aidPtr;
219 212
220 radio->iccIOForApp(++serial, iccIo); 213 radio->iccIOForApp(serial, iccIo);
221 EXPECT_EQ(std::cv_status::no_timeout, wait()); 214 EXPECT_EQ(std::cv_status::no_timeout, wait());
222 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 215 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
223 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 216 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
224 } 217 }
225} 218}
226 219
227/* 220/*
228 * Test IRadio.iccTransmitApduBasicChannel() for the response returned. 221 * Test IRadio.iccTransmitApduBasicChannel() for the response returned.
229 */ 222 */
230TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) { 223TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
231 int serial = 1; 224 int serial = GetRandomSerialNumber();
232 SimApdu msg; 225 SimApdu msg;
233 memset(&msg, 0, sizeof(msg)); 226 memset(&msg, 0, sizeof(msg));
234 msg.data = hidl_string(); 227 msg.data = hidl_string();
235 228
236 radio->iccTransmitApduBasicChannel(serial, msg); 229 radio->iccTransmitApduBasicChannel(serial, msg);
237 EXPECT_EQ(std::cv_status::no_timeout, wait()); 230 EXPECT_EQ(std::cv_status::no_timeout, wait());
238 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 231 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
239 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 232 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
240 233
241 // TODO(sanketpadawe): Add test for error code 234 // TODO(sanketpadawe): Add test for error code
242} 235}
243 236
244/* 237/*
245 * Test IRadio.iccOpenLogicalChannel() for the response returned. 238 * Test IRadio.iccOpenLogicalChannel() for the response returned.
246 */ 239 */
247TEST_F(RadioHidlTest, iccOpenLogicalChannel) { 240TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
248 int serial = 1; 241 int serial = GetRandomSerialNumber();
249 int p2 = 0x04; 242 int p2 = 0x04;
250 // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested. 243 // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
251 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 244 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
252 radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr, p2); 245 radio->iccOpenLogicalChannel(serial, cardStatus.applications[i].aidPtr, p2);
253 EXPECT_EQ(std::cv_status::no_timeout, wait()); 246 EXPECT_EQ(std::cv_status::no_timeout, wait());
254 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 247 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
255 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 248 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
256 } 249 }
257} 250}
258 251
259/* 252/*
260 * Test IRadio.iccCloseLogicalChannel() for the response returned. 253 * Test IRadio.iccCloseLogicalChannel() for the response returned.
261 */ 254 */
262TEST_F(RadioHidlTest, iccCloseLogicalChannel) { 255TEST_F(RadioHidlTest, iccCloseLogicalChannel) {
263 int serial = 1; 256 int serial = GetRandomSerialNumber();
264 // Try closing invalid channel and check INVALID_ARGUMENTS returned as error 257 // Try closing invalid channel and check INVALID_ARGUMENTS returned as error
265 radio->iccCloseLogicalChannel(serial, 0); 258 radio->iccCloseLogicalChannel(serial, 0);
266 EXPECT_EQ(std::cv_status::no_timeout, wait()); 259 EXPECT_EQ(std::cv_status::no_timeout, wait());
267 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 260 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
268 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 261 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
269 262
270 EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error); 263 EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
271} 264}
272 265
273/* 266/*
274 * Test IRadio.iccTransmitApduLogicalChannel() for the response returned. 267 * Test IRadio.iccTransmitApduLogicalChannel() for the response returned.
275 */ 268 */
276TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) { 269TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) {
277 SimApdu msg; 270 int serial = GetRandomSerialNumber();
278 memset(&msg, 0, sizeof(msg)); 271 SimApdu msg;
279 msg.data = hidl_string(); 272 memset(&msg, 0, sizeof(msg));
273 msg.data = hidl_string();
280 274
281 radio->iccTransmitApduLogicalChannel(1, msg); 275 radio->iccTransmitApduLogicalChannel(serial, msg);
282 EXPECT_EQ(std::cv_status::no_timeout, wait()); 276 EXPECT_EQ(std::cv_status::no_timeout, wait());
283 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 277 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
284 EXPECT_EQ(1, radioRsp->rspInfo.serial); 278 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
285 279
286 // TODO(sanketpadawe): Add test for error code 280 // TODO(sanketpadawe): Add test for error code
287} 281}
288 282
289/* 283/*
290 * Test IRadio.requestIccSimAuthentication() for the response returned. 284 * Test IRadio.requestIccSimAuthentication() for the response returned.
291 */ 285 */
292TEST_F(RadioHidlTest, requestIccSimAuthentication) { 286TEST_F(RadioHidlTest, requestIccSimAuthentication) {
293 int serial = 1; 287 int serial = GetRandomSerialNumber();
294 288
295 // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS 289 // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
296 // returned as error. 290 // returned as error.
297 for (int i = 0; i < (int)cardStatus.applications.size(); i++) { 291 for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
298 radio->requestIccSimAuthentication(++serial, 0, hidl_string("test"), 292 radio->requestIccSimAuthentication(serial, 0, hidl_string("test"),
299 cardStatus.applications[i].aidPtr); 293 cardStatus.applications[i].aidPtr);
300 EXPECT_EQ(std::cv_status::no_timeout, wait()); 294 EXPECT_EQ(std::cv_status::no_timeout, wait());
301 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 295 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
302 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 296 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
303 EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error); 297 EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
304 } 298 }
305} 299}
306 300
307/* 301/*
308 * Test IRadio.supplyNetworkDepersonalization() for the response returned. 302 * Test IRadio.supplyNetworkDepersonalization() for the response returned.
309 */ 303 */
310TEST_F(RadioHidlTest, supplyNetworkDepersonalization) { 304TEST_F(RadioHidlTest, supplyNetworkDepersonalization) {
311 int serial = 1; 305 int serial = GetRandomSerialNumber();
312 306
313 radio->supplyNetworkDepersonalization(serial, hidl_string("test")); 307 radio->supplyNetworkDepersonalization(serial, hidl_string("test"));
314 EXPECT_EQ(std::cv_status::no_timeout, wait()); 308 EXPECT_EQ(std::cv_status::no_timeout, wait());
315 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 309 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
316 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 310 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
317 311
318 if (cardStatus.cardState == CardState::ABSENT) { 312 if (cardStatus.cardState == CardState::ABSENT) {
319 ASSERT_TRUE(CheckGeneralError() || 313 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
320 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 314 radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
321 radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT); 315 radioRsp->rspInfo.error == RadioError::NO_MEMORY ||
322 } 316 radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
317 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
318 radioRsp->rspInfo.error == RadioError::INVALID_SIM_STATE ||
319 radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT ||
320 radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
321 }
323} 322}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
index ddf6b7ee..ec99d428 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
@@ -22,178 +22,174 @@ using namespace ::android::hardware::radio::V1_0;
22 * Test IRadio.getClir() for the response returned. 22 * Test IRadio.getClir() for the response returned.
23 */ 23 */
24TEST_F(RadioHidlTest, getClir) { 24TEST_F(RadioHidlTest, getClir) {
25 int serial = 0; 25 int serial = GetRandomSerialNumber();
26 26
27 radio->getClir(++serial); 27 radio->getClir(serial);
28 28
29 EXPECT_EQ(std::cv_status::no_timeout, wait()); 29 EXPECT_EQ(std::cv_status::no_timeout, wait());
30 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 30 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
31 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 31 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
32 32
33 if (cardStatus.cardState == CardState::ABSENT) { 33 if (cardStatus.cardState == CardState::ABSENT) {
34 ASSERT_TRUE(CheckGeneralError() || 34 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::MODEM_ERR);
35 radioRsp->rspInfo.error == RadioError::MODEM_ERR); 35 }
36 }
37} 36}
38 37
39/* 38/*
40 * Test IRadio.setClir() for the response returned. 39 * Test IRadio.setClir() for the response returned.
41 */ 40 */
42TEST_F(RadioHidlTest, setClir) { 41TEST_F(RadioHidlTest, setClir) {
43 int serial = 0; 42 int serial = GetRandomSerialNumber();
44 int32_t status = 1; 43 int32_t status = 1;
45 44
46 radio->setClir(++serial, status); 45 radio->setClir(serial, status);
47 46
48 EXPECT_EQ(std::cv_status::no_timeout, wait()); 47 EXPECT_EQ(std::cv_status::no_timeout, wait());
49 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 48 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
50 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 49 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
51 50
52 if (cardStatus.cardState == CardState::ABSENT) { 51 if (cardStatus.cardState == CardState::ABSENT) {
53 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); 52 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
54 } 53 }
55} 54}
56 55
57/* 56/*
58 * Test IRadio.getFacilityLockForApp() for the response returned. 57 * Test IRadio.getFacilityLockForApp() for the response returned.
59 */ 58 */
60TEST_F(RadioHidlTest, getFacilityLockForApp) { 59TEST_F(RadioHidlTest, getFacilityLockForApp) {
61 int serial = 0; 60 int serial = GetRandomSerialNumber();
62 std::string facility = ""; 61 std::string facility = "";
63 std::string password = ""; 62 std::string password = "";
64 int32_t serviceClass = 1; 63 int32_t serviceClass = 1;
65 std::string appId = ""; 64 std::string appId = "";
66 65
67 radio->getFacilityLockForApp(++serial, facility, password, serviceClass, 66 radio->getFacilityLockForApp(serial, facility, password, serviceClass, appId);
68 appId); 67
69 68 EXPECT_EQ(std::cv_status::no_timeout, wait());
70 EXPECT_EQ(std::cv_status::no_timeout, wait()); 69 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
71 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 70 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
72 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 71
73 72 if (cardStatus.cardState == CardState::ABSENT) {
74 if (cardStatus.cardState == CardState::ABSENT) { 73 ASSERT_TRUE(CheckGeneralError() ||
75 ASSERT_TRUE(CheckGeneralError() || 74 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
76 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 75 radioRsp->rspInfo.error == RadioError::MODEM_ERR);
77 radioRsp->rspInfo.error == RadioError::MODEM_ERR); 76 }
78 }
79} 77}
80 78
81/* 79/*
82 * Test IRadio.setFacilityLockForApp() for the response returned. 80 * Test IRadio.setFacilityLockForApp() for the response returned.
83 */ 81 */
84TEST_F(RadioHidlTest, setFacilityLockForApp) { 82TEST_F(RadioHidlTest, setFacilityLockForApp) {
85 int serial = 0; 83 int serial = GetRandomSerialNumber();
86 std::string facility = ""; 84 std::string facility = "";
87 bool lockState = false; 85 bool lockState = false;
88 std::string password = ""; 86 std::string password = "";
89 int32_t serviceClass = 1; 87 int32_t serviceClass = 1;
90 std::string appId = ""; 88 std::string appId = "";
91 89
92 radio->setFacilityLockForApp(++serial, facility, lockState, password, 90 radio->setFacilityLockForApp(serial, facility, lockState, password, serviceClass, appId);
93 serviceClass, appId); 91
94 92 EXPECT_EQ(std::cv_status::no_timeout, wait());
95 EXPECT_EQ(std::cv_status::no_timeout, wait()); 93 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
96 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 94 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
97 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 95
98 96 if (cardStatus.cardState == CardState::ABSENT) {
99 if (cardStatus.cardState == CardState::ABSENT) { 97 ASSERT_TRUE(CheckGeneralError() ||
100 ASSERT_TRUE(CheckGeneralError() || 98 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
101 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 99 radioRsp->rspInfo.error == RadioError::MODEM_ERR);
102 radioRsp->rspInfo.error == RadioError::MODEM_ERR); 100 }
103 }
104} 101}
105 102
106/* 103/*
107 * Test IRadio.setBarringPassword() for the response returned. 104 * Test IRadio.setBarringPassword() for the response returned.
108 */ 105 */
109TEST_F(RadioHidlTest, setBarringPassword) { 106TEST_F(RadioHidlTest, setBarringPassword) {
110 int serial = 0; 107 int serial = GetRandomSerialNumber();
111 std::string facility = ""; 108 std::string facility = "";
112 std::string oldPassword = ""; 109 std::string oldPassword = "";
113 std::string newPassword = ""; 110 std::string newPassword = "";
114 111
115 radio->setBarringPassword(++serial, facility, oldPassword, newPassword); 112 radio->setBarringPassword(serial, facility, oldPassword, newPassword);
116 113
117 EXPECT_EQ(std::cv_status::no_timeout, wait()); 114 EXPECT_EQ(std::cv_status::no_timeout, wait());
118 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 115 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
119 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 116 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
120 117
121 if (cardStatus.cardState == CardState::ABSENT) { 118 if (cardStatus.cardState == CardState::ABSENT) {
122 ASSERT_TRUE(CheckGeneralError() || 119 ASSERT_TRUE(CheckGeneralError() ||
123 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 120 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
124 radioRsp->rspInfo.error == RadioError::NONE || 121 radioRsp->rspInfo.error == RadioError::NONE ||
125 radioRsp->rspInfo.error == RadioError::MODEM_ERR || 122 radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
126 radioRsp->rspInfo.error == RadioError::FDN_CHECK_FAILURE); 123 radioRsp->rspInfo.error == RadioError::FDN_CHECK_FAILURE);
127 } 124 }
128} 125}
129 126
130/* 127/*
131 * Test IRadio.getClip() for the response returned. 128 * Test IRadio.getClip() for the response returned.
132 */ 129 */
133TEST_F(RadioHidlTest, getClip) { 130TEST_F(RadioHidlTest, getClip) {
134 int serial = 0; 131 int serial = GetRandomSerialNumber();
135 132
136 radio->getClip(++serial); 133 radio->getClip(serial);
137 134
138 EXPECT_EQ(std::cv_status::no_timeout, wait()); 135 EXPECT_EQ(std::cv_status::no_timeout, wait());
139 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 136 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
140 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 137 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
141 138
142 if (cardStatus.cardState == CardState::ABSENT) { 139 if (cardStatus.cardState == CardState::ABSENT) {
143 ASSERT_TRUE(CheckGeneralError() || 140 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::MODEM_ERR);
144 radioRsp->rspInfo.error == RadioError::MODEM_ERR); 141 }
145 }
146} 142}
147 143
148/* 144/*
149 * Test IRadio.setSuppServiceNotifications() for the response returned. 145 * Test IRadio.setSuppServiceNotifications() for the response returned.
150 */ 146 */
151TEST_F(RadioHidlTest, setSuppServiceNotifications) { 147TEST_F(RadioHidlTest, setSuppServiceNotifications) {
152 int serial = 0; 148 int serial = GetRandomSerialNumber();
153 bool enable = false; 149 bool enable = false;
154 150
155 radio->setSuppServiceNotifications(++serial, enable); 151 radio->setSuppServiceNotifications(serial, enable);
156 152
157 EXPECT_EQ(std::cv_status::no_timeout, wait()); 153 EXPECT_EQ(std::cv_status::no_timeout, wait());
158 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 154 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
159 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 155 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
160 156
161 if (cardStatus.cardState == CardState::ABSENT) { 157 if (cardStatus.cardState == CardState::ABSENT) {
162 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); 158 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
163 } 159 }
164} 160}
165 161
166/* 162/*
167 * Test IRadio.requestIsimAuthentication() for the response returned. 163 * Test IRadio.requestIsimAuthentication() for the response returned.
168 */ 164 */
169TEST_F(RadioHidlTest, requestIsimAuthentication) { 165TEST_F(RadioHidlTest, requestIsimAuthentication) {
170 int serial = 0; 166 int serial = GetRandomSerialNumber();
171 std::string challenge = ""; 167 std::string challenge = "";
172 168
173 radio->requestIsimAuthentication(++serial, challenge); 169 radio->requestIsimAuthentication(serial, challenge);
174 170
175 EXPECT_EQ(std::cv_status::no_timeout, wait()); 171 EXPECT_EQ(std::cv_status::no_timeout, wait());
176 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 172 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
177 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 173 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
178 174
179 if (cardStatus.cardState == CardState::ABSENT) { 175 if (cardStatus.cardState == CardState::ABSENT) {
180 ASSERT_TRUE(CheckGeneralError()); 176 ASSERT_TRUE(CheckGeneralError());
181 } 177 }
182} 178}
183 179
184/* 180/*
185 * Test IRadio.getImsRegistrationState() for the response returned. 181 * Test IRadio.getImsRegistrationState() for the response returned.
186 */ 182 */
187TEST_F(RadioHidlTest, getImsRegistrationState) { 183TEST_F(RadioHidlTest, getImsRegistrationState) {
188 int serial = 0; 184 int serial = GetRandomSerialNumber();
189 185
190 radio->getImsRegistrationState(++serial); 186 radio->getImsRegistrationState(serial);
191 187
192 EXPECT_EQ(std::cv_status::no_timeout, wait()); 188 EXPECT_EQ(std::cv_status::no_timeout, wait());
193 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 189 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
194 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 190 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
195 191
196 if (cardStatus.cardState == CardState::ABSENT) { 192 if (cardStatus.cardState == CardState::ABSENT) {
197 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); 193 EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
198 } 194 }
199} 195}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 6879c90f..29cb9123 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -20,800 +20,809 @@
20 * Test IRadio.getSignalStrength() for the response returned. 20 * Test IRadio.getSignalStrength() for the response returned.
21 */ 21 */
22TEST_F(RadioHidlTest, getSignalStrength) { 22TEST_F(RadioHidlTest, getSignalStrength) {
23 int serial = 1; 23 int serial = GetRandomSerialNumber();
24 24
25 radio->getSignalStrength(++serial); 25 radio->getSignalStrength(serial);
26 EXPECT_EQ(std::cv_status::no_timeout, wait()); 26 EXPECT_EQ(std::cv_status::no_timeout, wait());
27 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 27 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
28 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 28 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
29 29
30 if (cardStatus.cardState == CardState::ABSENT) { 30 if (cardStatus.cardState == CardState::ABSENT) {
31 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 31 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
32 } 32 }
33} 33}
34 34
35/* 35/*
36 * Test IRadio.getVoiceRegistrationState() for the response returned. 36 * Test IRadio.getVoiceRegistrationState() for the response returned.
37 */ 37 */
38TEST_F(RadioHidlTest, getVoiceRegistrationState) { 38TEST_F(RadioHidlTest, getVoiceRegistrationState) {
39 int serial = 1; 39 int serial = GetRandomSerialNumber();
40 40
41 radio->getVoiceRegistrationState(++serial); 41 radio->getVoiceRegistrationState(serial);
42 EXPECT_EQ(std::cv_status::no_timeout, wait()); 42 EXPECT_EQ(std::cv_status::no_timeout, wait());
43 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 43 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
44 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 44 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
45 45
46 if (cardStatus.cardState == CardState::ABSENT) { 46 if (cardStatus.cardState == CardState::ABSENT) {
47 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 47 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
48 } 48 }
49} 49}
50 50
51/* 51/*
52 * Test IRadio.getOperator() for the response returned. 52 * Test IRadio.getOperator() for the response returned.
53 */ 53 */
54TEST_F(RadioHidlTest, getOperator) { 54TEST_F(RadioHidlTest, getOperator) {
55 int serial = 1; 55 int serial = GetRandomSerialNumber();
56 56
57 radio->getOperator(++serial); 57 radio->getOperator(serial);
58 EXPECT_EQ(std::cv_status::no_timeout, wait()); 58 EXPECT_EQ(std::cv_status::no_timeout, wait());
59 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 59 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
60 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 60 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
61 61
62 if (cardStatus.cardState == CardState::ABSENT) { 62 if (cardStatus.cardState == CardState::ABSENT) {
63 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 63 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
64 } 64 }
65} 65}
66 66
67/* 67/*
68 * Test IRadio.setRadioPower() for the response returned. 68 * Test IRadio.setRadioPower() for the response returned.
69 */ 69 */
70TEST_F(RadioHidlTest, setRadioPower) { 70TEST_F(RadioHidlTest, setRadioPower) {
71 int serial = 1; 71 int serial = GetRandomSerialNumber();
72 72
73 radio->setRadioPower(++serial, 0); 73 radio->setRadioPower(serial, 0);
74 EXPECT_EQ(std::cv_status::no_timeout, wait()); 74 EXPECT_EQ(std::cv_status::no_timeout, wait());
75 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 75 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
76 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 76 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
77 77
78 if (cardStatus.cardState == CardState::ABSENT) { 78 if (cardStatus.cardState == CardState::ABSENT) {
79 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 79 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
80 } 80 }
81} 81}
82 82
83/* 83/*
84 * Test IRadio.getNetworkSelectionMode() for the response returned. 84 * Test IRadio.getNetworkSelectionMode() for the response returned.
85 */ 85 */
86TEST_F(RadioHidlTest, getNetworkSelectionMode) { 86TEST_F(RadioHidlTest, getNetworkSelectionMode) {
87 int serial = 1; 87 int serial = GetRandomSerialNumber();
88 88
89 radio->getNetworkSelectionMode(++serial); 89 radio->getNetworkSelectionMode(serial);
90 EXPECT_EQ(std::cv_status::no_timeout, wait()); 90 EXPECT_EQ(std::cv_status::no_timeout, wait());
91 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 91 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
92 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 92 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
93 93
94 if (cardStatus.cardState == CardState::ABSENT) { 94 if (cardStatus.cardState == CardState::ABSENT) {
95 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 95 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
96 } 96 }
97} 97}
98 98
99/* 99/*
100 * Test IRadio.setNetworkSelectionModeAutomatic() for the response returned. 100 * Test IRadio.setNetworkSelectionModeAutomatic() for the response returned.
101 */ 101 */
102TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) { 102TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) {
103 int serial = 1; 103 int serial = GetRandomSerialNumber();
104 104
105 radio->setNetworkSelectionModeAutomatic(++serial); 105 radio->setNetworkSelectionModeAutomatic(serial);
106 EXPECT_EQ(std::cv_status::no_timeout, wait()); 106 EXPECT_EQ(std::cv_status::no_timeout, wait());
107 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 107 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
108 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 108 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
109 109
110 if (cardStatus.cardState == CardState::ABSENT) { 110 if (cardStatus.cardState == CardState::ABSENT) {
111 ASSERT_TRUE(CheckGeneralError() || 111 ASSERT_TRUE(CheckGeneralError() ||
112 radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME || 112 radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME ||
113 radioRsp->rspInfo.error == RadioError::NONE || 113 radioRsp->rspInfo.error == RadioError::NONE ||
114 radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED); 114 radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
115 } 115 }
116} 116}
117 117
118/* 118/*
119 * Test IRadio.setNetworkSelectionModeManual() for the response returned. 119 * Test IRadio.setNetworkSelectionModeManual() for the response returned.
120 */ 120 */
121TEST_F(RadioHidlTest, setNetworkSelectionModeManual) { 121TEST_F(RadioHidlTest, setNetworkSelectionModeManual) {
122 int serial = 1; 122 int serial = GetRandomSerialNumber();
123 123
124 radio->setNetworkSelectionModeManual(++serial, "123456"); 124 radio->setNetworkSelectionModeManual(serial, "123456");
125 EXPECT_EQ(std::cv_status::no_timeout, wait()); 125 EXPECT_EQ(std::cv_status::no_timeout, wait());
126 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 126 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
127 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 127 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
128 128
129 if (cardStatus.cardState == CardState::ABSENT) { 129 if (cardStatus.cardState == CardState::ABSENT) {
130 ASSERT_TRUE(CheckGeneralError() || 130 ASSERT_TRUE(CheckGeneralError() ||
131 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 131 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
132 radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME || 132 radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME ||
133 radioRsp->rspInfo.error == RadioError::NONE || 133 radioRsp->rspInfo.error == RadioError::NONE ||
134 radioRsp->rspInfo.error == RadioError::INVALID_STATE); 134 radioRsp->rspInfo.error == RadioError::INVALID_STATE);
135 } 135 }
136} 136}
137 137
138/* 138/*
139 * Test IRadio.getAvailableNetworks() for the response returned. 139 * Test IRadio.getAvailableNetworks() for the response returned.
140 */ 140 */
141TEST_F(RadioHidlTest, getAvailableNetworks) { 141TEST_F(RadioHidlTest, getAvailableNetworks) {
142 int serial = 1; 142 int serial = GetRandomSerialNumber();
143 143
144 radio->getAvailableNetworks(++serial); 144 radio->getAvailableNetworks(serial);
145 EXPECT_EQ(std::cv_status::no_timeout, wait()); 145 EXPECT_EQ(std::cv_status::no_timeout, wait());
146 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 146 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
147 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 147 ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
148 radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
148 149
149 if (cardStatus.cardState == CardState::ABSENT) { 150 if (cardStatus.cardState == CardState::ABSENT) {
150 ASSERT_TRUE(CheckGeneralError() || 151 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
151 radioRsp->rspInfo.error == RadioError::NONE || 152 radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
152 radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE || 153 radioRsp->rspInfo.error == RadioError::CANCELLED ||
153 radioRsp->rspInfo.error == RadioError::CANCELLED || 154 radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED ||
154 radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED); 155 radioRsp->rspInfo.error == RadioError::MODEM_ERR);
155 } 156 }
156} 157}
157 158
158/* 159/*
159 * Test IRadio.getBasebandVersion() for the response returned. 160 * Test IRadio.getBasebandVersion() for the response returned.
160 */ 161 */
161TEST_F(RadioHidlTest, getBasebandVersion) { 162TEST_F(RadioHidlTest, getBasebandVersion) {
162 int serial = 1; 163 int serial = GetRandomSerialNumber();
163 164
164 radio->getBasebandVersion(++serial); 165 radio->getBasebandVersion(serial);
165 EXPECT_EQ(std::cv_status::no_timeout, wait()); 166 EXPECT_EQ(std::cv_status::no_timeout, wait());
166 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 167 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
167 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 168 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
168 169
169 if (cardStatus.cardState == CardState::ABSENT) { 170 if (cardStatus.cardState == CardState::ABSENT) {
170 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 171 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
171 } 172 }
172} 173}
173 174
174/* 175/*
175 * Test IRadio.setBandMode() for the response returned. 176 * Test IRadio.setBandMode() for the response returned.
176 */ 177 */
177TEST_F(RadioHidlTest, setBandMode) { 178TEST_F(RadioHidlTest, setBandMode) {
178 int serial = 1; 179 int serial = GetRandomSerialNumber();
179 180
180 radio->setBandMode(++serial, RadioBandMode::BAND_MODE_USA); 181 radio->setBandMode(serial, RadioBandMode::BAND_MODE_USA);
181 EXPECT_EQ(std::cv_status::no_timeout, wait()); 182 EXPECT_EQ(std::cv_status::no_timeout, wait());
182 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 183 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
183 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 184 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
184 185
185 if (cardStatus.cardState == CardState::ABSENT) { 186 if (cardStatus.cardState == CardState::ABSENT) {
186 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 187 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
187 } 188 }
188} 189}
189 190
190/* 191/*
191 * Test IRadio.getAvailableBandModes() for the response returned. 192 * Test IRadio.getAvailableBandModes() for the response returned.
192 */ 193 */
193TEST_F(RadioHidlTest, getAvailableBandModes) { 194TEST_F(RadioHidlTest, getAvailableBandModes) {
194 int serial = 1; 195 int serial = GetRandomSerialNumber();
195 196
196 radio->getAvailableBandModes(++serial); 197 radio->getAvailableBandModes(serial);
197 EXPECT_EQ(std::cv_status::no_timeout, wait()); 198 EXPECT_EQ(std::cv_status::no_timeout, wait());
198 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 199 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
199 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 200 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
200 201
201 if (cardStatus.cardState == CardState::ABSENT) { 202 if (cardStatus.cardState == CardState::ABSENT) {
202 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 203 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
203 } 204 }
204} 205}
205 206
206/* 207/*
207 * Test IRadio.setPreferredNetworkType() for the response returned. 208 * Test IRadio.setPreferredNetworkType() for the response returned.
208 */ 209 */
209TEST_F(RadioHidlTest, setPreferredNetworkType) { 210TEST_F(RadioHidlTest, setPreferredNetworkType) {
210 int serial = 1; 211 int serial = GetRandomSerialNumber();
211 212
212 radio->setPreferredNetworkType(++serial, PreferredNetworkType::GSM_ONLY); 213 radio->setPreferredNetworkType(serial, PreferredNetworkType::GSM_ONLY);
213 EXPECT_EQ(std::cv_status::no_timeout, wait()); 214 EXPECT_EQ(std::cv_status::no_timeout, wait());
214 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 215 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
215 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 216 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
216 217
217 if (cardStatus.cardState == CardState::ABSENT) { 218 if (cardStatus.cardState == CardState::ABSENT) {
218 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 219 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
219 } 220 }
220} 221}
221 222
222/* 223/*
223 * Test IRadio.getPreferredNetworkType() for the response returned. 224 * Test IRadio.getPreferredNetworkType() for the response returned.
224 */ 225 */
225TEST_F(RadioHidlTest, getPreferredNetworkType) { 226TEST_F(RadioHidlTest, getPreferredNetworkType) {
226 int serial = 1; 227 int serial = GetRandomSerialNumber();
227 228
228 radio->getPreferredNetworkType(++serial); 229 radio->getPreferredNetworkType(serial);
229 EXPECT_EQ(std::cv_status::no_timeout, wait()); 230 EXPECT_EQ(std::cv_status::no_timeout, wait());
230 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 231 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
231 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 232 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
232 233
233 if (cardStatus.cardState == CardState::ABSENT) { 234 if (cardStatus.cardState == CardState::ABSENT) {
234 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 235 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
235 } 236 }
236} 237}
237 238
238/* 239/*
239 * Test IRadio.getNeighboringCids() for the response returned. 240 * Test IRadio.getNeighboringCids() for the response returned.
240 */ 241 */
241TEST_F(RadioHidlTest, getNeighboringCids) { 242TEST_F(RadioHidlTest, getNeighboringCids) {
242 int serial = 1; 243 int serial = GetRandomSerialNumber();
243 244
244 radio->getNeighboringCids(++serial); 245 radio->getNeighboringCids(serial);
245 EXPECT_EQ(std::cv_status::no_timeout, wait()); 246 EXPECT_EQ(std::cv_status::no_timeout, wait());
246 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 247 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
247 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 248 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
248 249
249 if (cardStatus.cardState == CardState::ABSENT) { 250 if (cardStatus.cardState == CardState::ABSENT) {
250 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 251 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
251 } 252 }
252} 253}
253 254
254/* 255/*
255 * Test IRadio.setLocationUpdates() for the response returned. 256 * Test IRadio.setLocationUpdates() for the response returned.
256 */ 257 */
257TEST_F(RadioHidlTest, setLocationUpdates) { 258TEST_F(RadioHidlTest, setLocationUpdates) {
258 int serial = 1; 259 int serial = GetRandomSerialNumber();
259 260
260 radio->setLocationUpdates(++serial, true); 261 radio->setLocationUpdates(serial, true);
261 EXPECT_EQ(std::cv_status::no_timeout, wait()); 262 EXPECT_EQ(std::cv_status::no_timeout, wait());
262 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 263 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
263 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 264 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
264 265
265 if (cardStatus.cardState == CardState::ABSENT) { 266 if (cardStatus.cardState == CardState::ABSENT) {
266 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 267 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
267 } 268 }
268} 269}
269 270
270/* 271/*
271 * Test IRadio.setCdmaRoamingPreference() for the response returned. 272 * Test IRadio.setCdmaRoamingPreference() for the response returned.
272 */ 273 */
273TEST_F(RadioHidlTest, setCdmaRoamingPreference) { 274TEST_F(RadioHidlTest, setCdmaRoamingPreference) {
274 int serial = 1; 275 int serial = GetRandomSerialNumber();
275 276
276 radio->setCdmaRoamingPreference(++serial, CdmaRoamingType::HOME_NETWORK); 277 radio->setCdmaRoamingPreference(serial, CdmaRoamingType::HOME_NETWORK);
277 EXPECT_EQ(std::cv_status::no_timeout, wait()); 278 EXPECT_EQ(std::cv_status::no_timeout, wait());
278 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 279 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
279 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 280 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
280 281
281 if (cardStatus.cardState == CardState::ABSENT) { 282 if (cardStatus.cardState == CardState::ABSENT) {
282 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 283 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
283 } 284 }
284} 285}
285 286
286/* 287/*
287 * Test IRadio.getCdmaRoamingPreference() for the response returned. 288 * Test IRadio.getCdmaRoamingPreference() for the response returned.
288 */ 289 */
289TEST_F(RadioHidlTest, getCdmaRoamingPreference) { 290TEST_F(RadioHidlTest, getCdmaRoamingPreference) {
290 int serial = 1; 291 int serial = GetRandomSerialNumber();
291 292
292 radio->getCdmaRoamingPreference(++serial); 293 radio->getCdmaRoamingPreference(serial);
293 EXPECT_EQ(std::cv_status::no_timeout, wait()); 294 EXPECT_EQ(std::cv_status::no_timeout, wait());
294 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 295 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
295 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 296 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
296 297
297 if (cardStatus.cardState == CardState::ABSENT) { 298 if (cardStatus.cardState == CardState::ABSENT) {
298 ASSERT_TRUE(CheckGeneralError() || 299 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
299 radioRsp->rspInfo.error == RadioError::NONE || 300 radioRsp->rspInfo.error == RadioError::MODEM_ERR);
300 radioRsp->rspInfo.error == RadioError::MODEM_ERR); 301 }
301 }
302} 302}
303 303
304/* 304/*
305 * Test IRadio.getTTYMode() for the response returned. 305 * Test IRadio.getTTYMode() for the response returned.
306 */ 306 */
307TEST_F(RadioHidlTest, getTTYMode) { 307TEST_F(RadioHidlTest, getTTYMode) {
308 int serial = 1; 308 int serial = GetRandomSerialNumber();
309 309
310 radio->getTTYMode(++serial); 310 radio->getTTYMode(serial);
311 EXPECT_EQ(std::cv_status::no_timeout, wait()); 311 EXPECT_EQ(std::cv_status::no_timeout, wait());
312 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 312 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
313 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 313 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
314 314
315 if (cardStatus.cardState == CardState::ABSENT) { 315 if (cardStatus.cardState == CardState::ABSENT) {
316 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 316 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
317 } 317 }
318} 318}
319 319
320/* 320/*
321 * Test IRadio.setTTYMode() for the response returned. 321 * Test IRadio.setTTYMode() for the response returned.
322 */ 322 */
323TEST_F(RadioHidlTest, setTTYMode) { 323TEST_F(RadioHidlTest, setTTYMode) {
324 int serial = 1; 324 int serial = GetRandomSerialNumber();
325 325
326 radio->setTTYMode(++serial, TtyMode::OFF); 326 radio->setTTYMode(serial, TtyMode::OFF);
327 EXPECT_EQ(std::cv_status::no_timeout, wait()); 327 EXPECT_EQ(std::cv_status::no_timeout, wait());
328 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 328 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
329 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 329 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
330 330
331 if (cardStatus.cardState == CardState::ABSENT) { 331 if (cardStatus.cardState == CardState::ABSENT) {
332 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 332 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
333 } 333 }
334} 334}
335 335
336/* 336/*
337 * Test IRadio.setPreferredVoicePrivacy() for the response returned. 337 * Test IRadio.setPreferredVoicePrivacy() for the response returned.
338 */ 338 */
339TEST_F(RadioHidlTest, setPreferredVoicePrivacy) { 339TEST_F(RadioHidlTest, setPreferredVoicePrivacy) {
340 int serial = 1; 340 int serial = GetRandomSerialNumber();
341 341
342 radio->setPreferredVoicePrivacy(++serial, true); 342 radio->setPreferredVoicePrivacy(serial, true);
343 EXPECT_EQ(std::cv_status::no_timeout, wait()); 343 EXPECT_EQ(std::cv_status::no_timeout, wait());
344 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 344 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
345 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 345 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
346 346
347 if (cardStatus.cardState == CardState::ABSENT) { 347 if (cardStatus.cardState == CardState::ABSENT) {
348 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 348 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
349 } 349 }
350} 350}
351 351
352/* 352/*
353 * Test IRadio.getPreferredVoicePrivacy() for the response returned. 353 * Test IRadio.getPreferredVoicePrivacy() for the response returned.
354 */ 354 */
355TEST_F(RadioHidlTest, getPreferredVoicePrivacy) { 355TEST_F(RadioHidlTest, getPreferredVoicePrivacy) {
356 int serial = 1; 356 int serial = GetRandomSerialNumber();
357 357
358 radio->getPreferredVoicePrivacy(++serial); 358 radio->getPreferredVoicePrivacy(serial);
359 EXPECT_EQ(std::cv_status::no_timeout, wait()); 359 EXPECT_EQ(std::cv_status::no_timeout, wait());
360 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 360 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
361 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 361 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
362 362
363 if (cardStatus.cardState == CardState::ABSENT) { 363 if (cardStatus.cardState == CardState::ABSENT) {
364 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 364 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
365 } 365 }
366} 366}
367 367
368/* 368/*
369 * Test IRadio.getCDMASubscription() for the response returned. 369 * Test IRadio.getCDMASubscription() for the response returned.
370 */ 370 */
371TEST_F(RadioHidlTest, getCDMASubscription) { 371TEST_F(RadioHidlTest, getCDMASubscription) {
372 int serial = 1; 372 int serial = GetRandomSerialNumber();
373 373
374 radio->getCDMASubscription(++serial); 374 radio->getCDMASubscription(serial);
375 EXPECT_EQ(std::cv_status::no_timeout, wait()); 375 EXPECT_EQ(std::cv_status::no_timeout, wait());
376 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 376 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
377 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 377 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
378 378
379 if (cardStatus.cardState == CardState::ABSENT) { 379 if (cardStatus.cardState == CardState::ABSENT) {
380 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 380 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
381 } 381 }
382} 382}
383 383
384/* 384/*
385 * Test IRadio.getDeviceIdentity() for the response returned. 385 * Test IRadio.getDeviceIdentity() for the response returned.
386 */ 386 */
387TEST_F(RadioHidlTest, getDeviceIdentity) { 387TEST_F(RadioHidlTest, getDeviceIdentity) {
388 int serial = 1; 388 int serial = GetRandomSerialNumber();
389 389
390 radio->getDeviceIdentity(++serial); 390 radio->getDeviceIdentity(serial);
391 EXPECT_EQ(std::cv_status::no_timeout, wait()); 391 EXPECT_EQ(std::cv_status::no_timeout, wait());
392 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 392 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
393 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 393 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
394 394
395 if (cardStatus.cardState == CardState::ABSENT) { 395 if (cardStatus.cardState == CardState::ABSENT) {
396 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 396 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
397 } 397 }
398} 398}
399 399
400/* 400/*
401 * Test IRadio.exitEmergencyCallbackMode() for the response returned. 401 * Test IRadio.exitEmergencyCallbackMode() for the response returned.
402 */ 402 */
403TEST_F(RadioHidlTest, exitEmergencyCallbackMode) { 403TEST_F(RadioHidlTest, exitEmergencyCallbackMode) {
404 int serial = 1; 404 int serial = GetRandomSerialNumber();
405 405
406 radio->exitEmergencyCallbackMode(++serial); 406 radio->exitEmergencyCallbackMode(serial);
407 EXPECT_EQ(std::cv_status::no_timeout, wait()); 407 EXPECT_EQ(std::cv_status::no_timeout, wait());
408 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 408 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
409 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 409 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
410 410
411 if (cardStatus.cardState == CardState::ABSENT) { 411 if (cardStatus.cardState == CardState::ABSENT) {
412 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 412 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
413 } 413 }
414} 414}
415 415
416/* 416/*
417 * Test IRadio.getCdmaSubscriptionSource() for the response returned. 417 * Test IRadio.getCdmaSubscriptionSource() for the response returned.
418 */ 418 */
419TEST_F(RadioHidlTest, getCdmaSubscriptionSource) { 419TEST_F(RadioHidlTest, getCdmaSubscriptionSource) {
420 int serial = 1; 420 int serial = GetRandomSerialNumber();
421 421
422 radio->getCdmaSubscriptionSource(++serial); 422 radio->getCdmaSubscriptionSource(serial);
423 EXPECT_EQ(std::cv_status::no_timeout, wait()); 423 EXPECT_EQ(std::cv_status::no_timeout, wait());
424 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 424 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
425 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 425 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
426 426
427 if (cardStatus.cardState == CardState::ABSENT) { 427 if (cardStatus.cardState == CardState::ABSENT) {
428 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 428 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
429 } 429 }
430} 430}
431 431
432/* 432/*
433 * Test IRadio.setCdmaSubscriptionSource() for the response returned. 433 * Test IRadio.setCdmaSubscriptionSource() for the response returned.
434 */ 434 */
435TEST_F(RadioHidlTest, setCdmaSubscriptionSource) { 435TEST_F(RadioHidlTest, setCdmaSubscriptionSource) {
436 int serial = 1; 436 int serial = GetRandomSerialNumber();
437 437
438 radio->setCdmaSubscriptionSource(++serial, CdmaSubscriptionSource::RUIM_SIM); 438 radio->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM);
439 EXPECT_EQ(std::cv_status::no_timeout, wait()); 439 EXPECT_EQ(std::cv_status::no_timeout, wait());
440 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 440 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
441 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 441 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
442 442
443 if (cardStatus.cardState == CardState::ABSENT) { 443 if (cardStatus.cardState == CardState::ABSENT) {
444 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SIM_ABSENT || 444 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SIM_ABSENT ||
445 radioRsp->rspInfo.error == 445 radioRsp->rspInfo.error == RadioError::SUBSCRIPTION_NOT_AVAILABLE);
446 RadioError::SUBSCRIPTION_NOT_AVAILABLE); 446 }
447 }
448} 447}
449 448
450/* 449/*
451 * Test IRadio.getVoiceRadioTechnology() for the response returned. 450 * Test IRadio.getVoiceRadioTechnology() for the response returned.
452 */ 451 */
453TEST_F(RadioHidlTest, getVoiceRadioTechnology) { 452TEST_F(RadioHidlTest, getVoiceRadioTechnology) {
454 int serial = 1; 453 int serial = GetRandomSerialNumber();
455 454
456 radio->getVoiceRadioTechnology(++serial); 455 radio->getVoiceRadioTechnology(serial);
457 EXPECT_EQ(std::cv_status::no_timeout, wait()); 456 EXPECT_EQ(std::cv_status::no_timeout, wait());
458 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 457 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
459 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 458 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
460 459
461 if (cardStatus.cardState == CardState::ABSENT) { 460 if (cardStatus.cardState == CardState::ABSENT) {
462 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 461 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
463 } 462 }
464} 463}
465 464
466/* 465/*
467 * Test IRadio.getCellInfoList() for the response returned. 466 * Test IRadio.getCellInfoList() for the response returned.
468 */ 467 */
469TEST_F(RadioHidlTest, getCellInfoList) { 468TEST_F(RadioHidlTest, getCellInfoList) {
470 int serial = 1; 469 int serial = GetRandomSerialNumber();
471 470
472 radio->getCellInfoList(++serial); 471 radio->getCellInfoList(serial);
473 EXPECT_EQ(std::cv_status::no_timeout, wait()); 472 EXPECT_EQ(std::cv_status::no_timeout, wait());
474 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 473 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
475 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 474 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
476 475
477 if (cardStatus.cardState == CardState::ABSENT) { 476 if (cardStatus.cardState == CardState::ABSENT) {
478 ASSERT_TRUE(CheckGeneralError() || 477 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
479 radioRsp->rspInfo.error == RadioError::NONE || 478 radioRsp->rspInfo.error == RadioError::NO_NETWORK_FOUND);
480 radioRsp->rspInfo.error == RadioError::NO_NETWORK_FOUND); 479 }
481 }
482} 480}
483 481
484/* 482/*
485 * Test IRadio.setCellInfoListRate() for the response returned. 483 * Test IRadio.setCellInfoListRate() for the response returned.
486 */ 484 */
487TEST_F(RadioHidlTest, setCellInfoListRate) { 485TEST_F(RadioHidlTest, setCellInfoListRate) {
488 int serial = 1; 486 int serial = GetRandomSerialNumber();
489 487
490 // TODO(sanketpadawe): RIL crashes with value of rate = 10 488 // TODO(sanketpadawe): RIL crashes with value of rate = 10
491 radio->setCellInfoListRate(++serial, 10); 489 radio->setCellInfoListRate(serial, 10);
492 EXPECT_EQ(std::cv_status::no_timeout, wait()); 490 EXPECT_EQ(std::cv_status::no_timeout, wait());
493 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 491 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
494 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 492 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
495 493
496 if (cardStatus.cardState == CardState::ABSENT) { 494 if (cardStatus.cardState == CardState::ABSENT) {
497 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 495 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
498 } 496 }
499} 497}
500 498
501/* 499/*
502 * Test IRadio.nvReadItem() for the response returned. 500 * Test IRadio.nvReadItem() for the response returned.
503 */ 501 */
504TEST_F(RadioHidlTest, nvReadItem) { 502TEST_F(RadioHidlTest, nvReadItem) {
505 int serial = 1; 503 int serial = GetRandomSerialNumber();
506 504
507 radio->nvReadItem(++serial, NvItem::LTE_BAND_ENABLE_25); 505 radio->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25);
508 EXPECT_EQ(std::cv_status::no_timeout, wait()); 506 EXPECT_EQ(std::cv_status::no_timeout, wait());
509 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 507 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
510 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 508 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
511 509
512 if (cardStatus.cardState == CardState::ABSENT) { 510 if (cardStatus.cardState == CardState::ABSENT) {
513 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 511 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
514 } 512 }
515} 513}
516 514
517/* 515/*
518 * Test IRadio.nvWriteItem() for the response returned. 516 * Test IRadio.nvWriteItem() for the response returned.
519 */ 517 */
520TEST_F(RadioHidlTest, nvWriteItem) { 518TEST_F(RadioHidlTest, nvWriteItem) {
521 int serial = 1; 519 int serial = GetRandomSerialNumber();
522 NvWriteItem item; 520 NvWriteItem item;
523 memset(&item, 0, sizeof(item)); 521 memset(&item, 0, sizeof(item));
524 item.value = hidl_string(); 522 item.value = hidl_string();
525 523
526 radio->nvWriteItem(++serial, item); 524 radio->nvWriteItem(serial, item);
527 EXPECT_EQ(std::cv_status::no_timeout, wait()); 525 EXPECT_EQ(std::cv_status::no_timeout, wait());
528 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 526 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
529 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 527 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
530 528
531 if (cardStatus.cardState == CardState::ABSENT) { 529 if (cardStatus.cardState == CardState::ABSENT) {
532 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 530 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
533 } 531 }
534} 532}
535 533
536/* 534/*
537 * Test IRadio.nvWriteCdmaPrl() for the response returned. 535 * Test IRadio.nvWriteCdmaPrl() for the response returned.
538 */ 536 */
539TEST_F(RadioHidlTest, nvWriteCdmaPrl) { 537TEST_F(RadioHidlTest, nvWriteCdmaPrl) {
540 int serial = 1; 538 int serial = GetRandomSerialNumber();
541 std::vector<uint8_t> prl = {1, 2, 3, 4, 5}; 539 std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
542 540
543 radio->nvWriteCdmaPrl(++serial, hidl_vec<uint8_t>(prl)); 541 radio->nvWriteCdmaPrl(serial, hidl_vec<uint8_t>(prl));
544 EXPECT_EQ(std::cv_status::no_timeout, wait()); 542 EXPECT_EQ(std::cv_status::no_timeout, wait());
545 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 543 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
546 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 544 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
547 545
548 if (cardStatus.cardState == CardState::ABSENT) { 546 if (cardStatus.cardState == CardState::ABSENT) {
549 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 547 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
550 } 548 }
551} 549}
552 550
553/* 551/*
554 * Test IRadio.nvResetConfig() for the response returned. 552 * Test IRadio.nvResetConfig() for the response returned.
555 */ 553 */
556TEST_F(RadioHidlTest, nvResetConfig) { 554TEST_F(RadioHidlTest, nvResetConfig) {
557 int serial = 1; 555 int serial = GetRandomSerialNumber();
558 556
559 radio->nvResetConfig(++serial, ResetNvType::RELOAD); 557 radio->nvResetConfig(++serial, ResetNvType::ERASE);
560 EXPECT_EQ(std::cv_status::no_timeout, wait()); 558 EXPECT_EQ(std::cv_status::no_timeout, wait());
561 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 559 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
562 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 560 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
563 561
564 if (cardStatus.cardState == CardState::ABSENT) { 562 if (cardStatus.cardState == CardState::ABSENT) {
565 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 563 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
566 } 564 }
567} 565}
568 566
569/* 567/*
570 * Test IRadio.setUiccSubscription() for the response returned. 568 * Test IRadio.setUiccSubscription() for the response returned.
571 */ 569 */
572TEST_F(RadioHidlTest, setUiccSubscription) { 570TEST_F(RadioHidlTest, setUiccSubscription) {
573 int serial = 1; 571 int serial = GetRandomSerialNumber();
574 SelectUiccSub item; 572 SelectUiccSub item;
575 memset(&item, 0, sizeof(item)); 573 memset(&item, 0, sizeof(item));
576 574
577 radio->setUiccSubscription(++serial, item); 575 radio->setUiccSubscription(serial, item);
578 EXPECT_EQ(std::cv_status::no_timeout, wait()); 576 EXPECT_EQ(std::cv_status::no_timeout, wait());
579 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 577 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
580 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 578 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
581 579
582 if (cardStatus.cardState == CardState::ABSENT) { 580 if (cardStatus.cardState == CardState::ABSENT) {
583 ASSERT_TRUE(CheckGeneralError() || 581 ASSERT_TRUE(CheckGeneralError() ||
584 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 582 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
585 radioRsp->rspInfo.error == RadioError::NONE || 583 radioRsp->rspInfo.error == RadioError::NONE ||
586 radioRsp->rspInfo.error == 584 radioRsp->rspInfo.error == RadioError::SUBSCRIPTION_NOT_SUPPORTED ||
587 RadioError::SUBSCRIPTION_NOT_SUPPORTED || 585 radioRsp->rspInfo.error == RadioError::MODEM_ERR);
588 radioRsp->rspInfo.error == RadioError::MODEM_ERR); 586 }
589 }
590} 587}
591 588
592/* 589/*
593 * Test IRadio.getHardwareConfig() for the response returned. 590 * Test IRadio.getHardwareConfig() for the response returned.
594 */ 591 */
595TEST_F(RadioHidlTest, getHardwareConfig) { 592TEST_F(RadioHidlTest, getHardwareConfig) {
596 int serial = 1; 593 int serial = GetRandomSerialNumber();
597 594
598 radio->getHardwareConfig(++serial); 595 radio->getHardwareConfig(serial);
599 EXPECT_EQ(std::cv_status::no_timeout, wait()); 596 EXPECT_EQ(std::cv_status::no_timeout, wait());
600 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 597 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
601 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 598 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
602 599
603 if (cardStatus.cardState == CardState::ABSENT) { 600 if (cardStatus.cardState == CardState::ABSENT) {
604 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 601 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
605 } 602 }
606} 603}
607 604
608/* 605/*
609 * Test IRadio.requestShutdown() for the response returned. 606 * Test IRadio.requestShutdown() for the response returned.
610 */ 607 */
611TEST_F(RadioHidlTest, requestShutdown) { 608TEST_F(RadioHidlTest, requestShutdown) {
612 int serial = 1; 609 int serial = GetRandomSerialNumber();
613 610
614 radio->requestShutdown(++serial); 611 radio->requestShutdown(serial);
615 EXPECT_EQ(std::cv_status::no_timeout, wait()); 612 EXPECT_EQ(std::cv_status::no_timeout, wait());
616 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 613 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
617 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 614 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
618 615
619 if (cardStatus.cardState == CardState::ABSENT) { 616 if (cardStatus.cardState == CardState::ABSENT) {
620 ASSERT_TRUE(CheckGeneralError() || 617 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE);
621 radioRsp->rspInfo.error == RadioError::NONE); 618 }
622 }
623} 619}
624 620
625/* 621/*
626 * Test IRadio.getRadioCapability() for the response returned. 622 * Test IRadio.getRadioCapability() for the response returned.
627 */ 623 */
628TEST_F(RadioHidlTest, getRadioCapability) { 624TEST_F(RadioHidlTest, getRadioCapability) {
629 int serial = 1; 625 int serial = GetRandomSerialNumber();
630 626
631 radio->getRadioCapability(++serial); 627 radio->getRadioCapability(serial);
632 EXPECT_EQ(std::cv_status::no_timeout, wait()); 628 EXPECT_EQ(std::cv_status::no_timeout, wait());
633 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 629 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
634 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 630 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
635 631
636 if (cardStatus.cardState == CardState::ABSENT) { 632 if (cardStatus.cardState == CardState::ABSENT) {
637 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 633 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
638 } 634 }
639} 635}
640 636
641/* 637/*
642 * Test IRadio.setRadioCapability() for the response returned. 638 * Test IRadio.setRadioCapability() for the response returned.
643 */ 639 */
644TEST_F(RadioHidlTest, setRadioCapability) { 640TEST_F(RadioHidlTest, setRadioCapability) {
645 int serial = 1; 641 int serial = GetRandomSerialNumber();
646 RadioCapability rc; 642 RadioCapability rc;
647 memset(&rc, 0, sizeof(rc)); 643 memset(&rc, 0, sizeof(rc));
648 rc.logicalModemUuid = hidl_string(); 644 rc.logicalModemUuid = hidl_string();
649 645
650 radio->setRadioCapability(++serial, rc); 646 radio->setRadioCapability(serial, rc);
651 EXPECT_EQ(std::cv_status::no_timeout, wait()); 647 EXPECT_EQ(std::cv_status::no_timeout, wait());
652 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 648 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
653 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 649 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
654 650
655 if (cardStatus.cardState == CardState::ABSENT) { 651 if (cardStatus.cardState == CardState::ABSENT) {
656 ASSERT_TRUE(CheckGeneralError() || 652 ASSERT_TRUE(CheckGeneralError() ||
657 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 653 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
658 radioRsp->rspInfo.error == RadioError::INVALID_STATE); 654 radioRsp->rspInfo.error == RadioError::INVALID_STATE);
659 } 655 }
660} 656}
661 657
662/* 658/*
663 * Test IRadio.startLceService() for the response returned. 659 * Test IRadio.startLceService() for the response returned.
664 */ 660 */
665TEST_F(RadioHidlTest, startLceService) { 661TEST_F(RadioHidlTest, startLceService) {
666 int serial = 1; 662 int serial = GetRandomSerialNumber();
667 663
668 radio->startLceService(++serial, 5, true); 664 radio->startLceService(serial, 5, true);
669 EXPECT_EQ(std::cv_status::no_timeout, wait()); 665 EXPECT_EQ(std::cv_status::no_timeout, wait());
670 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 666 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
671 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 667 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
672 668
673 if (cardStatus.cardState == CardState::ABSENT) { 669 if (cardStatus.cardState == CardState::ABSENT) {
674 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE || 670 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
675 radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED || 671 radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
676 radioRsp->rspInfo.error == RadioError::INTERNAL_ERR); 672 radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
677 } 673 }
678} 674}
679 675
680/* 676/*
681 * Test IRadio.stopLceService() for the response returned. 677 * Test IRadio.stopLceService() for the response returned.
682 */ 678 */
683TEST_F(RadioHidlTest, stopLceService) { 679TEST_F(RadioHidlTest, stopLceService) {
684 int serial = 1; 680 int serial = GetRandomSerialNumber();
685 681
686 radio->stopLceService(++serial); 682 radio->stopLceService(serial);
687 EXPECT_EQ(std::cv_status::no_timeout, wait()); 683 EXPECT_EQ(std::cv_status::no_timeout, wait());
688 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 684 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
689 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 685 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
690 686
691 if (cardStatus.cardState == CardState::ABSENT) { 687 if (cardStatus.cardState == CardState::ABSENT) {
692 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE || 688 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
693 radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED); 689 radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
694 } 690 }
695} 691}
696 692
697/* 693/*
698 * Test IRadio.pullLceData() for the response returned. 694 * Test IRadio.pullLceData() for the response returned.
699 */ 695 */
700TEST_F(RadioHidlTest, pullLceData) { 696TEST_F(RadioHidlTest, pullLceData) {
701 int serial = 1; 697 int serial = GetRandomSerialNumber();
702 698
703 radio->pullLceData(++serial); 699 radio->pullLceData(serial);
704 EXPECT_EQ(std::cv_status::no_timeout, wait()); 700 EXPECT_EQ(std::cv_status::no_timeout, wait());
705 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 701 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
706 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 702 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
707 703
708 if (cardStatus.cardState == CardState::ABSENT) { 704 if (cardStatus.cardState == CardState::ABSENT) {
709 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE || 705 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE || CheckOEMError());
710 CheckOEMError()); 706 }
711 }
712} 707}
713 708
714/* 709/*
715 * Test IRadio.getModemActivityInfo() for the response returned. 710 * Test IRadio.getModemActivityInfo() for the response returned.
716 */ 711 */
717TEST_F(RadioHidlTest, getModemActivityInfo) { 712TEST_F(RadioHidlTest, getModemActivityInfo) {
718 int serial = 1; 713 int serial = GetRandomSerialNumber();
719 714
720 radio->getModemActivityInfo(++serial); 715 radio->getModemActivityInfo(serial);
721 EXPECT_EQ(std::cv_status::no_timeout, wait()); 716 EXPECT_EQ(std::cv_status::no_timeout, wait());
722 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 717 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
723 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 718 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
724 719
725 if (cardStatus.cardState == CardState::ABSENT) { 720 if (cardStatus.cardState == CardState::ABSENT) {
726 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 721 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
727 } 722 }
728} 723}
729 724
730/* 725/*
731 * Test IRadio.setAllowedCarriers() for the response returned. 726 * Test IRadio.setAllowedCarriers() for the response returned.
732 */ 727 */
733TEST_F(RadioHidlTest, setAllowedCarriers) { 728TEST_F(RadioHidlTest, setAllowedCarriers) {
734 int serial = 1; 729 int serial = GetRandomSerialNumber();
735 CarrierRestrictions carriers; 730 CarrierRestrictions carriers;
736 memset(&carriers, 0, sizeof(carriers)); 731 memset(&carriers, 0, sizeof(carriers));
737 carriers.allowedCarriers.resize(1); 732 carriers.allowedCarriers.resize(1);
738 carriers.excludedCarriers.resize(0); 733 carriers.excludedCarriers.resize(0);
739 carriers.allowedCarriers[0].mcc = hidl_string(); 734 carriers.allowedCarriers[0].mcc = hidl_string();
740 carriers.allowedCarriers[0].mnc = hidl_string(); 735 carriers.allowedCarriers[0].mnc = hidl_string();
741 carriers.allowedCarriers[0].matchType = CarrierMatchType::ALL; 736 carriers.allowedCarriers[0].matchType = CarrierMatchType::ALL;
742 carriers.allowedCarriers[0].matchData = hidl_string(); 737 carriers.allowedCarriers[0].matchData = hidl_string();
743 738
744 radio->setAllowedCarriers(++serial, false, carriers); 739 radio->setAllowedCarriers(serial, false, carriers);
745 EXPECT_EQ(std::cv_status::no_timeout, wait()); 740 EXPECT_EQ(std::cv_status::no_timeout, wait());
746 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 741 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
747 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 742 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
748 743
749 if (cardStatus.cardState == CardState::ABSENT) { 744 if (cardStatus.cardState == CardState::ABSENT) {
750 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 745 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
751 } 746 }
747
748 /* Reset back to no carrier restriction */
749 memset(&carriers, 0, sizeof(carriers));
750 carriers.allowedCarriers.resize(0);
751 carriers.excludedCarriers.resize(0);
752
753 radio->setAllowedCarriers(++serial, true, carriers);
754 EXPECT_EQ(std::cv_status::no_timeout, wait());
755 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
756 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
757
758 if (cardStatus.cardState == CardState::ABSENT) {
759 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
760 }
752} 761}
753 762
754/* 763/*
755 * Test IRadio.getAllowedCarriers() for the response returned. 764 * Test IRadio.getAllowedCarriers() for the response returned.
756 */ 765 */
757TEST_F(RadioHidlTest, getAllowedCarriers) { 766TEST_F(RadioHidlTest, getAllowedCarriers) {
758 int serial = 1; 767 int serial = GetRandomSerialNumber();
759 768
760 radio->getAllowedCarriers(++serial); 769 radio->getAllowedCarriers(serial);
761 EXPECT_EQ(std::cv_status::no_timeout, wait()); 770 EXPECT_EQ(std::cv_status::no_timeout, wait());
762 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 771 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
763 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 772 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
764 773
765 if (cardStatus.cardState == CardState::ABSENT) { 774 if (cardStatus.cardState == CardState::ABSENT) {
766 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE); 775 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
767 } 776 }
768} 777}
769 778
770/* 779/*
771 * Test IRadio.sendDeviceState() for the response returned. 780 * Test IRadio.sendDeviceState() for the response returned.
772 */ 781 */
773TEST_F(RadioHidlTest, sendDeviceState) { 782TEST_F(RadioHidlTest, sendDeviceState) {
774 int serial = 1; 783 int serial = GetRandomSerialNumber();
775 784
776 radio->sendDeviceState(++serial, DeviceStateType::POWER_SAVE_MODE, true); 785 radio->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true);
777 EXPECT_EQ(std::cv_status::no_timeout, wait()); 786 EXPECT_EQ(std::cv_status::no_timeout, wait());
778 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 787 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
779 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 788 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
780 789
781 if (cardStatus.cardState == CardState::ABSENT) { 790 if (cardStatus.cardState == CardState::ABSENT) {
782 ASSERT_TRUE(CheckGeneralError() || 791 ASSERT_TRUE(CheckGeneralError() ||
783 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS); 792 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
784 } 793 }
785} 794}
786 795
787/* 796/*
788 * Test IRadio.setIndicationFilter() for the response returned. 797 * Test IRadio.setIndicationFilter() for the response returned.
789 */ 798 */
790TEST_F(RadioHidlTest, setIndicationFilter) { 799TEST_F(RadioHidlTest, setIndicationFilter) {
791 int serial = 1; 800 int serial = GetRandomSerialNumber();
792 801
793 radio->setIndicationFilter(++serial, 1); 802 radio->setIndicationFilter(serial, 1);
794 EXPECT_EQ(std::cv_status::no_timeout, wait()); 803 EXPECT_EQ(std::cv_status::no_timeout, wait());
795 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 804 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
796 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 805 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
797 806
798 if (cardStatus.cardState == CardState::ABSENT) { 807 if (cardStatus.cardState == CardState::ABSENT) {
799 ASSERT_TRUE(CheckGeneralError() || 808 ASSERT_TRUE(CheckGeneralError() ||
800 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS); 809 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
801 } 810 }
802} 811}
803 812
804/* 813/*
805 * Test IRadio.setSimCardPower() for the response returned. 814 * Test IRadio.setSimCardPower() for the response returned.
806 */ 815 */
807TEST_F(RadioHidlTest, setSimCardPower) { 816TEST_F(RadioHidlTest, setSimCardPower) {
808 int serial = 1; 817 int serial = GetRandomSerialNumber();
809 818
810 radio->setSimCardPower(++serial, true); 819 radio->setSimCardPower(serial, true);
811 EXPECT_EQ(std::cv_status::no_timeout, wait()); 820 EXPECT_EQ(std::cv_status::no_timeout, wait());
812 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 821 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
813 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 822 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
814 823
815 if (cardStatus.cardState == CardState::ABSENT) { 824 if (cardStatus.cardState == CardState::ABSENT) {
816 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE || 825 ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
817 radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED); 826 radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
818 } 827 }
819} \ No newline at end of file 828} \ No newline at end of file
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
index b8a50c0c..698cf26d 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
@@ -22,417 +22,412 @@ using namespace ::android::hardware::radio::V1_0;
22 * Test IRadio.sendSms() for the response returned. 22 * Test IRadio.sendSms() for the response returned.
23 */ 23 */
24TEST_F(RadioHidlTest, sendSms) { 24TEST_F(RadioHidlTest, sendSms) {
25 int serial = 0; 25 int serial = GetRandomSerialNumber();
26 GsmSmsMessage msg; 26 GsmSmsMessage msg;
27 msg.smscPdu = ""; 27 msg.smscPdu = "";
28 msg.pdu = "01000b916105770203f3000006d4f29c3e9b01"; 28 msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
29 29
30 radio->sendSms(++serial, msg); 30 radio->sendSms(serial, msg);
31 31
32 EXPECT_EQ(std::cv_status::no_timeout, wait()); 32 EXPECT_EQ(std::cv_status::no_timeout, wait());
33 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 33 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
34 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 34 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
35 35
36 if (cardStatus.cardState == CardState::ABSENT) { 36 if (cardStatus.cardState == CardState::ABSENT) {
37 ASSERT_TRUE(CheckGeneralError() || 37 ASSERT_TRUE(CheckGeneralError() ||
38 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 38 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
39 radioRsp->rspInfo.error == RadioError::INVALID_STATE); 39 radioRsp->rspInfo.error == RadioError::INVALID_STATE);
40 EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode); 40 EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
41 } 41 }
42} 42}
43 43
44/* 44/*
45 * Test IRadio.sendSMSExpectMore() for the response returned. 45 * Test IRadio.sendSMSExpectMore() for the response returned.
46 */ 46 */
47TEST_F(RadioHidlTest, sendSMSExpectMore) { 47TEST_F(RadioHidlTest, sendSMSExpectMore) {
48 int serial = 0; 48 int serial = GetRandomSerialNumber();
49 GsmSmsMessage msg; 49 GsmSmsMessage msg;
50 msg.smscPdu = ""; 50 msg.smscPdu = "";
51 msg.pdu = "01000b916105770203f3000006d4f29c3e9b01"; 51 msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
52 52
53 radio->sendSMSExpectMore(++serial, msg); 53 radio->sendSMSExpectMore(serial, msg);
54 54
55 // TODO(shuoq): add more test for this API when inserted sim card is 55 // TODO(shuoq): add more test for this API when inserted sim card is
56 // considered 56 // considered
57 57
58 EXPECT_EQ(std::cv_status::no_timeout, wait()); 58 EXPECT_EQ(std::cv_status::no_timeout, wait());
59 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 59 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
60 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 60 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
61 61
62 if (cardStatus.cardState == CardState::ABSENT) { 62 if (cardStatus.cardState == CardState::ABSENT) {
63 ASSERT_TRUE(CheckGeneralError() || 63 ASSERT_TRUE(CheckGeneralError() ||
64 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 64 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
65 radioRsp->rspInfo.error == RadioError::INVALID_STATE); 65 radioRsp->rspInfo.error == RadioError::INVALID_STATE);
66 } 66 }
67} 67}
68 68
69/* 69/*
70 * Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned. 70 * Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned.
71 */ 71 */
72TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) { 72TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) {
73 int serial = 0; 73 int serial = GetRandomSerialNumber();
74 bool success = true; 74 bool success = true;
75 75
76 radio->acknowledgeLastIncomingGsmSms( 76 radio->acknowledgeLastIncomingGsmSms(serial, success,
77 ++serial, success, SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED); 77 SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
78 78
79 EXPECT_EQ(std::cv_status::no_timeout, wait()); 79 EXPECT_EQ(std::cv_status::no_timeout, wait());
80 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 80 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
81 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 81 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
82 82
83 if (cardStatus.cardState == CardState::ABSENT) { 83 if (cardStatus.cardState == CardState::ABSENT) {
84 ASSERT_TRUE(CheckGeneralError() || 84 ASSERT_TRUE(CheckGeneralError() ||
85 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 85 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
86 radioRsp->rspInfo.error == RadioError::INVALID_STATE); 86 radioRsp->rspInfo.error == RadioError::INVALID_STATE);
87 } 87 }
88} 88}
89 89
90/* 90/*
91 * Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned. 91 * Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
92 */ 92 */
93TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) { 93TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) {
94 int serial = 0; 94 int serial = GetRandomSerialNumber();
95 bool success = true; 95 bool success = true;
96 std::string ackPdu = ""; 96 std::string ackPdu = "";
97 97
98 radio->acknowledgeIncomingGsmSmsWithPdu(++serial, success, ackPdu); 98 radio->acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
99 99
100 EXPECT_EQ(std::cv_status::no_timeout, wait()); 100 EXPECT_EQ(std::cv_status::no_timeout, wait());
101 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 101 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
102 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 102 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
103 103
104 if (cardStatus.cardState == CardState::ABSENT) { 104 if (cardStatus.cardState == CardState::ABSENT) {
105 // TODO(shuoq): Will add error check when we know the expected error from QC 105 // TODO(shuoq): Will add error check when we know the expected error from QC
106 } 106 }
107} 107}
108 108
109/* 109/*
110 * Test IRadio.sendCdmaSms() for the response returned. 110 * Test IRadio.sendCdmaSms() for the response returned.
111 */ 111 */
112TEST_F(RadioHidlTest, sendCdmaSms) { 112TEST_F(RadioHidlTest, sendCdmaSms) {
113 int serial = 0; 113 int serial = GetRandomSerialNumber();
114 114
115 // Create a CdmaSmsAddress 115 // Create a CdmaSmsAddress
116 CdmaSmsAddress cdmaSmsAddress; 116 CdmaSmsAddress cdmaSmsAddress;
117 cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT; 117 cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
118 cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK; 118 cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
119 cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN; 119 cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
120 cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN; 120 cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
121 cdmaSmsAddress.digits = 121 cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
122 (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3}; 122
123 123 // Create a CdmaSmsSubAddress
124 // Create a CdmaSmsSubAddress 124 CdmaSmsSubaddress cdmaSmsSubaddress;
125 CdmaSmsSubaddress cdmaSmsSubaddress; 125 cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
126 cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP; 126 cdmaSmsSubaddress.odd = false;
127 cdmaSmsSubaddress.odd = false; 127 cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
128 cdmaSmsSubaddress.digits = (std::vector<uint8_t>){}; 128
129 129 // Create a CdmaSmsMessage
130 // Create a CdmaSmsMessage 130 android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
131 android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage; 131 cdmaSmsMessage.teleserviceId = 4098;
132 cdmaSmsMessage.teleserviceId = 4098; 132 cdmaSmsMessage.isServicePresent = false;
133 cdmaSmsMessage.isServicePresent = false; 133 cdmaSmsMessage.serviceCategory = 0;
134 cdmaSmsMessage.serviceCategory = 0; 134 cdmaSmsMessage.address = cdmaSmsAddress;
135 cdmaSmsMessage.address = cdmaSmsAddress; 135 cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
136 cdmaSmsMessage.subAddress = cdmaSmsSubaddress; 136 cdmaSmsMessage.bearerData =
137 cdmaSmsMessage.bearerData = (std::vector<uint8_t>){ 137 (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
138 15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0}; 138
139 139 radio->sendCdmaSms(serial, cdmaSmsMessage);
140 radio->sendCdmaSms(++serial, cdmaSmsMessage); 140
141 141 EXPECT_EQ(std::cv_status::no_timeout, wait());
142 EXPECT_EQ(std::cv_status::no_timeout, wait()); 142 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
143 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 143 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
144 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 144
145 145 if (cardStatus.cardState == CardState::ABSENT) {
146 if (cardStatus.cardState == CardState::ABSENT) { 146 ASSERT_TRUE(CheckGeneralError() ||
147 ASSERT_TRUE(CheckGeneralError() || 147 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
148 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 148 radioRsp->rspInfo.error == RadioError::INVALID_STATE);
149 radioRsp->rspInfo.error == RadioError::INVALID_STATE); 149 }
150 }
151} 150}
152 151
153/* 152/*
154 * Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned. 153 * Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned.
155 */ 154 */
156TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) { 155TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) {
157 int serial = 0; 156 int serial = GetRandomSerialNumber();
158 157
159 // Create a CdmaSmsAck 158 // Create a CdmaSmsAck
160 CdmaSmsAck cdmaSmsAck; 159 CdmaSmsAck cdmaSmsAck;
161 cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR; 160 cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR;
162 cdmaSmsAck.smsCauseCode = 1; 161 cdmaSmsAck.smsCauseCode = 1;
163 162
164 radio->acknowledgeLastIncomingCdmaSms(++serial, cdmaSmsAck); 163 radio->acknowledgeLastIncomingCdmaSms(serial, cdmaSmsAck);
165 164
166 EXPECT_EQ(std::cv_status::no_timeout, wait()); 165 EXPECT_EQ(std::cv_status::no_timeout, wait());
167 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 166 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
168 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 167 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
169 168
170 if (cardStatus.cardState == CardState::ABSENT) { 169 if (cardStatus.cardState == CardState::ABSENT) {
171 ASSERT_TRUE(CheckGeneralError() || 170 ASSERT_TRUE(CheckGeneralError() ||
172 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 171 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
173 radioRsp->rspInfo.error == RadioError::NO_SMS_TO_ACK); 172 radioRsp->rspInfo.error == RadioError::NO_SMS_TO_ACK);
174 } 173 }
175} 174}
176 175
177/* 176/*
178 * Test IRadio.sendImsSms() for the response returned. 177 * Test IRadio.sendImsSms() for the response returned.
179 */ 178 */
180TEST_F(RadioHidlTest, sendImsSms) { 179TEST_F(RadioHidlTest, sendImsSms) {
181 int serial = 1; 180 int serial = GetRandomSerialNumber();
182 181
183 // Create a CdmaSmsAddress 182 // Create a CdmaSmsAddress
184 CdmaSmsAddress cdmaSmsAddress; 183 CdmaSmsAddress cdmaSmsAddress;
185 cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT; 184 cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
186 cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK; 185 cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
187 cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN; 186 cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
188 cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN; 187 cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
189 cdmaSmsAddress.digits = 188 cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
190 (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3}; 189
191 190 // Create a CdmaSmsSubAddress
192 // Create a CdmaSmsSubAddress 191 CdmaSmsSubaddress cdmaSmsSubaddress;
193 CdmaSmsSubaddress cdmaSmsSubaddress; 192 cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
194 cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP; 193 cdmaSmsSubaddress.odd = false;
195 cdmaSmsSubaddress.odd = false; 194 cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
196 cdmaSmsSubaddress.digits = (std::vector<uint8_t>){}; 195
197 196 // Create a CdmaSmsMessage
198 // Create a CdmaSmsMessage 197 CdmaSmsMessage cdmaSmsMessage;
199 CdmaSmsMessage cdmaSmsMessage; 198 cdmaSmsMessage.teleserviceId = 4098;
200 cdmaSmsMessage.teleserviceId = 4098; 199 cdmaSmsMessage.isServicePresent = false;
201 cdmaSmsMessage.isServicePresent = false; 200 cdmaSmsMessage.serviceCategory = 0;
202 cdmaSmsMessage.serviceCategory = 0; 201 cdmaSmsMessage.address = cdmaSmsAddress;
203 cdmaSmsMessage.address = cdmaSmsAddress; 202 cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
204 cdmaSmsMessage.subAddress = cdmaSmsSubaddress; 203 cdmaSmsMessage.bearerData =
205 cdmaSmsMessage.bearerData = (std::vector<uint8_t>){ 204 (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
206 15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0}; 205
207 206 // Creata an ImsSmsMessage
208 // Creata an ImsSmsMessage 207 ImsSmsMessage msg;
209 ImsSmsMessage msg; 208 msg.tech = RadioTechnologyFamily::THREE_GPP2;
210 msg.tech = RadioTechnologyFamily::THREE_GPP2; 209 msg.retry = false;
211 msg.retry = false; 210 msg.messageRef = 0;
212 msg.messageRef = 0; 211 msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage};
213 msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage}; 212 msg.gsmMessage = (std::vector<GsmSmsMessage>){};
214 msg.gsmMessage = (std::vector<GsmSmsMessage>){}; 213
215 214 radio->sendImsSms(serial, msg);
216 radio->sendImsSms(serial, msg); 215
217 216 EXPECT_EQ(std::cv_status::no_timeout, wait());
218 EXPECT_EQ(std::cv_status::no_timeout, wait()); 217 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
219 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 218 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
220 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 219
221 220 if (cardStatus.cardState == CardState::ABSENT) {
222 if (cardStatus.cardState == CardState::ABSENT) { 221 ASSERT_TRUE(CheckGeneralError() ||
223 ASSERT_TRUE(CheckGeneralError() || 222 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
224 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS); 223 }
225 }
226} 224}
227 225
228/* 226/*
229 * Test IRadio.getSmscAddress() for the response returned. 227 * Test IRadio.getSmscAddress() for the response returned.
230 */ 228 */
231TEST_F(RadioHidlTest, getSmscAddress) { 229TEST_F(RadioHidlTest, getSmscAddress) {
232 int serial = 0; 230 int serial = GetRandomSerialNumber();
233 231
234 radio->getSmscAddress(++serial); 232 radio->getSmscAddress(serial);
235 233
236 EXPECT_EQ(std::cv_status::no_timeout, wait()); 234 EXPECT_EQ(std::cv_status::no_timeout, wait());
237 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 235 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
238 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 236 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
239 237
240 if (cardStatus.cardState == CardState::ABSENT) { 238 if (cardStatus.cardState == CardState::ABSENT) {
241 ASSERT_TRUE(CheckGeneralError() || 239 ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
242 radioRsp->rspInfo.error == RadioError::INVALID_STATE || 240 radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
243 radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE); 241 }
244 }
245} 242}
246 243
247/* 244/*
248 * Test IRadio.setSmscAddress() for the response returned. 245 * Test IRadio.setSmscAddress() for the response returned.
249 */ 246 */
250TEST_F(RadioHidlTest, setSmscAddress) { 247TEST_F(RadioHidlTest, setSmscAddress) {
251 int serial = 0; 248 int serial = GetRandomSerialNumber();
252 hidl_string address = hidl_string("smscAddress"); 249 hidl_string address = hidl_string("smscAddress");
253 250
254 radio->setSmscAddress(++serial, address); 251 radio->setSmscAddress(serial, address);
255 252
256 EXPECT_EQ(std::cv_status::no_timeout, wait()); 253 EXPECT_EQ(std::cv_status::no_timeout, wait());
257 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 254 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
258 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 255 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
259 256
260 if (cardStatus.cardState == CardState::ABSENT) { 257 if (cardStatus.cardState == CardState::ABSENT) {
261 ASSERT_TRUE(CheckGeneralError() || 258 ASSERT_TRUE(CheckGeneralError() ||
262 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 259 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
263 radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT); 260 radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT);
264 } 261 }
265} 262}
266 263
267/* 264/*
268 * Test IRadio.writeSmsToSim() for the response returned. 265 * Test IRadio.writeSmsToSim() for the response returned.
269 */ 266 */
270TEST_F(RadioHidlTest, writeSmsToSim) { 267TEST_F(RadioHidlTest, writeSmsToSim) {
271 int serial = 0; 268 int serial = GetRandomSerialNumber();
272 SmsWriteArgs smsWriteArgs; 269 SmsWriteArgs smsWriteArgs;
273 smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD; 270 smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
274 smsWriteArgs.smsc = ""; 271 smsWriteArgs.smsc = "";
275 smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01"; 272 smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
276 273
277 radio->writeSmsToSim(++serial, smsWriteArgs); 274 radio->writeSmsToSim(serial, smsWriteArgs);
278 275
279 EXPECT_EQ(std::cv_status::no_timeout, wait()); 276 EXPECT_EQ(std::cv_status::no_timeout, wait());
280 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 277 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
281 EXPECT_EQ(serial, radioRsp->rspInfo.serial); 278 EXPECT_EQ(serial, radioRsp->rspInfo.serial);
282 279
283 if (cardStatus.cardState == CardState::ABSENT) { 280 if (cardStatus.cardState == CardState::ABSENT) {
284 ASSERT_TRUE(CheckGeneralError() || 281 ASSERT_TRUE(CheckGeneralError() ||
285 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS || 282 radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
286 radioRsp->rspInfo.error == RadioError::NONE || 283 radioRsp->rspInfo.error == RadioError::NONE ||
287 radioRsp->rspInfo.error == RadioError::MODEM_ERR || 284 radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
288 radioRsp->rspInfo.error == RadioError::ENCODING_ERR || 285 radioRsp->rspInfo.error == RadioError::ENCODING_ERR ||
289 radioRsp->rspInfo.error == RadioError::NO_RESOURCES || 286 radioRsp->rspInfo.error == RadioError::NO_RESOURCES ||
290 radioRsp->rspInfo.error == RadioError::NETWORK_NOT_READY || 287 radioRsp->rspInfo.error == RadioError::NETWORK_NOT_READY ||
291 radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS); 288 radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
292 } 289 }
293} 290}
294 291
295/* 292/*
296 * Test IRadio.deleteSmsOnSim() for the response returned. 293 * Test IRadio.deleteSmsOnSim() for the response returned.
297 */ 294 */
298TEST_F(RadioHidlTest, deleteSmsOnSim) { 295TEST_F(RadioHidlTest, deleteSmsOnSim) {
299 int serial = 0; 296 int serial = GetRandomSerialNumber();
300 int index = 1; 297 int index = 1;
301 298
302 radio->deleteSmsOnSim(++serial, index); 299 radio->deleteSmsOnSim(serial, index);
303 300
304 EXPECT_EQ(std::cv_status::no_timeout, wait()); 301 EXPECT_EQ(std::cv_status::no_timeout, wait());
305 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); 302 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
306 EXPECT_EQ(serial, radioRs