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

Commit 862ecb10 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati Committed by Android (Google) Code Review
Browse files

Merge "Add new satellite APIs for cellular modem." into main

parents 4557d64b e7177ad3
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -2952,4 +2952,39 @@ public interface CommandsInterface {
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForSecurityAlgorithmUpdates(Handler h) {}

    /**
     * Set the non-terrestrial PLMN with lower priority than terrestrial networks.
     *
     * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
     *                this information to determine the relevant carrier.
     * @param carrierPlmnList The list of roaming PLMN used for connecting to satellite networks
     *                        supported by user subscription.
     * @param allSatellitePlmnList Modem should use the allSatellitePlmnList to identify satellite
     *                             PLMNs that are not supported by the carrier and make sure not to
     *                             attach to them.
     * @param result Callback message to receive the result.
     */
    default void setSatellitePlmn(int simSlot,
            @NonNull List<String> carrierPlmnList, @NonNull List<String> allSatellitePlmnList,
            Message result) {}

    /**
     * Enable or disable satellite in the cellular modem associated with a carrier.
     *
     * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
     *                this information to determine the relevant carrier.
     * @param satelliteEnabled {@code true} to enable satellite, {@code false} to disable satellite.
     * @param result Callback message to receive the result.
     */
    default void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
            Message result) {}

    /**
     * Check whether satellite is enabled in the cellular modem associated with a carrier.
     *
     * @param simSlot Indicates the SIM slot to which this API will be applied.
     * @param result Callback message to receive the result.
     */
    default void isSatelliteEnabledForCarrier(int simSlot, Message result) {}
}
+30 −0
Original line number Diff line number Diff line
@@ -551,6 +551,36 @@ public class NetworkResponse extends IRadioNetworkResponse.Stub {
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void setSatellitePlmnResponse(RadioResponseInfo responseInfo) {
        RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void setSatelliteEnabledForCarrierResponse(RadioResponseInfo responseInfo) {
        RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error.
     * @param isEnabled Indicates whether satellite is enabled for carrier or not.
     */
    public void isSatelliteEnabledForCarrierResponse(RadioResponseInfo responseInfo,
            boolean isEnabled) {
        RILRequest rr = mRil.processResponse(HAL_SERVICE_NETWORK, responseInfo);

        if (rr != null) {
            if (responseInfo.error == RadioError.NONE) {
                RadioResponse.sendMessageResponse(rr.mResult, isEnabled);
            }
            mRil.processResponseDone(rr, responseInfo, isEnabled);
        }
    }

    @Override
    public String getInterfaceHash() {
        return IRadioNetworkResponse.HASH;
+100 −0
Original line number Diff line number Diff line
@@ -181,6 +181,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
    /** @hide */
    public static final HalVersion RADIO_HAL_VERSION_2_3 = new HalVersion(2, 3);

    /** @hide */
    public static final HalVersion RADIO_HAL_VERSION_2_4 = new HalVersion(2, 4);

    // Hal version
    private final Map<Integer, HalVersion> mHalVersion = new HashMap<>();

@@ -5352,6 +5355,102 @@ public class RIL extends BaseCommands implements CommandsInterface {
            });
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setSatellitePlmn(int simSlot, @NonNull List<String> carrierPlmnList,
            @NonNull List<String> allSatellitePlmnList, Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
                "setSatellitePlmn",
                networkProxy,
                result,
                RADIO_HAL_VERSION_2_4)) {
            return;
        }

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

        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
                    + " simSlot=" + simSlot + " carrierPlmnList=" + carrierPlmnList
                    + " allSatellitePlmnList=" + allSatellitePlmnList);
        }

        radioServiceInvokeHelper(
                HAL_SERVICE_NETWORK,
                rr,
                "setSatellitePlmn",
                () -> {
                    networkProxy.setSatellitePlmn(rr.mSerial, simSlot, carrierPlmnList,
                            allSatellitePlmnList);
                });
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
            Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
                "setSatelliteEnabledForCarrier",
                networkProxy,
                result,
                RADIO_HAL_VERSION_2_4)) {
            return;
        }

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

        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
                    + " simSlot=" + simSlot + " satelliteEnabled=" + satelliteEnabled);
        }

        radioServiceInvokeHelper(
                HAL_SERVICE_NETWORK,
                rr,
                "setSatelliteEnabledForCarrier",
                () -> {
                    networkProxy.setSatelliteEnabledForCarrier(rr.mSerial, simSlot,
                            satelliteEnabled);
                });
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void isSatelliteEnabledForCarrier(int simSlot, Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
                "isSatelliteEnabledForCarrier",
                networkProxy,
                result,
                RADIO_HAL_VERSION_2_4)) {
            return;
        }

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

        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
                    + " simSlot=" + simSlot);
        }

        radioServiceInvokeHelper(
                HAL_SERVICE_NETWORK, rr, "isSatelliteEnabledForCarrier", () -> {
                    networkProxy.isSatelliteEnabledForCarrier(rr.mSerial, simSlot);
                });
    }


    //***** Private Methods
    /**
     * This is a helper function to be called when an indication callback is called for any radio
@@ -6216,6 +6315,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            case 2: return RADIO_HAL_VERSION_2_1;
            case 3: return RADIO_HAL_VERSION_2_2;
            case 4: return RADIO_HAL_VERSION_2_3;
            case 5: return RADIO_HAL_VERSION_2_4;
            default: return RADIO_HAL_VERSION_UNKNOWN;
        }
    }
+9 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_CELLULA
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_N1_MODE_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_NULL_CIPHER_AND_INTEGRITY_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_SECURITY_ALGORITHMS_UPDATED_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_VONR_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_LAST_CALL_FAIL_CAUSE;
@@ -180,6 +181,8 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_NULL_C
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_RADIO_CAPABILITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_PLMN;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SECURITY_ALGORITHMS_UPDATED_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIM_CARD_POWER;
@@ -5288,6 +5291,12 @@ public class RILUtils {
                return "IS_SECURITY_ALGORITHMS_UPDATED_ENABLED";
            case RIL_REQUEST_GET_SIMULTANEOUS_CALLING_SUPPORT:
                return "GET_SIMULTANEOUS_CALLING_SUPPORT";
            case RIL_REQUEST_SET_SATELLITE_PLMN:
                return "SET_SATELLITE_PLMN";
            case RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER:
                return "SET_SATELLITE_ENABLED_FOR_CARRIER";
            case RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER:
                return "IS_SATELLITE_ENABLED_FOR_CARRIER";
            default:
                return "<unknown request " + request + ">";
        }
+56 −0
Original line number Diff line number Diff line
@@ -979,4 +979,60 @@ public class RadioNetworkProxy extends RadioServiceProxy {
        }
        // Only supported on AIDL.
    }

   /**
     * Set the non-terrestrial PLMN with lower priority than terrestrial networks.
     *
     * @param serial Serial number of request.
     * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
     *                this information to determine the relevant carrier.
     * @param carrierPlmnList The list of roaming PLMN used for connecting to satellite networks
     *                        supported by user subscription.
     * @param allSatellitePlmnList Modem should use the allSatellitePlmnList to identify satellite
     *                             PLMNs that are not supported by the carrier and make sure not to
     *                             attach to them.
     */
    public void setSatellitePlmn(int serial, int simSlot, List<String> carrierPlmnList,
            List<String> allSatellitePlmnList) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            String[] carrierPlmnArray = carrierPlmnList.toArray(new String[0]);
            String[] allSatellitePlmnArray = allSatellitePlmnList.toArray(new String[0]);
            mNetworkProxy.setSatellitePlmn(serial, simSlot, carrierPlmnArray,
                    allSatellitePlmnArray);
        }
        // Only supported on AIDL.
    }

    /**
     * Enable or disable satellite in the cellular modem associated with a carrier.
     *
     * @param serial Serial number of request.
     * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
     *                this information to determine the relevant carrier.
     * @param satelliteEnabled {@code true} to enable satellite, {@code false} to disable satellite.
     */
    public void setSatelliteEnabledForCarrier(int serial, int simSlot,
            boolean satelliteEnabled) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mNetworkProxy.setSatelliteEnabledForCarrier(serial, simSlot, satelliteEnabled);
        }
        // Only supported on AIDL.
    }

    /**
     * Check whether satellite is enabled in the cellular modem associated with a carrier.
     *
     * @param serial Serial number of request.
     * @param simSlot Indicates the SIM slot to which this API will be applied.
     */
    public void isSatelliteEnabledForCarrier(int serial, int simSlot)
            throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mNetworkProxy.isSatelliteEnabledForCarrier(serial, simSlot);
        }
        // Only supported on AIDL.
    }
}