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

Commit ea9f5624 authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "Add APN type XCAP"

parents 019b0c47 1d3b15cd
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -656,10 +656,10 @@ a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardwar
619fc9839ec6e369cfa9b28e3e9412e6885720ff8f9b5750c1b6ffb905120391 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback
c9273429fcf98d797d3bb07fdba6f1be95bf960f9255cde169fd1ca4db85f856 android.hardware.wifi.supplicant@1.3::ISupplicantStaNetwork
9b0a3ab6f4f74b971ed094426d8a443e29b512ff03e1ab50c07156396cdb2483 android.hardware.wifi.supplicant@1.3::types
eaf870a7439838c66127a74e1896c4a2346979c116eb1931785ebb4d353230ae android.hardware.radio@1.5::types
ae2fd16a80caff9cb6e3f91875c7f68f7ff76c75334056549d38496673eafe5b android.hardware.radio@1.5::IRadio
0e3c23f1c815469fdcdc39bc33a486817771c7c6b6e5303f2f25569499fc6c69 android.hardware.radio@1.5::types
52abfa4c94104189fa4b2bc3132fc7c9852b7428283463b020d1a3671a4f374c android.hardware.radio@1.5::IRadio
3afac66f21a33bc9c4b80481c7d5540038348651d9a7d8af64ea13610af138da android.hardware.radio@1.5::IRadioIndication
e7268d32bedcf7d98324ffc808ec3dc45248d47ff4d04519d09e3c71767a7ad1 android.hardware.radio@1.5::IRadioResponse
957ffbaf195aa046431ebe05a5906d215e80650e8e4933b394d6454b217ef3a9 android.hardware.radio@1.5::IRadioResponse
55f0a15642869ec98a55ea0a5ac049d3e1a6245ff7750deb6bcb7182057eee83 android.hardware.radio.config@1.3::types
b27ab0cd40b0b078cdcd024bfe1061c4c4c065f3519eeb9347fa359a3268a5ae android.hardware.radio.config@1.3::IRadioConfig
742360c775313438b0f82256eac62fb5bbc76a6ae6f388573f3aa142fb2c1eea android.hardware.radio.config@1.3::IRadioConfigIndication
+76 −0
Original line number Diff line number Diff line
@@ -16,8 +16,10 @@

package android.hardware.radio@1.5;

