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

Commit 725fd189 authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "Manual network selection by RAN type"

parents caf1d90a ac94d34b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.net.LinkProperties;
import android.os.Handler;
import android.os.Message;
import android.os.WorkSource;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
import android.telephony.ImsiEncryptionInfo;
@@ -1376,8 +1377,15 @@ public interface CommandsInterface {
    @UnsupportedAppUsage
    void setNetworkSelectionModeAutomatic(Message response);

    /**
     * Ask the radio to connect to the input network with specific RadioAccessNetwork
     * and change selection mode to manual.
     * @param operatorNumeric PLMN ID of the network to select.
     * @param ran radio access network type (see {@link AccessNetworkType}).
     * @param response callback message.
     */
    @UnsupportedAppUsage
    void setNetworkSelectionModeManual(String operatorNumeric, Message response);
    void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message response);

    /**
     * Queries whether the current network selection mode is automatic
+1 −1
Original line number Diff line number Diff line
@@ -1384,7 +1384,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        nsm.operatorAlphaShort = network.getOperatorAlphaShort();

        Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), network.getRan(), msg);

        if (persistSelection) {
            updateSavedNetworkOperator(nsm);
+38 −9
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.hardware.radio.V1_0.UusInfo;
import android.hardware.radio.V1_4.CarrierRestrictionsWithPriority;
import android.hardware.radio.V1_4.SimLockMultiSimPolicy;
import android.hardware.radio.V1_5.AccessNetwork;
import android.hardware.radio.V1_5.RadioAccessNetworks;
import android.hardware.radio.deprecated.V1_0.IOemHook;
import android.net.ConnectivityManager;
import android.net.InetAddresses;
@@ -2092,20 +2093,31 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void setNetworkSelectionModeManual(String operatorNumeric, Message result) {
    public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, result,
                    mRILDefaultWorkSource);

            try {
                int accessNetwork = convertRanToAnt(ran);
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
                            (android.hardware.radio.V1_5.IRadio) radioProxy;
                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                                + " operatorNumeric = " + operatorNumeric
                                + ", ran = " + accessNetwork);
                    }
                    radioProxy15.setNetworkSelectionModeManual_1_5(rr.mSerial,
                            convertNullToEmptyString(operatorNumeric), accessNetwork);
                } else {
                    if (RILJ_LOGD) {
                        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                                + " operatorNumeric = " + operatorNumeric);
                    }

            try {
                    radioProxy.setNetworkSelectionModeManual(rr.mSerial,
                            convertNullToEmptyString(operatorNumeric));
                }
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setNetworkSelectionModeManual", e);
            }
@@ -4686,6 +4698,23 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    private static int convertRanToAnt(int radioAccessNetwork) {
        switch(radioAccessNetwork) {
            case RadioAccessNetworks.GERAN:
                return AccessNetworkType.GERAN;
            case RadioAccessNetworks.UTRAN:
                return AccessNetworkType.UTRAN;
            case RadioAccessNetworks.EUTRAN:
                return AccessNetworkType.EUTRAN;
            case RadioAccessNetworks.NGRAN:
                return AccessNetworkType.NGRAN;
            case RadioAccessNetworks.CDMA2000:
                return AccessNetworkType.CDMA2000;
            default:
                return AccessNetworkType.UNKNOWN;
        }
    }

    @Override
    public void setSimCardPower(int state, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
+1 −2
Original line number Diff line number Diff line
@@ -338,8 +338,7 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
    }

    @Override
    public void setNetworkSelectionModeManual(
            String operatorNumeric, Message response) {
    public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message response) {
    }

    @Override
+1 −2
Original line number Diff line number Diff line
@@ -339,8 +339,7 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void setNetworkSelectionModeManual(
            String operatorNumeric, Message response) {
    public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message response) {
    }

    @Override
Loading