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

Commit c2a86233 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Add setNtnSmsSupported API in SatelliteManager.

Bug: 378145870
Test: make
Test: Manually tested SMS/MMS/CALLS/DATA
FLAG: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
Change-Id: Id9d683c012bede6c6b3aa3109959b0cbbe79c563
parent a3aae9ab
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -3431,6 +3431,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
@@ -3487,4 +3487,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);
}