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

Commit 8f6127ad authored by Adrian Mejia's avatar Adrian Mejia Committed by Android (Google) Code Review
Browse files

Merge "Add requestSatelliteDisplayNameForSubscription in SatelliteManager" into main

parents d3944197 16d2989b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -10060,6 +10060,13 @@ public class CarrierConfigManager {
    public static final String KEY_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
     * 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.putInt(KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT,
                (int) TimeUnit.SECONDS.toMillis(30));
        sDefaults.putString(KEY_SATELLITE_DISPLAY_NAME_STRING, "");
        sDefaults.putBoolean(KEY_SATELLITE_ESOS_SUPPORTED_BOOL, false);
        sDefaults.putBoolean(KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL, false);
        sDefaults.putString(KEY_SATELLITE_NIDD_APN_NAME_STRING, "");
+66 −0
Original line number Diff line number Diff line
@@ -290,6 +290,13 @@ public final class SatelliteManager {
    public static final String KEY_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
     * {@link #requestSelectedNbIotSatelliteSubscriptionId(Executor, OutcomeReceiver)}.
@@ -3593,6 +3600,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.
     *
+11 −0
Original line number Diff line number Diff line
@@ -3470,6 +3470,17 @@ interface ITelephony {
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    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.
     *