import @1.2::DataRequestReason;
import @1.4::IRadio;
import @1.5::AccessNetwork;
import @1.5::DataProfileInfo;
import @1.5::NetworkScanRequest;
import @1.5::RadioAccessSpecifier;
import @1.5::SignalThresholdInfo;
@@ -118,4 +120,78 @@ interface IRadio extends @1.4::IRadio {
     * 1.5 version of NetworkScanRequest
     */
    oneway startNetworkScan_1_5(int32_t serial, NetworkScanRequest request);

    /**
     * Setup a packet data connection. If DataCallResponse.status returns DataCallFailCause:NONE,
     * the data connection must be added to data calls and a unsolDataCallListChanged() must be
     * sent. The call remains until removed by subsequent unsolDataCallIstChanged(). It may be
     * lost due to many factors, including deactivateDataCall() being issued, the radio powered
     * off, reception lost or even transient factors like congestion. This data call list is
     * returned by getDataCallList() and dataCallListChanged().
     *
     * The Radio is expected to:
     *   - Create one data call context.
     *   - Create and configure a dedicated interface for the context.
     *   - The interface must be point to point.
     *   - The interface is configured with one or more addresses and is capable of sending and
     *     receiving packets. The prefix length of the addresses must be /32 for IPv4 and /128
     *     for IPv6.
     *   - Must not modify routing configuration related to this interface; routing management is
     *     exclusively within the purview of the Android OS.
     *   - Support simultaneous data call contexts up to DataRegStateResult.maxDataCalls specified
     *     in the response of getDataRegistrationState.
     *
     * @param serial Serial number of request.
     * @param accessNetwork The access network to setup the data call. If the data connection cannot
     *     be established on the specified access network, the setup request must be failed.
     * @param dataProfileInfo Data profile info.
     * @param roamingAllowed Indicates whether or not data roaming is allowed by the user.
     * @param reason The request reason. Must be DataRequestReason.NORMAL or
     *     DataRequestReason.HANDOVER.
     * @param addresses If the reason is DataRequestReason.HANDOVER, this indicates the list of link
     *     addresses of the existing data connection. The format is IP address with optional "/"
     *     prefix length (The format is defined in RFC-4291 section 2.3). For example, "192.0.1.3",
     *     "192.0.1.11/16", or "2001:db8::1/64". Typically one IPv4 or one IPv6 or one of each. If
     *     the prefix length is absent, then the addresses are assumed to be point to point with
     *     IPv4 with prefix length 32 or IPv6 with prefix length 128. This parameter must be ignored
     *     unless reason is DataRequestReason.HANDOVER.
     * @param dnses If the reason is DataRequestReason.HANDOVER, this indicates the list of DNS
     *     addresses of the existing data connection. The format is defined in RFC-4291 section
     *     2.2. For example, "192.0.1.3" or "2001:db8::1". This parameter must be ignored unless
     *     reason is DataRequestReason.HANDOVER.
     *
     * Response function is IRadioResponse.setupDataCallResponse_1_5()
     *
     * Note this API is the same as the 1.4 version except using the
     * 1.5 AccessNetwork and DataProfileInto as the input param.
     */
    oneway setupDataCall_1_5(int32_t serial, AccessNetwork accessNetwork,
            DataProfileInfo dataProfileInfo, bool roamingAllowed,
            DataRequestReason reason, vec<string> addresses, vec<string> dnses);

    /**
     * Set an apn to initial attach network
     *
     * @param serial Serial number of request.
     * @param dataProfileInfo data profile containing APN settings
     *
     * Response callback is IRadioResponse.setInitialAttachApnResponse_1_5()
     *
     * Note this API is the same as the 1.4 version except using the 1.5 DataProfileInfo
     * as the input param.
     */
    oneway setInitialAttachApn_1_5(int32_t serial, DataProfileInfo dataProfileInfo);

    /**
     * Send data profiles of the current carrier to the modem.
     *
     * @param serial Serial number of request.
     * @param profiles Array of DataProfile to set.
     *
     * Response callback is IRadioResponse.setDataProfileResponse_1_5()
     *
     * Note this API is the same as the 1.4 version except using the 1.5 DataProfileInfo
     * as the input param.
     */
    oneway setDataProfile_1_5(int32_t serial, vec<DataProfileInfo> profiles);
};
+55 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.hardware.radio@1.5;

import @1.0::RadioResponseInfo;
import @1.4::IRadioResponse;
import @1.4::SetupDataCallResult;

/**
 * Interface declaring response functions to solicited radio requests.
@@ -80,4 +81,58 @@ interface IRadioResponse extends @1.4::IRadioResponse {
     *   RadioError:INVALID_ARGUMENTS
     */
    oneway startNetworkScanResponse_1_5(RadioResponseInfo info);

    /**
     * @param info Response info struct containing response type, serial no. and error
     * @param dcResponse SetupDataCallResult defined in types.hal
     *
     * Valid errors returned:
     *   RadioError:NONE must be returned on both success and failure of setup with the
     *              DataCallResponse.status containing the actual status
     *              For all other errors the DataCallResponse is ignored.
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:OP_NOT_ALLOWED_BEFORE_REG_TO_NW
     *   RadioError:OP_NOT_ALLOWED_DURING_VOICE_CALL
     *   RadioError:REQUEST_NOT_SUPPORTED
     *   RadioError:INVALID_ARGUMENTS
     *   RadioError:INTERNAL_ERR
     *   RadioError:NO_RESOURCES
     *   RadioError:SIM_ABSENT
     */
    oneway setupDataCallResponse_1_5(RadioResponseInfo info, SetupDataCallResult dcResponse);

    /**
     * @param info Response info struct containing response type, serial no. and error
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:SUBSCRIPTION_NOT_AVAILABLE
     *   RadioError:NO_MEMORY
     *   RadioError:INTERNAL_ERR
     *   RadioError:SYSTEM_ERR
     *   RadioError:MODEM_ERR
     *   RadioError:INVALID_ARGUMENTS
     *   RadioError:NOT_PROVISIONED
     *   RadioError:REQUEST_NOT_SUPPORTED
     *   RadioError:NO_RESOURCES
     *   RadioError:CANCELLED
     */
    oneway setInitialAttachApnResponse_1_5(RadioResponseInfo info);

    /**
     * @param info Response info struct containing response type, serial no. and error
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:SUBSCRIPTION_NOT_AVAILABLE
     *   RadioError:INTERNAL_ERR
     *   RadioError:NO_MEMORY
     *   RadioError:NO_RESOURCES
     *   RadioError:CANCELLED
     *   RadioError:REQUEST_NOT_SUPPORTED
     *   RadioError:SIM_ABSENT
     */
    oneway setDataProfileResponse_1_5(RadioResponseInfo info);
};
+21 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import @1.1::ScanType;
import @1.1::UtranBands;
import @1.2::NetworkScanRequest;
import @1.4::AccessNetwork;
import @1.4::ApnTypes;
import @1.4::DataProfileInfo;

