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

Commit 16d2989b authored by Adrian Mejia's avatar Adrian Mejia
Browse files

Add requestSatelliteDisplayNameForSubscription in SatelliteManager

BUG: b/378693661
Change-Id: I6eef5116e420c4580eeaa637dd38a53e8ccdaa02
FLAG: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
parent 97b52e98
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -10060,6 +10060,13 @@ public class CarrierConfigManager {
    public static final String KEY_SATELLITE_NIDD_APN_NAME_STRING =
    public static final String KEY_SATELLITE_NIDD_APN_NAME_STRING =
            "satellite_nidd_apn_name_string";
            "satellite_nidd_apn_name_string";
    /**
     * The display name that will be used for satellite functionality within the UI.
     * The default string value for this is "Satellite".
     * @hide
     */
    public static final String KEY_SATELLITE_DISPLAY_NAME_STRING = "satellite_display_name_string";
    /**
    /**
     * Default value {@code true}, meaning when an emergency call request comes in, if the device is
     * Default value {@code true}, meaning when an emergency call request comes in, if the device is
     * in emergency satellite mode but hasn't sent the first satellite datagram, then exits
     * in emergency satellite mode but hasn't sent the first satellite datagram, then exits
@@ -11343,6 +11350,7 @@ public class CarrierConfigManager {
        sDefaults.putBoolean(KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL, false);
        sDefaults.putBoolean(KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL, false);
        sDefaults.putInt(KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT,
        sDefaults.putInt(KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT,
                (int) TimeUnit.SECONDS.toMillis(30));
                (int) TimeUnit.SECONDS.toMillis(30));
        sDefaults.putString(KEY_SATELLITE_DISPLAY_NAME_STRING, "");
        sDefaults.putBoolean(KEY_SATELLITE_ESOS_SUPPORTED_BOOL, false);
        sDefaults.putBoolean(KEY_SATELLITE_ESOS_SUPPORTED_BOOL, false);
        sDefaults.putBoolean(KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL, false);
        sDefaults.putBoolean(KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL, false);
        sDefaults.putString(KEY_SATELLITE_NIDD_APN_NAME_STRING, "");
        sDefaults.putString(KEY_SATELLITE_NIDD_APN_NAME_STRING, "");
+66 −0
Original line number Original line Diff line number Diff line
@@ -280,6 +280,13 @@ public final class SatelliteManager {
    public static final String KEY_SATELLITE_ACCESS_CONFIGURATION =
    public static final String KEY_SATELLITE_ACCESS_CONFIGURATION =
            "satellite_access_configuration";
            "satellite_access_configuration";


    /**
     * Bundle key to get the response from
     * {@link #requestSatelliteDisplayName(Executor, OutcomeReceiver)}.
     * @hide
     */
    public static final String KEY_SATELLITE_DISPLAY_NAME = "satellite_display_name";

    /**
    /**
     * Bundle key to get the response from
     * Bundle key to get the response from
     * {@link #requestSelectedNbIotSatelliteSubscriptionId(Executor, OutcomeReceiver)}.
     * {@link #requestSelectedNbIotSatelliteSubscriptionId(Executor, OutcomeReceiver)}.
@@ -3478,6 +3485,65 @@ public final class SatelliteManager {
        }
        }
    }
    }


    /**
     * Request to get the display name of satellite feature in the UI.
     *
     * @param executor The executor on which the callback will be called.
     * @param callback The callback object to which the result will be delivered.
     *                 If the request is successful, {@link OutcomeReceiver#onResult(Object)}
     *                 will return display name of the satellite feature in string format. Defaults
     *                 to satellite. If the request is not successful,
     *                 {@link OutcomeReceiver#onError(Throwable)} will return an error with
     *                 a SatelliteException.
     *
     * @throws SecurityException     if the caller doesn't have required permission.
     * @throws IllegalStateException if the Telephony process is not currently available.
     * @hide
     */
    @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
    public void requestSatelliteDisplayName(
            @NonNull @CallbackExecutor Executor executor,
            @NonNull OutcomeReceiver<String, SatelliteException> callback) {
        Objects.requireNonNull(executor);
        Objects.requireNonNull(callback);

        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                ResultReceiver receiver = new ResultReceiver(null) {
                    @Override
                    protected void onReceiveResult(int resultCode, Bundle resultData) {
                        if (resultCode == SATELLITE_RESULT_SUCCESS) {
                            if (resultData.containsKey(KEY_SATELLITE_DISPLAY_NAME)) {
                                String satelliteDisplayName =
                                        resultData.getString(KEY_SATELLITE_DISPLAY_NAME);
                                executor.execute(() -> Binder.withCleanCallingIdentity(() ->
                                        callback.onResult(satelliteDisplayName)));
                            } else {
                                loge("KEY_SATELLITE_DISPLAY_NAME does not exist.");
                                executor.execute(() -> Binder.withCleanCallingIdentity(() ->
                                        callback.onError(new SatelliteException(
                                                SATELLITE_RESULT_REQUEST_FAILED))));
                            }
                        } else {
                            executor.execute(() -> Binder.withCleanCallingIdentity(() ->
                                    callback.onError(new SatelliteException(resultCode))));
                        }
                    }
                };
                telephony.requestSatelliteDisplayName(receiver);
            } else {
                loge("requestSatelliteDisplayName() invalid telephony");
                executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError(
                        new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE))));
            }
        } catch (RemoteException ex) {
            loge("requestSatelliteDisplayName() RemoteException: " + ex);
            executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError(
                    new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE))));
        }
    }

    /**
    /**
     * Deliver the list of provisioned satellite subscriber infos.
     * Deliver the list of provisioned satellite subscriber infos.
     *
     *
+11 −0
Original line number Original line Diff line number Diff line
@@ -3445,6 +3445,17 @@ interface ITelephony {
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void requestSatelliteSubscriberProvisionStatus(in ResultReceiver result);
    void requestSatelliteSubscriberProvisionStatus(in ResultReceiver result);


    /**
     * Request to get the name to display for Satellite subscription.
     *
     * @param receiver The result receiver that returns the diplay name to be used for the satellite
     * subscription.
     * @hide
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void requestSatelliteDisplayName(in ResultReceiver receiver);

    /**
    /**
     * Deliver the list of provisioned satellite subscriber infos.
     * Deliver the list of provisioned satellite subscriber infos.
     *
     *