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

Commit 78a41688 authored by Jordan Liu's avatar Jordan Liu Committed by Gerrit Code Review
Browse files

Merge "Add get/set PreferredNetworkTypeBitmap"

parents d762a8ef 46398c66
Loading
Loading
Loading
Loading
+29 −10
Original line number Diff line number Diff line
@@ -2452,11 +2452,22 @@ public class RIL extends BaseCommands implements CommandsInterface {
            mPreferredNetworkType = networkType;
            mMetrics.writeSetPreferredNetworkType(mPhoneId, networkType);

            if (mRadioVersion.lessOrEqual(RADIO_HAL_VERSION_1_3)) {
                try {
                    radioProxy.setPreferredNetworkType(rr.mSerial, networkType);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setPreferredNetworkType", e);
                }
            } else if (mRadioVersion.equals(RADIO_HAL_VERSION_1_4)) {
                android.hardware.radio.V1_4.IRadio radioProxy14 =
                        (android.hardware.radio.V1_4.IRadio) radioProxy;
                try {
                    radioProxy14.setPreferredNetworkTypeBitmap(
                            rr.mSerial, RadioAccessFamily.getRafFromNetworkType(networkType));
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setPreferredNetworkTypeBitmap", e);
                }
            }
        }
    }

@@ -2466,14 +2477,22 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, result,
                    mRILDefaultWorkSource);

            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

            if (mRadioVersion.lessOrEqual(RADIO_HAL_VERSION_1_3)) {
                try {
                    radioProxy.getPreferredNetworkType(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "getPreferredNetworkType", e);
                }
            } else if (mRadioVersion.equals(RADIO_HAL_VERSION_1_4)) {
                android.hardware.radio.V1_4.IRadio radioProxy14 =
                        (android.hardware.radio.V1_4.IRadio) radioProxy;
                try {
                    radioProxy14.getPreferredNetworkTypeBitmap(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "getPreferredNetworkTypeBitmap", e);
                }
            }
        }
    }

+22 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.telephony.CellInfo;
import android.telephony.ModemActivityInfo;
import android.telephony.NeighboringCellInfo;
import android.telephony.PhoneNumberUtils;
import android.telephony.RadioAccessFamily;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -726,6 +727,14 @@ public class RadioResponse extends IRadioResponse.Stub {
        responseVoid(responseInfo);
    }

    /**
     * Callback of setPreferredNetworkTypeBitmap defined in IRadio.hal.
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void setPreferredNetworkTypeBitmapResponse(RadioResponseInfo responseInfo) {
        responseVoid(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
@@ -736,6 +745,19 @@ public class RadioResponse extends IRadioResponse.Stub {
        responseInts(responseInfo, nwType);
    }

    /**
     * Callback of the getPreferredNetworkTypeBitmap defined in the IRadio.hal.
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param networkTypeBitmap a 32-bit bitmap of
     * {@link android.telephony.TelephonyManager.NetworkTypeBitMask}.
     */
    public void getPreferredNetworkTypeBitmapResponse(
            RadioResponseInfo responseInfo, int networkTypeBitmap) {
        int networkType = RadioAccessFamily.getNetworkTypeFromRaf(networkTypeBitmap);
        mRil.mPreferredNetworkType = networkType;
        responseInts(responseInfo, networkType);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error