Merge "Correct the comments for radio hal types"

am: 489b89768d

Change-Id: I8b5018fbf129af43d371a37ad71f5ba1e5760a59
This commit is contained in:
Youming Ye
2018-09-05 10:03:24 -07:00
committed by android-build-merger
9 changed files with 135 additions and 11 deletions

View File

@@ -390,4 +390,5 @@ da33234403ff5d60f3473711917b9948e6484a4260b5247acdafb111193a9de2 android.hardwar
1a5ae9793223658174258b523763c557abad6fb917df0b8e3cc097fc89035811 android.hardware.neuralnetworks@1.0::types
4310eb8272f085914952f3bfb73a8f8bb477a80e8b93596f0ea5acb58546b66d android.hardware.neuralnetworks@1.1::types
1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse
271187e261b30c01a33011aea257c07a2d2f05b72943ebee89e973e997849973 android.hardware.radio@1.0::types
1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio

View File

@@ -1500,9 +1500,10 @@ struct GsmBroadcastSmsConfigInfo {
};
struct CellIdentityGsm {
string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if
string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
// unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
// if unknown
int32_t lac; // 16-bit Location Area Code, 0..65535, INT_MAX if unknown
int32_t cid; // 16-bit GSM Cell Identity described in
// TS 27.007, 0..65535, INT_MAX if unknown
@@ -1512,8 +1513,9 @@ struct CellIdentityGsm {
};
struct CellIdentityWcdma {
string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX
string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
// unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
// if unknown
int32_t lac; // 16-bit Location Area Code, 0..65535, INT_MAX if unknown
int32_t cid; // 28-bit UMTS Cell Identity described in
@@ -1541,9 +1543,10 @@ struct CellIdentityCdma {
};
struct CellIdentityLte {
string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if
string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
// unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
// if unknown
int32_t ci; // 28-bit Cell Identity described in TS TS 27.007, INT_MAX
// if unknown
int32_t pci; // physical cell id 0..503; this value must be valid
@@ -1553,9 +1556,10 @@ struct CellIdentityLte {
};
struct CellIdentityTdscdma {
string mcc; // 3-digit Mobile Country Code, 0..999, INT_MAX if unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if
string mcc; // 3-digit Mobile Country Code, 0..999, empty string if
// unknown
string mnc; // 2 or 3-digit Mobile Network Code, 0..999, empty string
// if unknown
int32_t lac; // 16-bit Location Area Code, 0..65535, INT_MAX if
// unknown
int32_t cid; // 28-bit UMTS Cell Identity described in

View File

@@ -32,6 +32,67 @@ TEST_F(RadioHidlTest, getDataRegistrationState) {
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
} else if (cardStatus.cardState == CardState::PRESENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp->rspInfo.error,
{RadioError::NONE, RadioError::NOT_PROVISIONED, RadioError::CANCELLED}));
// Check the mcc [0, 999] and mnc [0, 999].
string hidl_mcc;
string hidl_mnc;
bool checkMccMnc = true;
int totalIdentitySizeExpected = 1;
CellIdentity cellIdentities = radioRsp->dataRegResp.cellIdentity;
CellInfoType cellInfoType = cellIdentities.cellInfoType;
if (cellInfoType == CellInfoType::NONE) {
// All the fields are 0
totalIdentitySizeExpected = 0;
checkMccMnc = false;
} else if (cellInfoType == CellInfoType::GSM) {
EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size());
CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0];
hidl_mcc = cig.mcc;
hidl_mnc = cig.mnc;
} else if (cellInfoType == CellInfoType::LTE) {
EXPECT_EQ(1, cellIdentities.cellIdentityLte.size());
CellIdentityLte cil = cellIdentities.cellIdentityLte[0];
hidl_mcc = cil.mcc;
hidl_mnc = cil.mnc;
} else if (cellInfoType == CellInfoType::WCDMA) {
EXPECT_EQ(1, cellIdentities.cellIdentityWcdma.size());
CellIdentityWcdma ciw = cellIdentities.cellIdentityWcdma[0];
hidl_mcc = ciw.mcc;
hidl_mnc = ciw.mnc;
} else if (cellInfoType == CellInfoType::TD_SCDMA) {
EXPECT_EQ(1, cellIdentities.cellIdentityTdscdma.size());
CellIdentityTdscdma cit = cellIdentities.cellIdentityTdscdma[0];
hidl_mcc = cit.mcc;
hidl_mnc = cit.mnc;
} else {
// CellIndentityCdma has no mcc and mnc.
EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
checkMccMnc = false;
}
// Check only one CellIdentity is size 1, and others must be 0.
EXPECT_EQ(totalIdentitySizeExpected, cellIdentities.cellIdentityGsm.size() +
cellIdentities.cellIdentityCdma.size() +
cellIdentities.cellIdentityLte.size() +
cellIdentities.cellIdentityWcdma.size() +
cellIdentities.cellIdentityTdscdma.size());
if (checkMccMnc) {
// 32 bit system gets result: "\xff\xff\xff..." from RIL, which is not testable. Only
// test for 64 bit here. TODO: remove this limit after b/113181277 being fixed.
if (hidl_mcc.size() < 4 && hidl_mnc.size() < 4) {
int mcc = stoi(hidl_mcc);
int mnc = stoi(hidl_mnc);
EXPECT_TRUE(mcc >= 0 && mcc <= 999);
EXPECT_TRUE(mnc >= 0 && mnc <= 999);
}
}
}
}

