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

Commit c6b09aa7 authored by Sooraj Sasindran's avatar Sooraj Sasindran Committed by Android (Google) Code Review
Browse files

Merge "adding api for getSatelliteDataMode" into main

parents 26771053 421a4ab7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -18628,6 +18628,7 @@ package android.telephony.satellite {
    method @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void deprovisionService(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @NonNull @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public java.util.Set<java.lang.Integer> getAttachRestrictionReasonsForCarrier(int);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_25q4_apis") @NonNull @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public java.util.List<java.lang.String> getSatelliteDataOptimizedApps();
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_25q4_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public int getSatelliteDataSupportMode(int);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @NonNull @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public int[] getSatelliteDisallowedReasons();
    method @NonNull @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public java.util.List<java.lang.String> getSatellitePlmnsForCarrier(int);
    method @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void pollPendingDatagrams(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
@@ -18710,6 +18711,10 @@ package android.telephony.satellite {
    field public static final int SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_SUCCESS = 2; // 0x2
    field public static final int SATELLITE_DATAGRAM_TRANSFER_STATE_UNKNOWN = -1; // 0xffffffff
    field public static final int SATELLITE_DATAGRAM_TRANSFER_STATE_WAITING_TO_CONNECT = 8; // 0x8
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_25q4_apis") public static final int SATELLITE_DATA_SUPPORT_CONSTRAINED = 1; // 0x1
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_25q4_apis") public static final int SATELLITE_DATA_SUPPORT_RESTRICTED = 0; // 0x0
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_25q4_apis") public static final int SATELLITE_DATA_SUPPORT_UNCONSTRAINED = 2; // 0x2
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_25q4_apis") public static final int SATELLITE_DATA_SUPPORT_UNKNOWN = -1; // 0xffffffff
    field public static final int SATELLITE_MODEM_STATE_CONNECTED = 7; // 0x7
    field public static final int SATELLITE_MODEM_STATE_DATAGRAM_RETRYING = 3; // 0x3
    field public static final int SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING = 2; // 0x2
+83 −0
Original line number Diff line number Diff line
@@ -699,6 +699,56 @@ public final class SatelliteManager {
    @Retention(RetentionPolicy.SOURCE)
    public @interface DisplayMode {}

    /**
     * Unknown or unsupported value for data mode on satellite.
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SATELLITE_25Q4_APIS)
    public static final int SATELLITE_DATA_SUPPORT_UNKNOWN = -1;

    /**
     * Support only restricted data usecases like carrier messaging using RCS.
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SATELLITE_25Q4_APIS)
    public static final int SATELLITE_DATA_SUPPORT_RESTRICTED = 0;

    /**
     * Support constrained internet which would enable internet only for applications that are
     * modified.
     *
     * <p>
     * To get internet access, applications need to be modified to use the satellite data
     * optimized network. This can be done by setting the {@link #PROPERTY_SATELLITE_DATA_OPTIMIZED}
     * property to {@code true} in the manifest.
     * </p>
     *
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SATELLITE_25Q4_APIS)
    public static final int SATELLITE_DATA_SUPPORT_CONSTRAINED = 1;

    /**
     * Support default internet on satellite without any restrictions on any apps.
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SATELLITE_25Q4_APIS)
    public static final int SATELLITE_DATA_SUPPORT_UNCONSTRAINED = 2;

    /** @hide */
    @IntDef(prefix = {"SATELLITE_DATA_SUPPORT_"}, value = {
        SATELLITE_DATA_SUPPORT_UNKNOWN,
        SATELLITE_DATA_SUPPORT_RESTRICTED,
        SATELLITE_DATA_SUPPORT_CONSTRAINED,
        SATELLITE_DATA_SUPPORT_UNCONSTRAINED,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SatelliteDataSupportMode {}

    /**
     * The emergency call is handed over to oem-enabled satellite SOS messaging. SOS messages are
     * sent to SOS providers, which will then forward the messages to emergency providers.
@@ -3788,6 +3838,39 @@ public final class SatelliteManager {
        return appsNames;
    }

    /**
     * Method to return the current satellite data service policy supported mode for the
     * subscriptionId based on carrier config.
     *
     * @param subId current subscription id.
     *
     * @return Supported modes {@link SatelliteDataSupportMode}
     * @throws IllegalArgumentException if the subscription is invalid.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
    @FlaggedApi(Flags.FLAG_SATELLITE_25Q4_APIS)
    @SatelliteDataSupportMode
    public int getSatelliteDataSupportMode(int subId) {
        int satelliteMode = SATELLITE_DATA_SUPPORT_UNKNOWN;

        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                satelliteMode = telephony.getSatelliteDataSupportMode(subId);
            } else {
                throw new IllegalStateException("telephony service is null.");
            }
        } catch (RemoteException ex) {
            loge("getSatelliteDataSupportMode() RemoteException:" + ex);
            ex.rethrowAsRuntimeException();
        }

        return satelliteMode;
    }

    @Nullable
    private static ITelephony getITelephony() {
        ITelephony binder = ITelephony.Stub.asInterface(TelephonyFrameworkInitializer
+15 −0
Original line number Diff line number Diff line
@@ -3641,4 +3641,19 @@ interface ITelephony {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
                      + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    List<String> getSatelliteDataOptimizedApps();

    /**
     * Method to return the current satellite data service policy supported mode for the
     * subscriptionId based on subscription id. Note: Iif any error or invalid sub id
     * {@Link SatelliteDataSupportMode#SATELLITE_DATA_SUPPORT_UNKNOWN} will be returned.
     *
     * @param subId current subscription id.
     *
     * @return Supported modes {@link SatelliteDataSupportMode}
     * @throws IllegalArgumentException if the subscription is invalid.
     * @hide
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
                      + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    int getSatelliteDataSupportMode(in int subId);
}