Merge "Initial Target-side VTS tests for Short Message Service(SMS) Radio Hal Apis" am: bcfabe7cb4
am: e8b7bbd3cb
Change-Id: Ic3abf510134375c50379fdd2b31e103f4f436c6a
This commit is contained in:
commit
6d41084d60
4 changed files with 489 additions and 16 deletions
|
@ -19,6 +19,7 @@ cc_test {
|
||||||
srcs: ["radio_hidl_hal_test.cpp",
|
srcs: ["radio_hidl_hal_test.cpp",
|
||||||
"radio_response.cpp",
|
"radio_response.cpp",
|
||||||
"radio_hidl_hal_icc.cpp",
|
"radio_hidl_hal_icc.cpp",
|
||||||
|
"radio_hidl_hal_sms.cpp",
|
||||||
"VtsHalRadioV1_0TargetTest.cpp"],
|
"VtsHalRadioV1_0TargetTest.cpp"],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libbase",
|
"libbase",
|
||||||
|
@ -35,4 +36,4 @@ cc_test {
|
||||||
"-O0",
|
"-O0",
|
||||||
"-g",
|
"-g",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
431
radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
Normal file
431
radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
Normal file
|
@ -0,0 +1,431 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include<radio_hidl_hal_utils.h>
|
||||||
|
|
||||||
|
using namespace ::android::hardware::radio::V1_0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.sendSms() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, sendSms) {
|
||||||
|
int serial = 0;
|
||||||
|
GsmSmsMessage msg;
|
||||||
|
msg.smscPdu = "";
|
||||||
|
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
|
||||||
|
|
||||||
|
radio->sendSms(++serial, msg);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
EXPECT_EQ(RadioError::INVALID_STATE, radioRsp->rspInfo.error);
|
||||||
|
EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
|
||||||
|
EXPECT_EQ("", radioRsp->sendSmsResult.ackPDU);
|
||||||
|
EXPECT_EQ(-1, radioRsp->sendSmsResult.errorCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.sendSMSExpectMore() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, sendSMSExpectMore) {
|
||||||
|
int serial = 0;
|
||||||
|
GsmSmsMessage msg;
|
||||||
|
msg.smscPdu = "";
|
||||||
|
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
|
||||||
|
|
||||||
|
radio->sendSMSExpectMore(++serial, msg);
|
||||||
|
|
||||||
|
// TODO(shuoq): add more test for this API when inserted sim card is considered
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
EXPECT_EQ(RadioError::INVALID_STATE, radioRsp->rspInfo.error);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
|
||||||
|
EXPECT_EQ("", radioRsp->sendSmsResult.ackPDU);
|
||||||
|
EXPECT_EQ(-1, radioRsp->sendSmsResult.errorCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) {
|
||||||
|
int serial = 0;
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
|
radio->acknowledgeLastIncomingGsmSms(++serial, success,
|
||||||
|
SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
EXPECT_EQ(RadioError::INVALID_STATE, radioRsp->rspInfo.error);
|
||||||
|
} else {
|
||||||
|
// TODO(shuoq): Will test right behavior when inserted sim card is considered
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) {
|
||||||
|
int serial = 0;
|
||||||
|
bool success = true;
|
||||||
|
std::string ackPdu = "";
|
||||||
|
|
||||||
|
radio->acknowledgeIncomingGsmSmsWithPdu(++serial, success, ackPdu);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
// TODO(shuoq): Will test right behavior when inserted sim card is considered
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.sendCdmaSms() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, sendCdmaSms) {
|
||||||
|
int serial = 0;
|
||||||
|
|
||||||
|
// Create a CdmaSmsAddress
|
||||||
|
CdmaSmsAddress cdmaSmsAddress;
|
||||||
|
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
|
||||||
|
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
|
||||||
|
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
|
||||||
|
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
|
||||||
|
cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
|
||||||
|
|
||||||
|
// Create a CdmaSmsSubAddress
|
||||||
|
CdmaSmsSubaddress cdmaSmsSubaddress;
|
||||||
|
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
|
||||||
|
cdmaSmsSubaddress.odd = false;
|
||||||
|
cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
|
||||||
|
|
||||||
|
// Create a CdmaSmsMessage
|
||||||
|
android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
|
||||||
|
cdmaSmsMessage.teleserviceId = 4098;
|
||||||
|
cdmaSmsMessage.isServicePresent = false;
|
||||||
|
cdmaSmsMessage.serviceCategory = 0;
|
||||||
|
cdmaSmsMessage.address = cdmaSmsAddress;
|
||||||
|
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
|
||||||
|
cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
|
||||||
|
{15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
|
||||||
|
|
||||||
|
radio->sendCdmaSms(++serial, cdmaSmsMessage);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
// TODO(shuoq): radioRsp->sendSmsResult needs to be investigated when Sim card is in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) {
|
||||||
|
int serial = 0;
|
||||||
|
|
||||||
|
// Create a CdmaSmsAck
|
||||||
|
CdmaSmsAck cdmaSmsAck;
|
||||||
|
cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR;
|
||||||
|
cdmaSmsAck.smsCauseCode = 1;
|
||||||
|
|
||||||
|
radio->acknowledgeLastIncomingCdmaSms(++serial, cdmaSmsAck);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
EXPECT_EQ(RadioError::NO_SMS_TO_ACK, radioRsp->rspInfo.error);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::NO_SMS_TO_ACK, radioRsp->rspInfo.error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.sendImsSms() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, sendImsSms) {
|
||||||
|
int serial = 1;
|
||||||
|
|
||||||
|
// Create a CdmaSmsAddress
|
||||||
|
CdmaSmsAddress cdmaSmsAddress;
|
||||||
|
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
|
||||||
|
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
|
||||||
|
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
|
||||||
|
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
|
||||||
|
cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
|
||||||
|
|
||||||
|
// Create a CdmaSmsSubAddress
|
||||||
|
CdmaSmsSubaddress cdmaSmsSubaddress;
|
||||||
|
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
|
||||||
|
cdmaSmsSubaddress.odd = false;
|
||||||
|
cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
|
||||||
|
|
||||||
|
// Create a CdmaSmsMessage
|
||||||
|
CdmaSmsMessage cdmaSmsMessage;
|
||||||
|
cdmaSmsMessage.teleserviceId = 4098;
|
||||||
|
cdmaSmsMessage.isServicePresent = false;
|
||||||
|
cdmaSmsMessage.serviceCategory = 0;
|
||||||
|
cdmaSmsMessage.address = cdmaSmsAddress;
|
||||||
|
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
|
||||||
|
cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
|
||||||
|
{15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
|
||||||
|
|
||||||
|
// Creata an ImsSmsMessage
|
||||||
|
ImsSmsMessage msg;
|
||||||
|
msg.tech = RadioTechnologyFamily::THREE_GPP2;
|
||||||
|
msg.retry = false;
|
||||||
|
msg.messageRef = 0;
|
||||||
|
msg.cdmaMessage = (std::vector<CdmaSmsMessage>) {cdmaSmsMessage};
|
||||||
|
msg.gsmMessage = (std::vector<GsmSmsMessage>) {};
|
||||||
|
|
||||||
|
radio->sendImsSms(serial, msg);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
|
||||||
|
// TODO(shuoq): radioRsp->sendSmsResult needs to be investigated when sim card is in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.getSmscAddress() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, getSmscAddress) {
|
||||||
|
int serial = 0;
|
||||||
|
|
||||||
|
radio->getSmscAddress(++serial);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
|
||||||
|
// TODO(shuoq): radioRsp->smscAddress needs to be investigated when Sim card is in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.setSmscAddress() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, setSmscAddress) {
|
||||||
|
int serial = 0;
|
||||||
|
hidl_string address = hidl_string("smscAddress");
|
||||||
|
|
||||||
|
radio->setSmscAddress(++serial, address);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.writeSmsToSim() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, writeSmsToSim) {
|
||||||
|
int serial = 0;
|
||||||
|
SmsWriteArgs smsWriteArgs;
|
||||||
|
smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
|
||||||
|
smsWriteArgs.smsc = "";
|
||||||
|
smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
|
||||||
|
|
||||||
|
radio->writeSmsToSim(++serial, smsWriteArgs);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
// TODO(shuoq): radioRsp->writeSmsToSimIndex needs to be investigated when Sim card is in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.deleteSmsOnSim() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, deleteSmsOnSim) {
|
||||||
|
int serial = 0;
|
||||||
|
int index = 1;
|
||||||
|
|
||||||
|
radio->deleteSmsOnSim(++serial, index);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::NO_SUCH_ENTRY, radioRsp->rspInfo.error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.writeSmsToRuim() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, writeSmsToRuim) {
|
||||||
|
int serial = 0;
|
||||||
|
|
||||||
|
// Create a CdmaSmsAddress
|
||||||
|
CdmaSmsAddress cdmaSmsAddress;
|
||||||
|
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
|
||||||
|
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
|
||||||
|
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
|
||||||
|
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
|
||||||
|
cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
|
||||||
|
|
||||||
|
// Create a CdmaSmsSubAddress
|
||||||
|
CdmaSmsSubaddress cdmaSmsSubaddress;
|
||||||
|
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
|
||||||
|
cdmaSmsSubaddress.odd = false;
|
||||||
|
cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
|
||||||
|
|
||||||
|
// Create a CdmaSmsMessage
|
||||||
|
CdmaSmsMessage cdmaSmsMessage;
|
||||||
|
cdmaSmsMessage.teleserviceId = 4098;
|
||||||
|
cdmaSmsMessage.isServicePresent = false;
|
||||||
|
cdmaSmsMessage.serviceCategory = 0;
|
||||||
|
cdmaSmsMessage.address = cdmaSmsAddress;
|
||||||
|
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
|
||||||
|
cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
|
||||||
|
{15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
|
||||||
|
|
||||||
|
// Create a CdmaSmsWriteArgs
|
||||||
|
CdmaSmsWriteArgs cdmaSmsWriteArgs;
|
||||||
|
cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
|
||||||
|
cdmaSmsWriteArgs.message = cdmaSmsMessage;
|
||||||
|
|
||||||
|
radio->writeSmsToRuim(++serial, cdmaSmsWriteArgs);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
// TODO(shuoq): radioRsp->writeSmsToRuimIndex needs to be investigated when sim card is in
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.deleteSmsOnRuim() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, deleteSmsOnRuim) {
|
||||||
|
int serial = 0;
|
||||||
|
int index = 1;
|
||||||
|
|
||||||
|
// Create a CdmaSmsAddress
|
||||||
|
CdmaSmsAddress cdmaSmsAddress;
|
||||||
|
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
|
||||||
|
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
|
||||||
|
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
|
||||||
|
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
|
||||||
|
cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
|
||||||
|
|
||||||
|
// Create a CdmaSmsSubAddress
|
||||||
|
CdmaSmsSubaddress cdmaSmsSubaddress;
|
||||||
|
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
|
||||||
|
cdmaSmsSubaddress.odd = false;
|
||||||
|
cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
|
||||||
|
|
||||||
|
// Create a CdmaSmsMessage
|
||||||
|
CdmaSmsMessage cdmaSmsMessage;
|
||||||
|
cdmaSmsMessage.teleserviceId = 4098;
|
||||||
|
cdmaSmsMessage.isServicePresent = false;
|
||||||
|
cdmaSmsMessage.serviceCategory = 0;
|
||||||
|
cdmaSmsMessage.address = cdmaSmsAddress;
|
||||||
|
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
|
||||||
|
cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
|
||||||
|
{15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
|
||||||
|
|
||||||
|
// Create a CdmaSmsWriteArgs
|
||||||
|
CdmaSmsWriteArgs cdmaSmsWriteArgs;
|
||||||
|
cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
|
||||||
|
cdmaSmsWriteArgs.message = cdmaSmsMessage;
|
||||||
|
|
||||||
|
radio->deleteSmsOnRuim(++serial, index);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
// TODO(shuoq): Will test right behavior when inserted sim card is considered
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test IRadio.reportSmsMemoryStatus() for the response returned.
|
||||||
|
*/
|
||||||
|
TEST_F(RadioHidlTest, reportSmsMemoryStatus) {
|
||||||
|
int serial = 0;
|
||||||
|
bool available = true;
|
||||||
|
|
||||||
|
radio->reportSmsMemoryStatus(++serial, available);
|
||||||
|
|
||||||
|
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||||
|
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
|
||||||
|
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
|
||||||
|
|
||||||
|
if (cardStatus.cardState == CardState::ABSENT) {
|
||||||
|
// TODO(shuoq): Will add error check when we know the expected error from QC
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,6 +87,12 @@ public:
|
||||||
IccIoResult iccIoResult;
|
IccIoResult iccIoResult;
|
||||||
int channelId;
|
int channelId;
|
||||||
|
|
||||||
|
// Sms
|
||||||
|
SendSmsResult sendSmsResult;
|
||||||
|
hidl_string smscAddress;
|
||||||
|
uint32_t writeSmsToSimIndex;
|
||||||
|
uint32_t writeSmsToRuimIndex;
|
||||||
|
|
||||||
RadioResponse(RadioHidlTest& parent);
|
RadioResponse(RadioHidlTest& parent);
|
||||||
|
|
||||||
virtual ~RadioResponse() = default;
|
virtual ~RadioResponse() = default;
|
||||||
|
|
|
@ -158,13 +158,19 @@ Return<void> RadioResponse::sendDtmfResponse(const RadioResponseInfo& /*info*/)
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::sendSmsResponse(const RadioResponseInfo& /*info*/,
|
Return<void> RadioResponse::sendSmsResponse(const RadioResponseInfo& info,
|
||||||
const SendSmsResult& /*sms*/) {
|
const SendSmsResult& sms) {
|
||||||
|
rspInfo = info;
|
||||||
|
sendSmsResult = sms;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::sendSMSExpectMoreResponse(
|
Return<void> RadioResponse::sendSMSExpectMoreResponse(
|
||||||
const RadioResponseInfo& /*info*/, const SendSmsResult& /*sms*/) {
|
const RadioResponseInfo& info, const SendSmsResult& sms) {
|
||||||
|
rspInfo = info;
|
||||||
|
sendSmsResult = sms;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +223,9 @@ Return<void> RadioResponse::setCallWaitingResponse(const RadioResponseInfo& /*in
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& /*info*/) {
|
Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info) {
|
||||||
|
rspInfo = info;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,12 +328,17 @@ Return<void> RadioResponse::setSuppServiceNotificationsResponse(
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::writeSmsToSimResponse(
|
Return<void> RadioResponse::writeSmsToSimResponse(
|
||||||
const RadioResponseInfo& /*info*/, int32_t /*index*/) {
|
const RadioResponseInfo& info, int32_t index) {
|
||||||
|
rspInfo = info;
|
||||||
|
writeSmsToSimIndex = index;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::deleteSmsOnSimResponse(
|
Return<void> RadioResponse::deleteSmsOnSimResponse(
|
||||||
const RadioResponseInfo& /*info*/) {
|
const RadioResponseInfo& info) {
|
||||||
|
rspInfo = info;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,12 +430,17 @@ Return<void> RadioResponse::sendBurstDtmfResponse(const RadioResponseInfo& /*inf
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::sendCdmaSmsResponse(
|
Return<void> RadioResponse::sendCdmaSmsResponse(
|
||||||
const RadioResponseInfo& /*info*/, const SendSmsResult& /*sms*/) {
|
const RadioResponseInfo& info, const SendSmsResult& sms) {
|
||||||
|
rspInfo = info;
|
||||||
|
sendSmsResult = sms;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
|
Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
|
||||||
const RadioResponseInfo& /*info*/) {
|
const RadioResponseInfo& info) {
|
||||||
|
rspInfo = info;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,12 +482,17 @@ Return<void> RadioResponse::getCDMASubscriptionResponse(
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::writeSmsToRuimResponse(
|
Return<void> RadioResponse::writeSmsToRuimResponse(
|
||||||
const RadioResponseInfo& /*info*/, uint32_t /*index*/) {
|
const RadioResponseInfo& info, uint32_t index) {
|
||||||
|
rspInfo = info;
|
||||||
|
writeSmsToRuimIndex = index;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::deleteSmsOnRuimResponse(
|
Return<void> RadioResponse::deleteSmsOnRuimResponse(
|
||||||
const RadioResponseInfo& /*info*/) {
|
const RadioResponseInfo& info) {
|
||||||
|
rspInfo = info;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,15 +509,22 @@ Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const RadioRespons
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::getSmscAddressResponse(
|
Return<void> RadioResponse::getSmscAddressResponse(
|
||||||
const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*smsc*/) {
|
const RadioResponseInfo& info, const ::android::hardware::hidl_string& smsc) {
|
||||||
|
rspInfo = info;
|
||||||
|
smscAddress = smsc;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::setSmscAddressResponse(const RadioResponseInfo& /*info*/) {
|
Return<void> RadioResponse::setSmscAddressResponse(const RadioResponseInfo& info) {
|
||||||
|
rspInfo = info;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::reportSmsMemoryStatusResponse(const RadioResponseInfo& /*info*/) {
|
Return<void> RadioResponse::reportSmsMemoryStatusResponse(const RadioResponseInfo& info) {
|
||||||
|
rspInfo = info;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +543,9 @@ Return<void> RadioResponse::requestIsimAuthenticationResponse(
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
|
Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
|
||||||
const RadioResponseInfo& /*info*/) {
|
const RadioResponseInfo& info) {
|
||||||
|
rspInfo = info;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,7 +580,10 @@ Return<void> RadioResponse::getImsRegistrationStateResponse(
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> RadioResponse::sendImsSmsResponse(
|
Return<void> RadioResponse::sendImsSmsResponse(
|
||||||
const RadioResponseInfo& /*info*/, const SendSmsResult& /*sms*/) {
|
const RadioResponseInfo& info, const SendSmsResult& sms) {
|
||||||
|
rspInfo = info;
|
||||||
|
sendSmsResult = sms;
|
||||||
|
parent.notify();
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue