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

Commit 52770b1c authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "Fix error in RAN conversion in RIL"

parents 8fe6cac3 5b877d42
Loading
Loading
Loading
Loading
+27 −26
Original line number Original line Diff line number Diff line
@@ -2098,7 +2098,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, result,
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, result,
                    mRILDefaultWorkSource);
                    mRILDefaultWorkSource);
            try {
            try {
                int halRan = convertRanToHalRan(ran);
                int halRan = convertAntToRan(ran);
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
                            (android.hardware.radio.V1_5.IRadio) radioProxy;
                            (android.hardware.radio.V1_5.IRadio) radioProxy;
@@ -2158,7 +2158,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                break;
                break;
            default:
            default:
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                        + " not supported!");
                        + " not supported on IRadio 1.1!");
                return null;
                return null;
        }
        }


@@ -2180,10 +2180,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            convertRadioAccessSpecifierToRadioHAL_1_5(RadioAccessSpecifier ras) {
            convertRadioAccessSpecifierToRadioHAL_1_5(RadioAccessSpecifier ras) {
        android.hardware.radio.V1_5.RadioAccessSpecifier rasInHalFormat =
        android.hardware.radio.V1_5.RadioAccessSpecifier rasInHalFormat =
                new android.hardware.radio.V1_5.RadioAccessSpecifier();
                new android.hardware.radio.V1_5.RadioAccessSpecifier();
        int accessNetworkType = convertRanToAnt(ras.getRadioAccessNetwork());
        rasInHalFormat.radioAccessNetwork = convertAntToRan(ras.getRadioAccessNetwork());
        rasInHalFormat.radioAccessNetwork = accessNetworkType;
        List<Integer> bands;
        List<Integer> bands;
        switch (accessNetworkType) {
        switch (ras.getRadioAccessNetwork()) {
            case AccessNetworkType.GERAN:
            case AccessNetworkType.GERAN:
                bands = rasInHalFormat.bands.geranBands();
                bands = rasInHalFormat.bands.geranBands();
                break;
                break;
@@ -2198,7 +2197,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                break;
                break;
            default:
            default:
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                        + " not supported!");
                        + " not supported on IRadio 1.5!");
                return null;
                return null;
        }
        }


@@ -4608,7 +4607,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            signalThresholdInfo.getHysteresisMs(),
                            signalThresholdInfo.getHysteresisMs(),
                            signalThresholdInfo.getHysteresisDb(),
                            signalThresholdInfo.getHysteresisDb(),
                            primitiveArrayToArrayList(signalThresholdInfo.getThresholds()),
                            primitiveArrayToArrayList(signalThresholdInfo.getThresholds()),
                            convertRanToHalRan(ran));
                            convertAntToHalAnt(ran));
                } catch (RemoteException | RuntimeException e) {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSignalStrengthReportingCriteria", e);
                    handleRadioProxyExceptionForRR(rr, "setSignalStrengthReportingCriteria", e);
                }
                }
