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

Commit d869094f authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Refactored Radio HAL service version detection"

am: e385cdd4

Change-Id: I7b7c371e09a64136338b46c1b2ab1e493d9282b7
parents ca4e3bca e385cdd4
Loading
Loading
Loading
Loading
+184 −201
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    private static final HalVersion RADIO_HAL_VERSION_1_3 = new HalVersion(1, 3);

    // IRadio version
    private final HalVersion mHalVersion;
    private HalVersion mRadioVersion;

    //***** Instance Variables

@@ -400,8 +400,40 @@ public class RIL extends BaseCommands implements CommandsInterface {
                riljLoge("getRadioProxy: mRadioProxy for " + HIDL_SERVICE_NAME[mPhoneId]
                        + " is disabled");
            } else {
                mRadioProxy = IRadio.getService(HIDL_SERVICE_NAME[mPhoneId],
                        true);
                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 {
                        mRadioProxy = android.hardware.radio.V1_2.IRadio.getService(
                                HIDL_SERVICE_NAME[mPhoneId], true);
                        mRadioVersion = RADIO_HAL_VERSION_1_2;
                    } catch (NoSuchElementException e) {
                    }
                }

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

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

                if (mRadioProxy != null) {
                    mRadioProxy.linkToDeath(mRadioProxyDeathRecipient,
                            mRadioProxyCookie.incrementAndGet());
@@ -412,9 +444,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            + HIDL_SERVICE_NAME[mPhoneId] + " is disabled");
                }
            }
        } catch (NoSuchElementException e) {
            mRadioProxy = null;
            riljLoge("IRadio service is not on the device HAL: " + e);
        } catch (RemoteException e) {
            mRadioProxy = null;
            riljLoge("RadioProxy getService/setResponseFunctions: " + e);
@@ -538,9 +567,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        getRadioProxy(null);
        getOemHookProxy(null);

        mHalVersion = getRadioHalVersion();
        if (RILJ_LOGD) {
            riljLog("Radio HAL version: " + mHalVersion);
            riljLog("Radio HAL version: " + mRadioVersion);
        }
    }

@@ -1264,16 +1292,13 @@ public class RIL extends BaseCommands implements CommandsInterface {
                              boolean allowRoaming, int reason, LinkProperties linkProperties,
                              Message result) {

        IRadio radioProxy10 = getRadioProxy(result);
        IRadio radioProxy = getRadioProxy(result);

        if (radioProxy10 != null) {
        if (radioProxy != null) {

            RILRequest rr = obtainRequest(RIL_REQUEST_SETUP_DATA_CALL, result,
                    mRILDefaultWorkSource);

            android.hardware.radio.V1_3.IRadio radioProxy13 =
                    android.hardware.radio.V1_3.IRadio.castFrom(radioProxy10);

            ArrayList<String> addresses = new ArrayList<>();
            ArrayList<String> dnses = new ArrayList<>();
            if (linkProperties != null) {
@@ -1286,10 +1311,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                // Note that we should always try the highest version first. If the vendor IRadio
                // is v1.3, both radioProxy13 and radioProxy12 will be non-null.
                if (radioProxy13 != null) {
                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;

                    // Convert to HAL data profile
                    android.hardware.radio.V1_3.DataProfileInfo dpi =
@@ -1304,11 +1329,10 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

                    // Convert to HAL data profile
                    android.hardware.radio.V1_0.DataProfileInfo dpi =
@@ -1324,7 +1348,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    radioProxy12.setupDataCall_1_2(rr.mSerial, accessNetworkType, dpi,
                            dataProfile.isPersistent(), allowRoaming, isRoaming, reason,
                            addresses, dnses);
                    } else {
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_0)) {
                    // IRadio V1.0 and IRadio V1.1

                    // Convert to HAL data profile
@@ -1350,10 +1374,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
                                + ",allowRoaming=" + allowRoaming + "," + dataProfile);
                    }

                        radioProxy10.setupDataCall(rr.mSerial, dataRat, dpi,
                    radioProxy.setupDataCall(rr.mSerial, dataRat, dpi,
                            dataProfile.isPersistent(), allowRoaming, isRoaming);
                }
                }
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setupDataCall", e);
            }
