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

Commit ff09cab7 authored by Sungcheol Ahn's avatar Sungcheol Ahn Committed by Android (Google) Code Review
Browse files

Merge "Add setNtnSmsSupported API in SatelliteManager." into main

parents 16dbc7bc c2a86233
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -3511,6 +3511,40 @@ public final class SatelliteManager {
        }
    }

    /**
     * Inform whether application supports NTN SMS in satellite mode.
     *
     * This method is used by default messaging application to inform framework whether it supports
     * NTN SMS or not.
     *
     * Invoking this API will internally result in triggering
     * {@link android.telephony.TelephonyCallback.CarrierRoamingNtnModeListener
     * #onCarrierRoamingNtnAvailableServicesChanged(List)} and
     * {@link android.telephony.TelephonyCallback.CarrierRoamingNtnModeListener
     * #onCarrierRoamingNtnEligibleStateChanged(boolean)} callbacks.
     *
     * @param ntnSmsSupported {@code true} If application supports NTN SMS, else {@code false}.
     *
     * @throws SecurityException if the caller doesn't have required permission.
     * @throws IllegalStateException if the Telephony process is not currently available.
     * @hide
     */
    @RequiresPermission(allOf = {Manifest.permission.SATELLITE_COMMUNICATION,
            Manifest.permission.SEND_SMS})
    public void setNtnSmsSupported(boolean ntnSmsSupported) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                telephony.setNtnSmsSupported(ntnSmsSupported);
            } else {
                throw new IllegalStateException("telephony service is null.");
            }
        } catch (RemoteException ex) {
            loge("setNtnSmsSupported() RemoteException:" + ex);
            ex.rethrowAsRuntimeException();
        }
    }

    @Nullable
    private static ITelephony getITelephony() {
        ITelephony binder = ITelephony.Stub.asInterface(TelephonyFrameworkInitializer
+11 −0
Original line number Diff line number Diff line
@@ -3497,4 +3497,15 @@ interface ITelephony {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void deprovisionSatellite(in List<SatelliteSubscriberInfo> list, in ResultReceiver result);

   /**
    * Inform whether application supports NTN SMS in satellite mode.
    *
    * This method is used by default messaging application to inform framework whether it supports
    * NTN SMS or not.
    *
    * @param ntnSmsSupported {@code true} If application supports NTN SMS, else {@code false}.
    * @hide
    */
    void setNtnSmsSupported(boolean ntnSmsSupported);
}