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

Commit 5e569f34 authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Migration of IRadio 1.3 types to 1.4.

To better test CBRS, we want IRadio 1.3 to be Android P plus CBRS
HAL interfaces, while 1.4 will be 1.3 plus all other Android Q
interfaces. So we are moving everything currently defined in
android.hardware.radio.V1_3 to android.hardware.radio.V1_4.

Bug: 117805040
Test: build and telephony unittest
Change-Id: Ifa3d302a4fd64ec244cee2a0eccb3f55622d5532
parent b6cc1c25
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ java_library {
        "android.hardware.radio-V1.1-java",
        "android.hardware.radio-V1.2-java",
        "android.hardware.radio-V1.3-java",
        "android.hardware.radio-V1.4-java",
        "android.hardware.radio.config-V1.0-java",
        "android.hardware.radio.config-V1.1-java",
        "android.hardware.radio.deprecated-V1.0-java",
+3 −3
Original line number Diff line number Diff line
@@ -294,9 +294,9 @@ public class CellularNetworkService extends NetworkService {
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, maxDataCalls, false /* isDcNrRestricted */,
                        false /* isNrAvailable */);
            } else if (result instanceof android.hardware.radio.V1_3.DataRegStateResult) {
                android.hardware.radio.V1_3.DataRegStateResult dataRegState =
                        (android.hardware.radio.V1_3.DataRegStateResult) result;
            } else if (result instanceof android.hardware.radio.V1_4.DataRegStateResult) {
                android.hardware.radio.V1_4.DataRegStateResult dataRegState =
                        (android.hardware.radio.V1_4.DataRegStateResult) result;
                int regState = getRegStateFromHalRegState(dataRegState.base.regState);
                int accessNetworkTechnology = getAccessNetworkTechnologyFromRat(
                        dataRegState.base.rat);
+42 −31
Original line number Diff line number Diff line
@@ -165,6 +165,8 @@ public class RIL extends BaseCommands implements CommandsInterface {

    private static final HalVersion RADIO_HAL_VERSION_1_3 = new HalVersion(1, 3);

    private static final HalVersion RADIO_HAL_VERSION_1_4 = new HalVersion(1, 4);

    // IRadio version
    private HalVersion mRadioVersion = RADIO_HAL_VERSION_UNKNOWN;

@@ -400,12 +402,21 @@ public class RIL extends BaseCommands implements CommandsInterface {
                riljLoge("getRadioProxy: mRadioProxy for " + HIDL_SERVICE_NAME[mPhoneId]
                        + " is disabled");
            } else {
                try {
                    mRadioProxy = android.hardware.radio.V1_4.IRadio.getService(
                            HIDL_SERVICE_NAME[mPhoneId], true);
                    mRadioVersion = RADIO_HAL_VERSION_1_4;
                } catch (NoSuchElementException e) {
                }

                if (mRadioProxy == null) {
                    try {
                        mRadioProxy = android.hardware.radio.V1_3.IRadio.getService(
                                HIDL_SERVICE_NAME[mPhoneId], true);
                        mRadioVersion = RADIO_HAL_VERSION_1_3;
                    } catch (NoSuchElementException e) {
                    }
                }

                if (mRadioProxy == null) {
                    try {
@@ -1235,14 +1246,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    /**
     * Convert to DataProfileInfo defined in radio/1.3/types.hal
     * Convert to DataProfileInfo defined in radio/1.4/types.hal
     * @param dp Data profile
     * @return A converted data profile
     */
    private static android.hardware.radio.V1_3.DataProfileInfo convertToHalDataProfile13(
    private static android.hardware.radio.V1_4.DataProfileInfo convertToHalDataProfile14(
            DataProfile dp) {
        android.hardware.radio.V1_3.DataProfileInfo dpi =
                new android.hardware.radio.V1_3.DataProfileInfo();
        android.hardware.radio.V1_4.DataProfileInfo dpi =
                new android.hardware.radio.V1_4.DataProfileInfo();

        dpi.apn = dp.getApn();
        dpi.protocol = dp.getProtocol();
@@ -1311,14 +1322,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
                    // IRadio V1.3
                    android.hardware.radio.V1_3.IRadio radioProxy13 =
                            (android.hardware.radio.V1_3.IRadio) radioProxy;
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                    // IRadio V1.4
                    android.hardware.radio.V1_4.IRadio radioProxy14 =
                            (android.hardware.radio.V1_4.IRadio) radioProxy;

                    // Convert to HAL data profile
                    android.hardware.radio.V1_3.DataProfileInfo dpi =
                            convertToHalDataProfile13(dataProfile);
                    android.hardware.radio.V1_4.DataProfileInfo dpi =
                            convertToHalDataProfile14(dataProfile);

                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -1327,10 +1338,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
                                + ",addresses=" + addresses + ",dnses=" + dnses);
                    }

                    radioProxy13.setupDataCall_1_3(rr.mSerial, accessNetworkType, dpi, allowRoaming,
                    radioProxy14.setupDataCall_1_4(rr.mSerial, accessNetworkType, dpi, allowRoaming,
                            reason, addresses, dnses);
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
                    // IRadio V1.2
                    // IRadio V1.2 and IRadio V1.3
                    android.hardware.radio.V1_2.IRadio radioProxy12 =
                            (android.hardware.radio.V1_2.IRadio) radioProxy;

@@ -3144,14 +3155,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
                    // v1.3
                    android.hardware.radio.V1_3.IRadio radioProxy13 =
                            (android.hardware.radio.V1_3.IRadio) radioProxy;
                    radioProxy13.setInitialAttachApn_1_3(rr.mSerial,
                            convertToHalDataProfile13(dataProfile));
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                    // v1.4
                    android.hardware.radio.V1_4.IRadio radioProxy14 =
                            (android.hardware.radio.V1_4.IRadio) radioProxy;
                    radioProxy14.setInitialAttachApn_1_4(rr.mSerial,
                            convertToHalDataProfile14(dataProfile));
                } else {
                    // v1.2, v1.1, and v1.0
                    // v1.3, v1.2, v1.1, and v1.0
                    radioProxy.setInitialAttachApn(rr.mSerial,
                            convertToHalDataProfile10(dataProfile), dataProfile.isPersistent(),
                            isRoaming);
@@ -3544,17 +3555,17 @@ public class RIL extends BaseCommands implements CommandsInterface {

            RILRequest rr = null;
            try {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
                    // V1.3
                    android.hardware.radio.V1_3.IRadio radioProxy13 =
                            (android.hardware.radio.V1_3.IRadio) radioProxy;
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                    // V1.4
                    android.hardware.radio.V1_4.IRadio radioProxy14 =
                            (android.hardware.radio.V1_4.IRadio) radioProxy;

                    rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
                            mRILDefaultWorkSource);

                    ArrayList<android.hardware.radio.V1_3.DataProfileInfo> dpis = new ArrayList<>();
                    ArrayList<android.hardware.radio.V1_4.DataProfileInfo> dpis = new ArrayList<>();
                    for (DataProfile dp : dps) {
                        dpis.add(convertToHalDataProfile13(dp));
                        dpis.add(convertToHalDataProfile14(dp));
                    }

                    if (RILJ_LOGD) {
@@ -3565,9 +3576,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        }
                    }

                    radioProxy13.setDataProfile_1_3(rr.mSerial, dpis);
                    radioProxy14.setDataProfile_1_4(rr.mSerial, dpis);
                } else {
                    // V1.0, 1.1, and 1.2
                    // V1.0, 1.1, 1,2 and 1.3
                    ArrayList<android.hardware.radio.V1_0.DataProfileInfo> dpis = new ArrayList<>();
                    for (DataProfile dp : dps) {
                        // For v1.0 to v1.2, we only send data profiles that has the persistent
@@ -5806,10 +5817,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
                TransportManager.IWLAN_OPERATION_MODE_DEFAULT);

        // If the operation mode is default, then we use the HAL version to determine it.
        // On 1.3 or later version of IRadio, it is expected the device to support
        // On 1.4 or later version of IRadio, it is expected the device to support
        // IWLAN AP-assisted mode.
        if (mode == TransportManager.IWLAN_OPERATION_MODE_DEFAULT) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                return TransportManager.IWLAN_OPERATION_MODE_AP_ASSISTED;
            } else {
                return TransportManager.IWLAN_OPERATION_MODE_LEGACY;
+6 −6
Original line number Diff line number Diff line
@@ -113,11 +113,11 @@ public class RadioResponse extends IRadioResponse.Stub {

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param cardStatus ICC card status as defined by CardStatus in 1.3/types.hal
     * @param cardStatus ICC card status as defined by CardStatus in 1.4/types.hal
     */
    public void getIccCardStatusResponse_1_3(RadioResponseInfo responseInfo,
                                             android.hardware.radio.V1_3.CardStatus cardStatus) {
        responseIccCardStatus_1_3(responseInfo, cardStatus);
    public void getIccCardStatusResponse_1_4(RadioResponseInfo responseInfo,
                                             android.hardware.radio.V1_4.CardStatus cardStatus) {
        responseIccCardStatus_1_4(responseInfo, cardStatus);
    }

    /**
@@ -1450,8 +1450,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
    }

    private void responseIccCardStatus_1_3(RadioResponseInfo responseInfo,
                                           android.hardware.radio.V1_3.CardStatus cardStatus) {
    private void responseIccCardStatus_1_4(RadioResponseInfo responseInfo,
                                           android.hardware.radio.V1_4.CardStatus cardStatus) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {