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

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

Merge "Fix bands logic in RAS conversion" into rvc-dev

parents 30434079 d9b259aa
Loading
Loading
Loading
Loading
+23 −20
Original line number Original line Diff line number Diff line
@@ -2419,28 +2419,28 @@ public class RIL extends BaseCommands implements CommandsInterface {
        android.hardware.radio.V1_1.RadioAccessSpecifier rasInHalFormat =
        android.hardware.radio.V1_1.RadioAccessSpecifier rasInHalFormat =
                new android.hardware.radio.V1_1.RadioAccessSpecifier();
                new android.hardware.radio.V1_1.RadioAccessSpecifier();
        rasInHalFormat.radioAccessNetwork = ras.getRadioAccessNetwork();
        rasInHalFormat.radioAccessNetwork = ras.getRadioAccessNetwork();
        List<Integer> bands = null;
        ArrayList<Integer> bands = new ArrayList<>();
        if (ras.getBands() != null) {
            for (int band : ras.getBands()) {
                bands.add(band);
            }
        }
        switch (ras.getRadioAccessNetwork()) {
        switch (ras.getRadioAccessNetwork()) {
            case AccessNetworkType.GERAN:
            case AccessNetworkType.GERAN:
                bands = rasInHalFormat.geranBands;
                rasInHalFormat.geranBands = bands;
                break;
                break;
            case AccessNetworkType.UTRAN:
            case AccessNetworkType.UTRAN:
                bands = rasInHalFormat.utranBands;
                rasInHalFormat.utranBands = bands;
                break;
                break;
            case AccessNetworkType.EUTRAN:
            case AccessNetworkType.EUTRAN:
                bands = rasInHalFormat.eutranBands;
                rasInHalFormat.eutranBands = bands;
                break;
                break;
            default:
            default:
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                        + " not supported on IRadio 1.1!");
                        + " not supported on IRadio < 1.5!");
                return null;
                return null;
        }
        }


        if (ras.getBands() != null) {
            for (int band : ras.getBands()) {
                bands.add(band);
            }
        }
        if (ras.getChannels() != null) {
        if (ras.getChannels() != null) {
            for (int channel : ras.getChannels()) {
            for (int channel : ras.getChannels()) {
                rasInHalFormat.channels.add(channel);
                rasInHalFormat.channels.add(channel);
@@ -2454,32 +2454,35 @@ 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();
        android.hardware.radio.V1_5.RadioAccessSpecifier.Bands bandsInHalFormat =
                new android.hardware.radio.V1_5.RadioAccessSpecifier.Bands();
        rasInHalFormat.radioAccessNetwork = convertAntToRan(ras.getRadioAccessNetwork());
        rasInHalFormat.radioAccessNetwork = convertAntToRan(ras.getRadioAccessNetwork());
        List<Integer> bands;
        ArrayList<Integer> bands = new ArrayList<>();
        if (ras.getBands() != null) {
            for (int band : ras.getBands()) {
                bands.add(band);
            }
        }
        switch (ras.getRadioAccessNetwork()) {
        switch (ras.getRadioAccessNetwork()) {
            case AccessNetworkType.GERAN:
            case AccessNetworkType.GERAN:
                bands = rasInHalFormat.bands.geranBands();
                bandsInHalFormat.geranBands(bands);
                break;
                break;
            case AccessNetworkType.UTRAN:
            case AccessNetworkType.UTRAN:
                bands = rasInHalFormat.bands.utranBands();
                bandsInHalFormat.utranBands(bands);
                break;
                break;
            case AccessNetworkType.EUTRAN:
            case AccessNetworkType.EUTRAN:
                bands = rasInHalFormat.bands.eutranBands();
                bandsInHalFormat.eutranBands(bands);
                break;
                break;
            case AccessNetworkType.NGRAN:
            case AccessNetworkType.NGRAN:
                bands = rasInHalFormat.bands.ngranBands();
                bandsInHalFormat.ngranBands(bands);
                break;
                break;
            default:
            default:
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.getRadioAccessNetwork()
                        + " not supported on IRadio 1.5!");
                        + " not supported on IRadio 1.5!");
                return null;
                return null;
        }
        }
        rasInHalFormat.bands = bandsInHalFormat;


        if (ras.getBands() != null) {
            for (int band : ras.getBands()) {
                bands.add(band);
            }
        }
        if (ras.getChannels() != null) {
        if (ras.getChannels() != null) {
            for (int channel : ras.getChannels()) {
            for (int channel : ras.getChannels()) {
                rasInHalFormat.channels.add(channel);
                rasInHalFormat.channels.add(channel);