@@ -1637,15 +1660,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        + requestToString(rr.mRequest) + " cid = " + cid + " reason = " + reason);
            }

            try {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
                    android.hardware.radio.V1_2.IRadio radioProxy12 =
                    android.hardware.radio.V1_2.IRadio.castFrom(radioProxy);
                            (android.hardware.radio.V1_2.IRadio) radioProxy;

            try {
                if (radioProxy12 == null) {
                    radioProxy12.deactivateDataCall_1_2(rr.mSerial, cid, reason);
                } else {
                    radioProxy.deactivateDataCall(rr.mSerial, cid,
                            (reason == DataService.REQUEST_REASON_SHUTDOWN));
                } else {
                    radioProxy12.deactivateDataCall_1_2(rr.mSerial, cid, reason);
                }
                mMetrics.writeRilDeactivateDataCall(mPhoneId, rr.mSerial, cid, reason);
            } catch (RemoteException | RuntimeException e) {
@@ -1856,9 +1879,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void startNetworkScan(NetworkScanRequest nsr, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
                android.hardware.radio.V1_2.IRadio radioProxy12 =
                    android.hardware.radio.V1_2.IRadio.castFrom(radioProxy);
            if (radioProxy12 != null) {
                        (android.hardware.radio.V1_2.IRadio) radioProxy;

                android.hardware.radio.V1_2.NetworkScanRequest request =
                        new android.hardware.radio.V1_2.NetworkScanRequest();
                request.type = nsr.getScanType();
@@ -1891,16 +1915,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "startNetworkScan", e);
                }
            } else {
            } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
                android.hardware.radio.V1_1.IRadio radioProxy11 =
                        android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
                if (radioProxy11 == null) {
                    if (result != null) {
                        AsyncResult.forMessage(result, null,
                                CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                        result.sendToTarget();
                    }
                } else {
                        (android.hardware.radio.V1_1.IRadio) radioProxy;

                android.hardware.radio.V1_1.NetworkScanRequest request =
                        new android.hardware.radio.V1_1.NetworkScanRequest();
                request.type = nsr.getScanType();
@@ -1927,7 +1945,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "startNetworkScan", e);
                }
                }
            } else if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
        }
    }
@@ -1936,15 +1957,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void stopNetworkScan(Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
                android.hardware.radio.V1_1.IRadio radioProxy11 =
                    android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
            if (radioProxy11 == null) {
                if (result != null) {
                    AsyncResult.forMessage(result, null,
                            CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                    result.sendToTarget();
                }
            } else {
                        (android.hardware.radio.V1_1.IRadio) radioProxy;

                RILRequest rr = obtainRequest(RIL_REQUEST_STOP_NETWORK_SCAN, result,
                        mRILDefaultWorkSource);

@@ -1957,6 +1973,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "stopNetworkScan", e);
                }
            } else if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
        }
    }
@@ -3114,8 +3134,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {

        IRadio radioProxy10 = getRadioProxy(result);
        if (radioProxy10 != null) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, result,
                    mRILDefaultWorkSource);

@@ -3123,23 +3143,19 @@ public class RIL extends BaseCommands implements CommandsInterface {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + dataProfile);
            }

            android.hardware.radio.V1_3.IRadio radioProxy13 =
                    android.hardware.radio.V1_3.IRadio.castFrom(radioProxy10);

            try {
                // Note that we should always try the highest version first. If the vendor IRadio
                // is v1.3, both radioProxy13 and radioProxy10 will be non-null.
                if (radioProxy13 != null) {
                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));
                } else {
                    // v1.2, v1.1, and v1.0
                    radioProxy10.setInitialAttachApn(rr.mSerial,
                    radioProxy.setInitialAttachApn(rr.mSerial,
                            convertToHalDataProfile10(dataProfile), dataProfile.isPersistent(),
                            isRoaming);
                }

            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setInitialAttachApn", e);
            }
