Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56acdf4c authored by Youming Ye's avatar Youming Ye Committed by android-build-merger
Browse files

Merge "Correct the comments for radio hal types"

am: 489b8976

Change-Id: I8b5018fbf129af43d371a37ad71f5ba1e5760a59
parents 3f200e07 489b8976
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+12 −8
Original line number Diff line number Diff line
@@ -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
+61 −0
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }
}

+3 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ class RadioResponse : public IRadioResponse {
    uint32_t writeSmsToSimIndex;
    uint32_t writeSmsToRuimIndex;

    // Data
    DataRegStateResult dataRegResp;

    RadioResponse(RadioHidlTest& parent);

    virtual ~RadioResponse() = default;
+2 −1
Original line number Diff line number Diff line
@@ -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();
}
Loading