Merge "Add requestSatelliteDisplayNameForSubscription in SatelliteManager" into main
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 7cfdec6..59cb5ff 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -10061,6 +10061,13 @@
"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
* satellite mode to allow the emergency call to go through.
@@ -11343,6 +11350,7 @@
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, "");
diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java
index db5689b7..1025c15 100644
--- a/telephony/java/android/telephony/satellite/SatelliteManager.java
+++ b/telephony/java/android/telephony/satellite/SatelliteManager.java
@@ -292,6 +292,13 @@
/**
* 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)}.
* @hide
*/
@@ -3594,6 +3601,65 @@
}
/**
+ * 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.
*
* @param list The list of provisioned satellite subscriber infos.
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 131f46b..da7669f 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -3471,6 +3471,17 @@
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.
*
* @param list The list of provisioned satellite subscriber infos.