diff options
| author | 2024-10-03 15:58:15 +0000 | |
|---|---|---|
| committer | 2024-10-03 15:58:15 +0000 | |
| commit | 48e975849803496a9063101e21153458c6d5bcaa (patch) | |
| tree | 7bd1a1386de46511a483f7845e0f2963f6e276c8 | |
| parent | d41540f8e1b859a75a0fd2d32fcf35d2f296fe65 (diff) | |
| parent | 23b1bd5e24bd05de7d3aa350f8f6623f6d846e9a (diff) | |
Merge "Add deprovisionSatellite api" into main
| -rw-r--r-- | telephony/java/android/telephony/satellite/SatelliteManager.java | 62 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 11 |
2 files changed, 73 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java index bd5c7597ba14..49ca6f34d2d9 100644 --- a/telephony/java/android/telephony/satellite/SatelliteManager.java +++ b/telephony/java/android/telephony/satellite/SatelliteManager.java @@ -249,6 +249,13 @@ public final class SatelliteManager { public static final String KEY_PROVISION_SATELLITE_TOKENS = "provision_satellite"; /** + * Bundle key to get the response from + * {@link #deprovisionSatellite(List, Executor, OutcomeReceiver)}. + * @hide + */ + public static final String KEY_DEPROVISION_SATELLITE_TOKENS = "deprovision_satellite"; + + /** * The request was successfully processed. */ @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) @@ -2791,6 +2798,61 @@ public final class SatelliteManager { } } + /** + * Deliver the list of deprovisioned satellite subscriber infos. + * + * @param list The list of deprovisioned satellite subscriber infos. + * @param executor The executor on which the callback will be called. + * @param callback The callback object to which the result will be delivered. + * + * @throws SecurityException if the caller doesn't have required permission. + * @hide + */ + @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public void deprovisionSatellite(@NonNull List<SatelliteSubscriberInfo> list, + @NonNull @CallbackExecutor Executor executor, + @NonNull OutcomeReceiver<Boolean, 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_DEPROVISION_SATELLITE_TOKENS)) { + boolean isUpdated = + resultData.getBoolean(KEY_DEPROVISION_SATELLITE_TOKENS); + executor.execute(() -> Binder.withCleanCallingIdentity(() -> + callback.onResult(isUpdated))); + } else { + loge("KEY_DEPROVISION_SATELLITE_TOKENS 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.deprovisionSatellite(list, receiver); + } else { + loge("deprovisionSatellite() invalid telephony"); + executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError( + new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE)))); + } + } catch (RemoteException ex) { + loge("deprovisionSatellite() RemoteException: " + ex); + executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError( + new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE)))); + } + } + @Nullable private static ITelephony getITelephony() { ITelephony binder = ITelephony.Stub.asInterface(TelephonyFrameworkInitializer diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 3161d17681ed..61f01461232f 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -3444,4 +3444,15 @@ interface ITelephony { */ boolean overrideCarrierRoamingNtnEligibilityChanged( in boolean status, in boolean resetRequired); + + /** + * Deliver the list of deprovisioned satellite subscriber infos. + * + * @param list The list of deprovisioned satellite subscriber infos. + * @param result The result receiver that returns whether deliver success or fail. + * @hide + */ + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + + "android.Manifest.permission.SATELLITE_COMMUNICATION)") + void deprovisionSatellite(in List<SatelliteSubscriberInfo> list, in ResultReceiver result); } |