From 23b1bd5e24bd05de7d3aa350f8f6623f6d846e9a Mon Sep 17 00:00:00 2001 From: Hyosun Kim Date: Tue, 24 Sep 2024 13:19:54 +0000 Subject: Add deprovisionSatellite api Bug: 368435815 Test: atest SatelliteControllerTest Test: atest SatelliteManagerTestOnMockService Test: manual test with test apk b/368435815#comment2 Flag: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn Change-Id: I1dbb5cfacfa7e5f162da1c544ced79f63e45aa51 --- .../telephony/satellite/SatelliteManager.java | 62 ++++++++++++++++++++++ .../com/android/internal/telephony/ITelephony.aidl | 11 ++++ 2 files changed, 73 insertions(+) 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 @@ -248,6 +248,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. */ @@ -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 list, + @NonNull @CallbackExecutor Executor executor, + @NonNull OutcomeReceiver 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 list, in ResultReceiver result); } -- cgit v1.2.3-59-g8ed1b