View File

@@ -60,6 +60,9 @@ class RadioResponse : public IRadioResponse {
uint32_t writeSmsToSimIndex;
uint32_t writeSmsToRuimIndex;
// Data
DataRegStateResult dataRegResp;
RadioResponse(RadioHidlTest& parent);
virtual ~RadioResponse() = default;

View File

@@ -157,8 +157,9 @@ Return<void> RadioResponse::getVoiceRegistrationStateResponse(
}
Return<void> RadioResponse::getDataRegistrationStateResponse(
const RadioResponseInfo& info, const DataRegStateResult& /*dataRegResponse*/) {
const RadioResponseInfo& info, const DataRegStateResult& dataRegResponse) {
rspInfo = info;
dataRegResp = dataRegResponse;
parent.notify(info.serial);
return Void();
}

View File

@@ -53,4 +53,4 @@ int GetRandomSerialNumber() {
}
}
return testing::AssertionFailure() << "SapError:" + toString(err) + " is returned";
}
}

View File

@@ -753,6 +753,56 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_2->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::NOT_PROVISIONED}));
// Check the mcc [0, 999] and mnc [0, 999].
string hidl_mcc;
string hidl_mnc;
int totalIdentitySizeExpected = 1;
::android::hardware::radio::V1_2::CellIdentity cellIdentities =
radioRsp_v1_2->dataRegResp.cellIdentity;
CellInfoType cellInfoType = cellIdentities.cellInfoType;
if (cellInfoType == CellInfoType::NONE) {
// All the fields are 0
totalIdentitySizeExpected = 0;
} else if (cellInfoType == CellInfoType::GSM) {
EXPECT_EQ(1, cellIdentities.cellIdentityGsm.size());
::android::hardware::radio::V1_2::CellIdentityGsm cig = cellIdentities.cellIdentityGsm[0];
hidl_mcc = cig.base.mcc;
hidl_mnc = cig.base.mnc;
} else if (cellInfoType == CellInfoType::LTE) {
EXPECT_EQ(1, cellIdentities.cellIdentityLte.size());
::android::hardware::radio::V1_2::CellIdentityLte cil = cellIdentities.cellIdentityLte[0];
hidl_mcc = cil.base.mcc;
hidl_mnc = cil.base.mnc;
} else if (cellInfoType == CellInfoType::WCDMA) {
EXPECT_EQ(1, cellIdentities.cellIdentityWcdma.size());
::android::hardware::radio::V1_2::CellIdentityWcdma ciw =
cellIdentities.cellIdentityWcdma[0];
hidl_mcc = ciw.base.mcc;
hidl_mnc = ciw.base.mnc;
} else if (cellInfoType == CellInfoType::TD_SCDMA) {
EXPECT_EQ(1, cellIdentities.cellIdentityTdscdma.size());
::android::hardware::radio::V1_2::CellIdentityTdscdma cit =
cellIdentities.cellIdentityTdscdma[0];
hidl_mcc = cit.base.mcc;
hidl_mnc = cit.base.mnc;
} else {
// CellIndentityCdma has no mcc and mnc.
EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
}
// Check only one CellIdentity is size 1, and others must be 0.
EXPECT_EQ(totalIdentitySizeExpected,
cellIdentities.cellIdentityGsm.size() + cellIdentities.cellIdentityCdma.size() +
cellIdentities.cellIdentityLte.size() + cellIdentities.cellIdentityWcdma.size() +
cellIdentities.cellIdentityTdscdma.size());
int mcc = stoi(hidl_mcc);
int mnc = stoi(hidl_mnc);
EXPECT_TRUE(mcc >= 0 && mcc <= 999);
EXPECT_TRUE(mnc >= 0 && mnc <= 999);
}
/*

View File

@@ -56,6 +56,9 @@ class RadioResponse_v1_2 : public ::android::hardware::radio::V1_2::IRadioRespon
RadioResponseInfo rspInfo;
// Data
::android::hardware::radio::V1_2::DataRegStateResult dataRegResp;
RadioResponse_v1_2(RadioHidlTest_v1_2& parent_v1_2);
virtual ~RadioResponse_v1_2() = default;

View File

@@ -756,8 +756,9 @@ Return<void> RadioResponse_v1_2::getVoiceRegistrationStateResponse_1_2(
Return<void> RadioResponse_v1_2::getDataRegistrationStateResponse_1_2(
const RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::DataRegStateResult& /*dataRegResponse*/) {
const ::android::hardware::radio::V1_2::DataRegStateResult& dataRegResponse) {
rspInfo = info;
dataRegResp = dataRegResponse;
parent_v1_2.notify(info.serial);
return Void();
}