/**
 * Defining signal strength type.
@@ -268,3 +270,22 @@ struct NetworkScanRequest {
     */
    vec<string> mccMncs;
};

enum ApnTypes : @1.4::ApnTypes {
    /**
     * APN type for XCAP
     * NOTE: Due to the addition of this new value, the value ALL defined in
     * 1.0::ApnTypes is deprecated and should not be used.
     */
    XCAP = 1 << 11,
};

/**
 * Extended from @1.4::DataProfileInfo to update ApnTypes to 1.5 version
 */
struct DataProfileInfo {
    @1.4::DataProfileInfo base;

    /** Supported APN types bitmap. See ApnTypes for the value of each bit. */
    bitfield<ApnTypes> supportedApnTypesBitmap;
};
+137 −0
Original line number Diff line number Diff line
@@ -821,3 +821,140 @@ TEST_F(RadioHidlTest_v1_5, startNetworkScan_GoodRequest2) {
                                      RadioError::REQUEST_NOT_SUPPORTED}));
    }
}

/*
 * Test IRadio.setupDataCall_1_5() for the response returned.
 */
TEST_F(RadioHidlTest_v1_5, setupDataCall_1_5) {
    serial = GetRandomSerialNumber();

    ::android::hardware::radio::V1_5::AccessNetwork accessNetwork =
            ::android::hardware::radio::V1_5::AccessNetwork::EUTRAN;

    android::hardware::radio::V1_5::DataProfileInfo dataProfileInfo;
    memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
    dataProfileInfo.base.profileId = DataProfileId::DEFAULT;
    dataProfileInfo.base.apn = hidl_string("internet");
    dataProfileInfo.base.protocol = PdpProtocolType::IP;
    dataProfileInfo.base.roamingProtocol = PdpProtocolType::IP;
    dataProfileInfo.base.authType = ApnAuthType::NO_PAP_NO_CHAP;
    dataProfileInfo.base.user = hidl_string("username");
    dataProfileInfo.base.password = hidl_string("password");
    dataProfileInfo.base.type = DataProfileInfoType::THREE_GPP;
    dataProfileInfo.base.maxConnsTime = 300;
    dataProfileInfo.base.maxConns = 20;
    dataProfileInfo.base.waitTime = 0;
    dataProfileInfo.base.enabled = true;
    dataProfileInfo.supportedApnTypesBitmap = 320;
    dataProfileInfo.base.bearerBitmap = 161543;
    dataProfileInfo.base.mtu = 0;
    dataProfileInfo.base.preferred = true;
    dataProfileInfo.base.persistent = false;

    bool roamingAllowed = false;

    ::android::hardware::radio::V1_2::DataRequestReason reason =
            ::android::hardware::radio::V1_2::DataRequestReason::NORMAL;
    std::vector<hidl_string> addresses = {""};
    std::vector<hidl_string> dnses = {""};

    Return<void> res = radio_v1_5->setupDataCall_1_5(serial, accessNetwork, dataProfileInfo,
                                                     roamingAllowed, reason, addresses, dnses);
    ASSERT_OK(res);

    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);

    if (cardStatus.base.base.cardState == CardState::ABSENT) {
        ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
                                     {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE,
                                      RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
    } else if (cardStatus.base.base.cardState == CardState::PRESENT) {
        ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
                                     {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
                                      RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
    }
}

TEST_F(RadioHidlTest_v1_5, setInitialAttachApn_1_5) {
    serial = GetRandomSerialNumber();

    // Create a dataProfileInfo
    android::hardware::radio::V1_5::DataProfileInfo dataProfileInfo;
    memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
    dataProfileInfo.base.profileId = DataProfileId::DEFAULT;
    dataProfileInfo.base.apn = hidl_string("internet");
    dataProfileInfo.base.protocol = PdpProtocolType::IPV4V6;
    dataProfileInfo.base.roamingProtocol = PdpProtocolType::IPV4V6;
    dataProfileInfo.base.authType = ApnAuthType::NO_PAP_NO_CHAP;
    dataProfileInfo.base.user = hidl_string("username");
    dataProfileInfo.base.password = hidl_string("password");
    dataProfileInfo.base.type = DataProfileInfoType::THREE_GPP;
    dataProfileInfo.base.maxConnsTime = 300;
    dataProfileInfo.base.maxConns = 20;
    dataProfileInfo.base.waitTime = 0;
    dataProfileInfo.base.enabled = true;
    dataProfileInfo.supportedApnTypesBitmap = 320;
    dataProfileInfo.base.bearerBitmap = 161543;
    dataProfileInfo.base.mtu = 0;
    dataProfileInfo.base.preferred = true;
    dataProfileInfo.base.persistent = false;

    radio_v1_5->setInitialAttachApn_1_5(serial, dataProfileInfo);

    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);

    if (cardStatus.base.base.cardState == CardState::ABSENT) {
        ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
                                     {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
    } else if (cardStatus.base.base.cardState == CardState::PRESENT) {
        ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
                                     {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
    }
}

TEST_F(RadioHidlTest_v1_5, setDataProfile_1_5) {
    serial = GetRandomSerialNumber();

    // Create a dataProfileInfo
    android::hardware::radio::V1_5::DataProfileInfo dataProfileInfo;
    memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
    dataProfileInfo.base.profileId = DataProfileId::DEFAULT;
    dataProfileInfo.base.apn = hidl_string("internet");
    dataProfileInfo.base.protocol = PdpProtocolType::IPV4V6;
    dataProfileInfo.base.roamingProtocol = PdpProtocolType::IPV4V6;
    dataProfileInfo.base.authType = ApnAuthType::NO_PAP_NO_CHAP;
    dataProfileInfo.base.user = hidl_string("username");
    dataProfileInfo.base.password = hidl_string("password");
    dataProfileInfo.base.type = DataProfileInfoType::THREE_GPP;
    dataProfileInfo.base.maxConnsTime = 300;
    dataProfileInfo.base.maxConns = 20;
    dataProfileInfo.base.waitTime = 0;
    dataProfileInfo.base.enabled = true;
    dataProfileInfo.supportedApnTypesBitmap = 320;
    dataProfileInfo.base.bearerBitmap = 161543;
    dataProfileInfo.base.mtu = 0;
    dataProfileInfo.base.preferred = true;
    dataProfileInfo.base.persistent = true;

    // Create a dataProfileInfoList
    android::hardware::hidl_vec<android::hardware::radio::V1_5::DataProfileInfo>
            dataProfileInfoList = {dataProfileInfo};

    radio_v1_5->setDataProfile_1_5(serial, dataProfileInfoList);

    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);

    if (cardStatus.base.base.cardState == CardState::ABSENT) {
        ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
                                     {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
    } else if (cardStatus.base.base.cardState == CardState::PRESENT) {
        ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
                                     {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
    }
}
Loading