@@ -3523,17 +3539,16 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {

        IRadio radioProxy10 = getRadioProxy(result);
        if (radioProxy10 != null) {
            android.hardware.radio.V1_3.IRadio radioProxy13 =
                    android.hardware.radio.V1_3.IRadio.castFrom(radioProxy10);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {

            RILRequest rr = null;
            try {
                // Note that we should always try the highest version first. If the vendor IRadio
                // is v1.3, both radioProxy13 and radioProxy10 will be non-null.
                if (radioProxy13 != null) {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
                    // V1.3
                    android.hardware.radio.V1_3.IRadio radioProxy13 =
                            (android.hardware.radio.V1_3.IRadio) radioProxy;

                    rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
                            mRILDefaultWorkSource);

@@ -3574,9 +3589,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            }
                        }

                        radioProxy10.setDataProfile(rr.mSerial, dpis, isRoaming);
                        radioProxy.setDataProfile(rr.mSerial, dpis, isRoaming);
                    }

                }
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setDataProfile", e);
@@ -3654,9 +3668,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void startLceService(int reportIntervalMs, boolean pullMode, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        android.hardware.radio.V1_2.IRadio radioProxy12 =
                android.hardware.radio.V1_2.IRadio.castFrom(radioProxy);
        if (radioProxy12 != null) {

        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
            // We have a 1.2 or later radio, so the LCE 1.0 LCE service control path is unused.
            // Instead the LCE functionality is always-on and provides unsolicited indications.
            return;
@@ -3682,9 +3695,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void stopLceService(Message result) {
        IRadio radioProxy = getRadioProxy(result);
        android.hardware.radio.V1_2.IRadio radioProxy12 =
                android.hardware.radio.V1_2.IRadio.castFrom(radioProxy);
        if (radioProxy12 != null) {
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
            // We have a 1.2 or later radio, so the LCE 1.0 LCE service control is unused.
            // Instead the LCE functionality is always-on and provides unsolicited indications.
            return;
@@ -3878,11 +3889,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + filter);
            }

            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
                try {
                    android.hardware.radio.V1_2.IRadio radioProxy12 =
                    android.hardware.radio.V1_2.IRadio.castFrom(radioProxy);
                            (android.hardware.radio.V1_2.IRadio) radioProxy;

            if (radioProxy12 != null) {
                try {
                    radioProxy12.setIndicationFilter_1_2(rr.mSerial, filter);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setIndicationFilter_1_2", e);
@@ -3903,10 +3914,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            int[] thresholdsDbm, int ran, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            android.hardware.radio.V1_2.IRadio radioProxy12 =
                    android.hardware.radio.V1_2.IRadio.castFrom(radioProxy);
            if (radioProxy12 == null) {
                riljLoge("setSignalStrengthReportingCriteria ignored. RadioProxy 1.2 is null!");
            if (mRadioVersion.less(RADIO_HAL_VERSION_1_2)) {
                riljLoge("setSignalStrengthReportingCriteria ignored on IRadio version less "
                        + "than 1.2");
                return;
            }

@@ -3918,6 +3928,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                android.hardware.radio.V1_2.IRadio radioProxy12 =
                        (android.hardware.radio.V1_2.IRadio) radioProxy;
                radioProxy12.setSignalStrengthReportingCriteria(rr.mSerial, hysteresisMs,
                        hysteresisDb, primitiveArrayToArrayList(thresholdsDbm),
                        convertRanToHalRan(ran));
@@ -3933,10 +3945,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            android.hardware.radio.V1_2.IRadio radioProxy12 =
                    android.hardware.radio.V1_2.IRadio.castFrom(radioProxy);
            if (radioProxy12 == null) {
                riljLoge("setLinkCapacityReportingCriteria ignored. RadioProxy 1.2 is null!");
            if (mRadioVersion.less(RADIO_HAL_VERSION_1_2)) {
                riljLoge("setLinkCapacityReportingCriteria ignored on IRadio version less "
                        + "than 1.2");
                return;
            }

@@ -3948,6 +3959,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                android.hardware.radio.V1_2.IRadio radioProxy12 =
                        (android.hardware.radio.V1_2.IRadio) radioProxy;
                radioProxy12.setLinkCapacityReportingCriteria(rr.mSerial, hysteresisMs,
                        hysteresisDlKbps, hysteresisUlKbps,
                        primitiveArrayToArrayList(thresholdsDlKbps),
@@ -3987,9 +4000,16 @@ public class RIL extends BaseCommands implements CommandsInterface {
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + state);
            }

            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
                try {
                    android.hardware.radio.V1_1.IRadio radioProxy11 =
                    android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
            if (radioProxy11 == null) {
                            (android.hardware.radio.V1_1.IRadio) radioProxy;
                    radioProxy11.setSimCardPower_1_1(rr.mSerial, state);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                }
            } else {
                try {
                    switch (state) {
                        case TelephonyManager.CARD_POWER_DOWN: {
@@ -4011,12 +4031,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                }
            } else {
                try {
                    radioProxy11.setSimCardPower_1_1(rr.mSerial, state);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                }
            }
        }
    }
@@ -4027,15 +4041,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
        checkNotNull(imsiEncryptionInfo, "ImsiEncryptionInfo cannot be null.");
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
                android.hardware.radio.V1_1.IRadio radioProxy11 =
                    android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
            if (radioProxy11 == null) {
                if (result != null) {
                    AsyncResult.forMessage(result, null,
                            CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                    result.sendToTarget();
                }
            } else {
                        (android.hardware.radio.V1_1.IRadio ) radioProxy;

                RILRequest rr = obtainRequest(RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, result,
                        mRILDefaultWorkSource);
                if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
@@ -4059,6 +4068,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setCarrierInfoForImsiEncryption", e);
                }
            } else if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
        }
    }
@@ -4073,9 +4086,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            return;
        }

        android.hardware.radio.V1_1.IRadio radioProxy11 =
                android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
        if (radioProxy11 == null) {
        if (mRadioVersion.less(RADIO_HAL_VERSION_1_1)) {
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
@@ -4084,6 +4095,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            return;
        }

        android.hardware.radio.V1_1.IRadio radioProxy11 =
                (android.hardware.radio.V1_1.IRadio) radioProxy;

        RILRequest rr = obtainRequest(
                RIL_REQUEST_START_KEEPALIVE, result, mRILDefaultWorkSource);

@@ -4128,9 +4142,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            return;
        }

        android.hardware.radio.V1_1.IRadio radioProxy11 =
                android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
        if (radioProxy11 == null) {
        if (mRadioVersion.less(RADIO_HAL_VERSION_1_1)) {
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
@@ -4139,6 +4151,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            return;
        }

        android.hardware.radio.V1_1.IRadio radioProxy11 =
                (android.hardware.radio.V1_1.IRadio) radioProxy;

        RILRequest rr = obtainRequest(
                RIL_REQUEST_STOP_KEEPALIVE, result, mRILDefaultWorkSource);

@@ -5763,38 +5778,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
                signalStrength.wcdma.rscp);
    }

    private HalVersion getRadioHalVersion() {
        if (mHalVersion != null) {
            return mHalVersion;
        }

        IRadio radioProxy10 = getRadioProxy(null);

        if (radioProxy10 != null) {
            android.hardware.radio.V1_3.IRadio radioProxy13 =
                    android.hardware.radio.V1_3.IRadio.castFrom(radioProxy10);
            if (radioProxy13 != null) {
                return RADIO_HAL_VERSION_1_3;
            }

            android.hardware.radio.V1_2.IRadio radioProxy12 =
                    android.hardware.radio.V1_2.IRadio.castFrom(radioProxy10);
            if (radioProxy12 != null) {
                return RADIO_HAL_VERSION_1_2;
            }

            android.hardware.radio.V1_1.IRadio radioProxy11 =
                    android.hardware.radio.V1_1.IRadio.castFrom(radioProxy10);
            if (radioProxy11 != null) {
                return RADIO_HAL_VERSION_1_1;
            }

            return RADIO_HAL_VERSION_1_0;
        }

        return RADIO_HAL_VERSION_UNKNOWN;
    }

    /**
     * @return The {@link IwlanOperationMode IWLAN operation mode}
     */
@@ -5808,7 +5791,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        // On 1.3 or later version of IRadio, it is expected the device to support
        // IWLAN AP-assisted mode.
        if (mode == TransportManager.IWLAN_OPERATION_MODE_DEFAULT) {
            if (getRadioHalVersion().greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
                return TransportManager.IWLAN_OPERATION_MODE_AP_ASSISTED;
            } else {
                return TransportManager.IWLAN_OPERATION_MODE_LEGACY;