@@ -4624,7 +4623,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            (android.hardware.radio.V1_5.IRadio) radioProxy;
                            (android.hardware.radio.V1_5.IRadio) radioProxy;
                    radioProxy15.setSignalStrengthReportingCriteria_1_5(rr.mSerial,
                    radioProxy15.setSignalStrengthReportingCriteria_1_5(rr.mSerial,
                            convertToHalSignalThresholdInfo(signalThresholdInfo),
                            convertToHalSignalThresholdInfo(signalThresholdInfo),
                            convertRanToHalRan(ran));
                            convertAntToHalAnt(ran));
                } catch (RemoteException | RuntimeException e) {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(
                    handleRadioProxyExceptionForRR(
                            rr, "setSignalStrengthReportingCriteria_1_5", e);
                            rr, "setSignalStrengthReportingCriteria_1_5", e);
@@ -4664,7 +4663,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    radioProxy15.setLinkCapacityReportingCriteria_1_5(rr.mSerial, hysteresisMs,
                    radioProxy15.setLinkCapacityReportingCriteria_1_5(rr.mSerial, hysteresisMs,
                            hysteresisDlKbps, hysteresisUlKbps,
                            hysteresisDlKbps, hysteresisUlKbps,
                            primitiveArrayToArrayList(thresholdsDlKbps),
                            primitiveArrayToArrayList(thresholdsDlKbps),
                            primitiveArrayToArrayList(thresholdsUlKbps), convertRanToHalRan(ran));
                            primitiveArrayToArrayList(thresholdsUlKbps), convertAntToHalAnt(ran));
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
                    android.hardware.radio.V1_2.IRadio radioProxy12 =
                    android.hardware.radio.V1_2.IRadio radioProxy12 =
                            (android.hardware.radio.V1_2.IRadio) radioProxy;
                            (android.hardware.radio.V1_2.IRadio) radioProxy;
@@ -4674,7 +4673,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                    radioProxy12.setLinkCapacityReportingCriteria(rr.mSerial, hysteresisMs,
                    radioProxy12.setLinkCapacityReportingCriteria(rr.mSerial, hysteresisMs,
                            hysteresisDlKbps, hysteresisUlKbps,
                            hysteresisDlKbps, hysteresisUlKbps,
                            primitiveArrayToArrayList(thresholdsDlKbps),
                            primitiveArrayToArrayList(thresholdsDlKbps),
                            primitiveArrayToArrayList(thresholdsUlKbps), convertRanToHalRan(ran));
                            primitiveArrayToArrayList(thresholdsUlKbps), convertAntToHalAnt(ran));
                } else {
                } else {
                    riljLoge("setLinkCapacityReportingCriteria ignored on IRadio version less "
                    riljLoge("setLinkCapacityReportingCriteria ignored on IRadio version less "
                            + "than 1.2");
                            + "than 1.2");
@@ -4685,7 +4684,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
        }
    }
    }


    private static int convertRanToHalRan(int radioAccessNetwork) {
    /** Converts from AccessNetworkType in frameworks to AccessNetwork in HAL. */
    private static int convertAntToHalAnt(int radioAccessNetwork) {
        switch (radioAccessNetwork) {
        switch (radioAccessNetwork) {
            case AccessNetworkType.GERAN:
            case AccessNetworkType.GERAN:
                return AccessNetwork.GERAN;
                return AccessNetwork.GERAN;
@@ -4701,25 +4701,26 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return AccessNetwork.NGRAN;
                return AccessNetwork.NGRAN;
            case AccessNetworkType.UNKNOWN:
            case AccessNetworkType.UNKNOWN:
            default:
            default:
                return 0;
                return AccessNetwork.UNKNOWN;
        }
        }
    }
    }


    private static int convertRanToAnt(int radioAccessNetwork) {
    /** Converts from AccessNetworkType in frameworks to RadioAccessNetworks in HAL. */
        switch (radioAccessNetwork) {
    private static int convertAntToRan(int accessNetworkType) {
            case RadioAccessNetworks.GERAN:
        switch (accessNetworkType) {
                return AccessNetworkType.GERAN;
            case AccessNetworkType.GERAN:
            case RadioAccessNetworks.UTRAN:
                return RadioAccessNetworks.GERAN;
                return AccessNetworkType.UTRAN;
            case AccessNetworkType.UTRAN:
            case RadioAccessNetworks.EUTRAN:
                return RadioAccessNetworks.UTRAN;
                return AccessNetworkType.EUTRAN;
            case AccessNetworkType.EUTRAN:
            case RadioAccessNetworks.NGRAN:
                return RadioAccessNetworks.EUTRAN;
                return AccessNetworkType.NGRAN;
            case AccessNetworkType.NGRAN:
            case RadioAccessNetworks.CDMA2000:
                return RadioAccessNetworks.NGRAN;
                return AccessNetworkType.CDMA2000;
            case AccessNetworkType.CDMA2000:
            case RadioAccessNetworks.UNKNOWN:
                return RadioAccessNetworks.CDMA2000;
            case AccessNetworkType.UNKNOWN:
            default:
            default:
                return AccessNetworkType.UNKNOWN;
                return RadioAccessNetworks.UNKNOWN;
        }
        }
    }
    }