diff --git a/telephony/java/android/telephony/satellite/ISatelliteStateListener.aidl b/telephony/java/android/telephony/satellite/ISatelliteStateListener.aidl index 6fb09799dacf9..d3924d676128a 100644 --- a/telephony/java/android/telephony/satellite/ISatelliteStateListener.aidl +++ b/telephony/java/android/telephony/satellite/ISatelliteStateListener.aidl @@ -23,7 +23,7 @@ import android.telephony.satellite.PointingInfo; * @hide */ oneway interface ISatelliteStateListener { - void onSatelliteProvisionStateChanged(in int[] features, in boolean provisioned); + void onSatelliteProvisionStateChanged(in boolean provisioned); void onSatellitePositionUpdate(in PointingInfo pointingInfo); void onMessageTransferStateUpdate(in int state); } diff --git a/telephony/java/android/telephony/satellite/SatelliteCallback.java b/telephony/java/android/telephony/satellite/SatelliteCallback.java index 1b82d062047a0..6d0a992406768 100644 --- a/telephony/java/android/telephony/satellite/SatelliteCallback.java +++ b/telephony/java/android/telephony/satellite/SatelliteCallback.java @@ -18,7 +18,6 @@ package android.telephony.satellite; import android.annotation.NonNull; import android.os.Binder; -import android.telephony.satellite.stub.SatelliteImplBase; import java.lang.ref.WeakReference; import java.util.concurrent.Executor; @@ -63,12 +62,10 @@ public class SatelliteCallback { /** * Called when satellite provision state changes. * - * @param features The list of provisioned features. * @param provisioned The new provision state. {@code true} means satellite is provisioned * {@code false} means satellite is not provisioned. */ - void onSatelliteProvisionStateChanged( - @SatelliteImplBase.Feature int[] features, boolean provisioned); + void onSatelliteProvisionStateChanged(boolean provisioned); } /** @@ -100,14 +97,13 @@ public class SatelliteCallback { mExecutor = executor; } - public void onSatelliteProvisionStateChanged( - @SatelliteImplBase.Feature int[] features, boolean provisioned) { + public void onSatelliteProvisionStateChanged(boolean provisioned) { SatelliteProvisionStateListener listener = (SatelliteProvisionStateListener) mSatelliteCallbackWeakRef.get(); if (listener == null) return; Binder.withCleanCallingIdentity(() -> mExecutor.execute( - () -> listener.onSatelliteProvisionStateChanged(features, provisioned))); + () -> listener.onSatelliteProvisionStateChanged(provisioned))); } public void onSatellitePositionUpdate(@NonNull PointingInfo pointingInfo) { diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java index 129d4cafa5b5f..976395058c4da 100644 --- a/telephony/java/android/telephony/satellite/SatelliteManager.java +++ b/telephony/java/android/telephony/satellite/SatelliteManager.java @@ -638,7 +638,8 @@ public class SatelliteManager { * Provision the device with a satellite provider. * This is needed if the provider allows dynamic registration. * - * @param token The security token of the device/subscription to be provisioned. + * @param token The token to be used as a unique identifier for provisioning with satellite + * gateway. * @param cancellationSignal The optional signal used by the caller to cancel the provision * request. Even when the cancellation is signaled, Telephony will * still trigger the callback to return the result of this request. @@ -681,6 +682,48 @@ public class SatelliteManager { } } + /** + * Deprovision the device with the satellite provider. + * This is needed if the provider allows dynamic registration. Once deprovisioned, + * {@link SatelliteCallback.SatelliteProvisionStateListener#onSatelliteProvisionStateChanged} + * should report as deprovisioned. + * For provisioning satellite service, refer to + * {@link #provisionSatelliteService(String, CancellationSignal, Executor, Consumer)}. + * + * @param token The token of the device/subscription to be deprovisioned. + * @param errorCodeListener Listener for the {@link SatelliteError} result of the operation. + * + * @throws SecurityException if the caller doesn't have required permission. + * @throws IllegalStateException if the Telephony process is not currently available. + */ + @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) + public void deprovisionSatelliteService(@NonNull String token, + @NonNull @CallbackExecutor Executor executor, + @SatelliteError @NonNull Consumer errorCodeListener) { + Objects.requireNonNull(token); + Objects.requireNonNull(executor); + Objects.requireNonNull(errorCodeListener); + + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + IIntegerConsumer errorCallback = new IIntegerConsumer.Stub() { + @Override + public void accept(int result) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> errorCodeListener.accept(result))); + } + }; + telephony.deprovisionSatelliteService(mSubId, token, errorCallback); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + loge("deprovisionSatelliteService RemoteException=" + ex); + ex.rethrowFromSystemServer(); + } + } + /** * Register for the satellite provision state change. * diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 07deead956580..3121c3c76d4f5 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -2783,7 +2783,8 @@ interface ITelephony { * This is needed to register the subscription if the provider allows dynamic registration. * * @param subId The subId of the subscription to be provisioned. - * @param token The security token of the device/subscription to be provisioned. + * @param token The token to be used as a unique identifier for provisioning with satellite + * gateway. * @param callback The callback to get the error code of the request. * * @return The signal transport used by callers to cancel the provision request. @@ -2793,6 +2794,22 @@ interface ITelephony { ICancellationSignal provisionSatelliteService(int subId, in String token, in IIntegerConsumer callback); + /** + * Unregister the subscription with the satellite provider. + * This is needed to unregister the subscription if the provider allows dynamic registration. + * Once deprovisioned, + * {@link SatelliteCallback.SatelliteProvisionStateListener#onSatelliteProvisionStateChanged} + * should report as deprovisioned. + * + * @param subId The subId of the subscription to be deprovisioned. + * @param token The token of the device/subscription to be deprovisioned. + * @param callback The callback to get the error code of the request. + */ + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + + "android.Manifest.permission.SATELLITE_COMMUNICATION)") + void deprovisionSatelliteService(int subId, in String token, in IIntegerConsumer callback); + + /** * Register for the satellite provision state change. *