Merge "Add p2 option in OpenLogicalChannel" into oc-dev

This commit is contained in:
Amit Mahajan
2017-04-12 22:02:34 +00:00
committed by Android (Google) Code Review
3 changed files with 15 additions and 7 deletions

View File

@@ -1285,10 +1285,11 @@ interface IRadio {
*
* @param serial Serial number of request.
* @param aid AID value, See ETSI 102.221 and 101.220.
* @param p2 P2 value, described in ISO 7816-4. Ignore if equal to P2Constant:NO_P2
*
* Response callback is IRadioResponse.iccOpenLogicalChannelResponse()
*/
oneway iccOpenLogicalChannel(int32_t serial, string aid);
oneway iccOpenLogicalChannel(int32_t serial, string aid, int32_t p2);
/**
* Close a previously opened logical channel. This command reflects TS 27.007

View File

@@ -1161,6 +1161,10 @@ enum DeviceStateType : int32_t {
// this doesn't mean no data is expected.
};
enum P2Constant : int32_t {
NO_P2 = -1, // No P2 value is provided
};
struct RadioResponseInfo {
RadioResponseType type; // Response type
int32_t serial; // Serial number of the request

View File

@@ -246,12 +246,15 @@ TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
*/
TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
int serial = 1;
int p2 = 0x04;
// Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is
// requested.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr,
p2);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
}
}
@@ -317,4 +320,4 @@ TEST_F(RadioHidlTest, supplyNetworkDepersonalization) {
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT);
}
}
}