1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <android-base/logging.h>
18 #include <radio_hidl_hal_utils_v1_0.h>
19 
20 using namespace ::android::hardware::radio::V1_0;
21 
22 /*
23  * Test IRadio.sendSms() for the response returned.
24  */
TEST_P(RadioHidlTest,sendSms)25 TEST_P(RadioHidlTest, sendSms) {
26     LOG(DEBUG) << "sendSms";
27     serial = GetRandomSerialNumber();
28     GsmSmsMessage msg;
29     msg.smscPdu = "";
30     msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
31 
32     radio->sendSms(serial, msg);
33 
34     EXPECT_EQ(std::cv_status::no_timeout, wait(300));
35     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
36     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
37 
38     if (cardStatus.cardState == CardState::ABSENT) {
39         ASSERT_TRUE(CheckAnyOfErrors(
40             radioRsp->rspInfo.error,
41             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
42             CHECK_GENERAL_ERROR));
43         EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
44     }
45     LOG(DEBUG) << "sendSms finished";
46 }
47 
48 /*
49  * Test IRadio.sendSMSExpectMore() for the response returned.
50  */
TEST_P(RadioHidlTest,sendSMSExpectMore)51 TEST_P(RadioHidlTest, sendSMSExpectMore) {
52     LOG(DEBUG) << "sendSMSExpectMore";
53     serial = GetRandomSerialNumber();
54     GsmSmsMessage msg;
55     msg.smscPdu = "";
56     msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
57 
58     radio->sendSMSExpectMore(serial, msg);
59 
60     // TODO(shuoq): add more test for this API when inserted sim card is
61     // considered
62 
63     EXPECT_EQ(std::cv_status::no_timeout, wait(300));
64     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
65     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
66 
67     if (cardStatus.cardState == CardState::ABSENT) {
68         ASSERT_TRUE(CheckAnyOfErrors(
69             radioRsp->rspInfo.error,
70             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
71             CHECK_GENERAL_ERROR));
72     }
73     LOG(DEBUG) << "sendSMSExpectMore finished";
74 }
75 
76 /*
77  * Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned.
78  */
TEST_P(RadioHidlTest,acknowledgeLastIncomingGsmSms)79 TEST_P(RadioHidlTest, acknowledgeLastIncomingGsmSms) {
80     LOG(DEBUG) << "acknowledgeLastIncomingGsmSms";
81     serial = GetRandomSerialNumber();
82     bool success = true;
83 
84     radio->acknowledgeLastIncomingGsmSms(serial, success,
85                                          SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
86 
87     EXPECT_EQ(std::cv_status::no_timeout, wait());
88     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
89     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
90 
91     if (cardStatus.cardState == CardState::ABSENT) {
92         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
93                                      {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
94                                      CHECK_GENERAL_ERROR));
95     }
96     LOG(DEBUG) << "acknowledgeLastIncomingGsmSms finished";
97 }
98 
99 /*
100  * Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
101  */
TEST_P(RadioHidlTest,acknowledgeIncomingGsmSmsWithPdu)102 TEST_P(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) {
103     LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu";
104     serial = GetRandomSerialNumber();
105     bool success = true;
106     std::string ackPdu = "";
107 
108     radio->acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
109 
110     EXPECT_EQ(std::cv_status::no_timeout, wait());
111     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
112     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
113 
114     if (cardStatus.cardState == CardState::ABSENT) {
115         // TODO(shuoq): Will add error check when we know the expected error from QC
116     }
117     LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu finished";
118 }
119 
120 /*
121  * Test IRadio.sendCdmaSms() for the response returned.
122  */
TEST_P(RadioHidlTest,sendCdmaSms)123 TEST_P(RadioHidlTest, sendCdmaSms) {
124     LOG(DEBUG) << "sendCdmaSms";
125     serial = GetRandomSerialNumber();
126 
127     // Create a CdmaSmsAddress
128     CdmaSmsAddress cdmaSmsAddress;
129     cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
130     cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
131     cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
132     cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
133     cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
134 
135     // Create a CdmaSmsSubAddress
136     CdmaSmsSubaddress cdmaSmsSubaddress;
137     cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
138     cdmaSmsSubaddress.odd = false;
139     cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
140 
141     // Create a CdmaSmsMessage
142     android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
143     cdmaSmsMessage.teleserviceId = 4098;
144     cdmaSmsMessage.isServicePresent = false;
145     cdmaSmsMessage.serviceCategory = 0;
146     cdmaSmsMessage.address = cdmaSmsAddress;
147     cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
148     cdmaSmsMessage.bearerData =
149         (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
150 
151     radio->sendCdmaSms(serial, cdmaSmsMessage);
152 
153     EXPECT_EQ(std::cv_status::no_timeout, wait());
154     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
155     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
156 
157     if (cardStatus.cardState == CardState::ABSENT) {
158         ASSERT_TRUE(CheckAnyOfErrors(
159             radioRsp->rspInfo.error,
160             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
161             CHECK_GENERAL_ERROR));
162     }
163     LOG(DEBUG) << "sendCdmaSms finished";
164 }
165 
166 /*
167  * Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned.
168  */
TEST_P(RadioHidlTest,acknowledgeLastIncomingCdmaSms)169 TEST_P(RadioHidlTest, acknowledgeLastIncomingCdmaSms) {
170     LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms";
171     serial = GetRandomSerialNumber();
172 
173     // Create a CdmaSmsAck
174     CdmaSmsAck cdmaSmsAck;
175     cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR;
176     cdmaSmsAck.smsCauseCode = 1;
177 
178     radio->acknowledgeLastIncomingCdmaSms(serial, cdmaSmsAck);
179 
180     EXPECT_EQ(std::cv_status::no_timeout, wait());
181     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
182     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
183 
184     if (cardStatus.cardState == CardState::ABSENT) {
185         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
186                                      {RadioError::INVALID_ARGUMENTS, RadioError::NO_SMS_TO_ACK},
187                                      CHECK_GENERAL_ERROR));
188     }
189     LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms finished";
190 }
191 
192 /*
193  * Test IRadio.sendImsSms() for the response returned.
194  */
TEST_P(RadioHidlTest,sendImsSms)195 TEST_P(RadioHidlTest, sendImsSms) {
196     LOG(DEBUG) << "sendImsSms";
197     serial = GetRandomSerialNumber();
198 
199     // Create a CdmaSmsAddress
200     CdmaSmsAddress cdmaSmsAddress;
201     cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
202     cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
203     cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
204     cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
205     cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
206 
207     // Create a CdmaSmsSubAddress
208     CdmaSmsSubaddress cdmaSmsSubaddress;
209     cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
210     cdmaSmsSubaddress.odd = false;
211     cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
212 
213     // Create a CdmaSmsMessage
214     CdmaSmsMessage cdmaSmsMessage;
215     cdmaSmsMessage.teleserviceId = 4098;
216     cdmaSmsMessage.isServicePresent = false;
217     cdmaSmsMessage.serviceCategory = 0;
218     cdmaSmsMessage.address = cdmaSmsAddress;
219     cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
220     cdmaSmsMessage.bearerData =
221         (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
222 
223     // Creata an ImsSmsMessage
224     ImsSmsMessage msg;
225     msg.tech = RadioTechnologyFamily::THREE_GPP2;
226     msg.retry = false;
227     msg.messageRef = 0;
228     msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage};
229     msg.gsmMessage = (std::vector<GsmSmsMessage>){};
230 
231     radio->sendImsSms(serial, msg);
232 
233     EXPECT_EQ(std::cv_status::no_timeout, wait());
234     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
235     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
236 
237     if (cardStatus.cardState == CardState::ABSENT) {
238         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::INVALID_ARGUMENTS},
239                                      CHECK_GENERAL_ERROR));
240     }
241     LOG(DEBUG) << "sendImsSms finished";
242 }
243 
244 /*
245  * Test IRadio.getSmscAddress() for the response returned.
246  */
TEST_P(RadioHidlTest,getSmscAddress)247 TEST_P(RadioHidlTest, getSmscAddress) {
248     LOG(DEBUG) << "getSmscAddress";
249     serial = GetRandomSerialNumber();
250 
251     radio->getSmscAddress(serial);
252 
253     EXPECT_EQ(std::cv_status::no_timeout, wait());
254     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
255     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
256 
257     if (cardStatus.cardState == CardState::ABSENT) {
258         ASSERT_TRUE(CheckAnyOfErrors(
259             radioRsp->rspInfo.error,
260             {RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
261             CHECK_GENERAL_ERROR));
262     }
263     LOG(DEBUG) << "getSmscAddress finished";
264 }
265 
266 /*
267  * Test IRadio.setSmscAddress() for the response returned.
268  */
TEST_P(RadioHidlTest,setSmscAddress)269 TEST_P(RadioHidlTest, setSmscAddress) {
270     LOG(DEBUG) << "setSmscAddress";
271     serial = GetRandomSerialNumber();
272     hidl_string address = hidl_string("smscAddress");
273 
274     radio->setSmscAddress(serial, address);
275 
276     EXPECT_EQ(std::cv_status::no_timeout, wait());
277     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
278     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
279 
280     if (cardStatus.cardState == CardState::ABSENT) {
281         ASSERT_TRUE(CheckAnyOfErrors(
282             radioRsp->rspInfo.error,
283             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_SMS_FORMAT, RadioError::SIM_ABSENT},
284             CHECK_GENERAL_ERROR));
285     }
286     LOG(DEBUG) << "setSmscAddress finished";
287 }
288 
289 /*
290  * Test IRadio.writeSmsToSim() for the response returned.
291  */
TEST_P(RadioHidlTest,writeSmsToSim)292 TEST_P(RadioHidlTest, writeSmsToSim) {
293     LOG(DEBUG) << "writeSmsToSim";
294     serial = GetRandomSerialNumber();
295     SmsWriteArgs smsWriteArgs;
296     smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
297     smsWriteArgs.smsc = "";
298     smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
299 
300     radio->writeSmsToSim(serial, smsWriteArgs);
301 
302     EXPECT_EQ(std::cv_status::no_timeout, wait());
303     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
304     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
305 
306     if (cardStatus.cardState == CardState::ABSENT) {
307         ASSERT_TRUE(CheckAnyOfErrors(
308             radioRsp->rspInfo.error,
309             {RadioError::NONE, RadioError::ENCODING_ERR, RadioError::INVALID_ARGUMENTS,
310              RadioError::INVALID_SMSC_ADDRESS, RadioError::MODEM_ERR, RadioError::NETWORK_NOT_READY,
311              RadioError::NO_RESOURCES, RadioError::SIM_ABSENT},
312             CHECK_GENERAL_ERROR));
313     }
314     LOG(DEBUG) << "writeSmsToSim finished";
315 }
316 
317 /*
318  * Test IRadio.deleteSmsOnSim() for the response returned.
319  */
TEST_P(RadioHidlTest,deleteSmsOnSim)320 TEST_P(RadioHidlTest, deleteSmsOnSim) {
321     LOG(DEBUG) << "deleteSmsOnSim";
322     serial = GetRandomSerialNumber();
323     int index = 1;
324 
325     radio->deleteSmsOnSim(serial, index);
326 
327     EXPECT_EQ(std::cv_status::no_timeout, wait());
328     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
329     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
330 
331     if (cardStatus.cardState == CardState::ABSENT) {
332         ASSERT_TRUE(CheckAnyOfErrors(
333             radioRsp->rspInfo.error,
334             {RadioError::NONE, RadioError::ENCODING_ERR, RadioError::INVALID_ARGUMENTS,
335              RadioError::INVALID_MODEM_STATE, RadioError::NO_SUCH_ENTRY, RadioError::MODEM_ERR,
336              RadioError::SIM_ABSENT},
337             CHECK_GENERAL_ERROR));
338     }
339     LOG(DEBUG) << "deleteSmsOnSim finished";
340 }
341 
342 /*
343  * Test IRadio.writeSmsToRuim() for the response returned.
344  */
TEST_P(RadioHidlTest,writeSmsToRuim)345 TEST_P(RadioHidlTest, writeSmsToRuim) {
346     LOG(DEBUG) << "writeSmsToRuim";
347     serial = GetRandomSerialNumber();
348 
349     // Create a CdmaSmsAddress
350     CdmaSmsAddress cdmaSmsAddress;
351     cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
352     cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
353     cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
354     cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
355     cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
356 
357     // Create a CdmaSmsSubAddress
358     CdmaSmsSubaddress cdmaSmsSubaddress;
359     cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
360     cdmaSmsSubaddress.odd = false;
361     cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
362 
363     // Create a CdmaSmsMessage
364     CdmaSmsMessage cdmaSmsMessage;
365     cdmaSmsMessage.teleserviceId = 4098;
366     cdmaSmsMessage.isServicePresent = false;
367     cdmaSmsMessage.serviceCategory = 0;
368     cdmaSmsMessage.address = cdmaSmsAddress;
369     cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
370     cdmaSmsMessage.bearerData =
371         (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
372 
373     // Create a CdmaSmsWriteArgs
374     CdmaSmsWriteArgs cdmaSmsWriteArgs;
375     cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
376     cdmaSmsWriteArgs.message = cdmaSmsMessage;
377 
378     radio->writeSmsToRuim(serial, cdmaSmsWriteArgs);
379 
380     EXPECT_EQ(std::cv_status::no_timeout, wait());
381     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
382     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
383 
384     if (cardStatus.cardState == CardState::ABSENT) {
385         ASSERT_TRUE(CheckAnyOfErrors(
386             radioRsp->rspInfo.error,
387             {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_SMS_FORMAT,
388              RadioError::INVALID_SMSC_ADDRESS, RadioError::INVALID_STATE, RadioError::MODEM_ERR,
389              RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT},
390             CHECK_GENERAL_ERROR));
391     }
392     LOG(DEBUG) << "writeSmsToRuim finished";
393 }
394 
395 /*
396  * Test IRadio.deleteSmsOnRuim() for the response returned.
397  */
TEST_P(RadioHidlTest,deleteSmsOnRuim)398 TEST_P(RadioHidlTest, deleteSmsOnRuim) {
399     LOG(DEBUG) << "deleteSmsOnRuim";
400     serial = GetRandomSerialNumber();
401     int index = 1;
402 
403     // Create a CdmaSmsAddress
404     CdmaSmsAddress cdmaSmsAddress;
405     cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
406     cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
407     cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
408     cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
409     cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
410 
411     // Create a CdmaSmsSubAddress
412     CdmaSmsSubaddress cdmaSmsSubaddress;
413     cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
414     cdmaSmsSubaddress.odd = false;
415     cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
416 
417     // Create a CdmaSmsMessage
418     CdmaSmsMessage cdmaSmsMessage;
419     cdmaSmsMessage.teleserviceId = 4098;
420     cdmaSmsMessage.isServicePresent = false;
421     cdmaSmsMessage.serviceCategory = 0;
422     cdmaSmsMessage.address = cdmaSmsAddress;
423     cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
424     cdmaSmsMessage.bearerData =
425         (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
426 
427     // Create a CdmaSmsWriteArgs
428     CdmaSmsWriteArgs cdmaSmsWriteArgs;
429     cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
430     cdmaSmsWriteArgs.message = cdmaSmsMessage;
431 
432     radio->deleteSmsOnRuim(serial, index);
433 
434     EXPECT_EQ(std::cv_status::no_timeout, wait());
435     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
436     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
437 
438     if (cardStatus.cardState == CardState::ABSENT) {
439         ASSERT_TRUE(CheckAnyOfErrors(
440             radioRsp->rspInfo.error,
441             {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_MODEM_STATE,
442              RadioError::MODEM_ERR, RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT},
443             CHECK_GENERAL_ERROR));
444     }
445     LOG(DEBUG) << "deleteSmsOnRuim finished";
446 }
447 
448 /*
449  * Test IRadio.reportSmsMemoryStatus() for the response returned.
450  */
TEST_P(RadioHidlTest,reportSmsMemoryStatus)451 TEST_P(RadioHidlTest, reportSmsMemoryStatus) {
452     LOG(DEBUG) << "reportSmsMemoryStatus";
453     serial = GetRandomSerialNumber();
454     bool available = true;
455 
456     radio->reportSmsMemoryStatus(serial, available);
457 
458     EXPECT_EQ(std::cv_status::no_timeout, wait());
459     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
460     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
461 
462     if (cardStatus.cardState == CardState::ABSENT) {
463         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
464                                      {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE,
465                                       RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
466                                      CHECK_GENERAL_ERROR));
467     }
468     LOG(DEBUG) << "reportSmsMemoryStatus finished";
469 }
470