diff options
| author | 2023-03-09 22:56:54 -0800 | |
|---|---|---|
| committer | 2023-03-14 04:17:18 +0000 | |
| commit | bdfcbbb3b00d833e211a0ef72d95dd3b867d1d67 (patch) | |
| tree | 3fff559a8648b6e9ffece2aafeaad7741985bb11 | |
| parent | 1bee42eb082f49bcacc01a8565cbd6119ba8f330 (diff) | |
Update satellite APIs from feedback
Test: atest SatelliteManagerTest
Bug: 261053569
Change-Id: Id1eb6580ea365fbba188c44237e06e6e7ca7ba9d
Merged-In: Id1eb6580ea365fbba188c44237e06e6e7ca7ba9d
17 files changed, 351 insertions, 758 deletions
diff --git a/telephony/java/android/telephony/satellite/ISatelliteStateCallback.aidl b/telephony/java/android/telephony/satellite/ISatelliteStateCallback.aidl index 98221c9ef2c5..cd9d81e1ee9b 100644 --- a/telephony/java/android/telephony/satellite/ISatelliteStateCallback.aidl +++ b/telephony/java/android/telephony/satellite/ISatelliteStateCallback.aidl @@ -22,13 +22,6 @@ package android.telephony.satellite; */ oneway interface ISatelliteStateCallback { /** - * Indicates that the satellite has pending datagrams for the device to be pulled. - * - * @param count Number of pending datagrams. - */ - void onPendingDatagramCount(in int count); - - /** * Indicates that the satellite modem state has changed. * * @param state The current satellite modem state. diff --git a/telephony/java/android/telephony/satellite/ISatellitePositionUpdateCallback.aidl b/telephony/java/android/telephony/satellite/ISatelliteTransmissionUpdateCallback.aidl index d3f1091acfa0..24420833bdb6 100644 --- a/telephony/java/android/telephony/satellite/ISatellitePositionUpdateCallback.aidl +++ b/telephony/java/android/telephony/satellite/ISatelliteTransmissionUpdateCallback.aidl @@ -22,7 +22,7 @@ import android.telephony.satellite.PointingInfo; * Interface for position update and datagram transfer state change callback. * @hide */ -oneway interface ISatellitePositionUpdateCallback { +oneway interface ISatelliteTransmissionUpdateCallback { /** * Called when satellite datagram transfer state changed. * diff --git a/telephony/java/android/telephony/satellite/PointingInfo.java b/telephony/java/android/telephony/satellite/PointingInfo.java index a3c3f1966c94..7c79447399b2 100644 --- a/telephony/java/android/telephony/satellite/PointingInfo.java +++ b/telephony/java/android/telephony/satellite/PointingInfo.java @@ -30,31 +30,12 @@ public final class PointingInfo implements Parcelable { /** Satellite elevation in degrees */ private float mSatelliteElevationDegrees; - /** Antenna azimuth in degrees */ - private float mAntennaAzimuthDegrees; - - /** - * Angle of rotation about the x axis. This value represents the angle between a plane - * parallel to the device's screen and a plane parallel to the ground. - */ - private float mAntennaPitchDegrees; - - /** - * Angle of rotation about the y axis. This value represents the angle between a plane - * perpendicular to the device's screen and a plane parallel to the ground. - */ - private float mAntennaRollDegrees; - /** * @hide */ - public PointingInfo(float satelliteAzimuthDegrees, float satelliteElevationDegrees, - float antennaAzimuthDegrees, float antennaPitchDegrees, float antennaRollDegrees) { + public PointingInfo(float satelliteAzimuthDegrees, float satelliteElevationDegrees) { mSatelliteAzimuthDegrees = satelliteAzimuthDegrees; mSatelliteElevationDegrees = satelliteElevationDegrees; - mAntennaAzimuthDegrees = antennaAzimuthDegrees; - mAntennaPitchDegrees = antennaPitchDegrees; - mAntennaRollDegrees = antennaRollDegrees; } private PointingInfo(Parcel in) { @@ -70,9 +51,6 @@ public final class PointingInfo implements Parcelable { public void writeToParcel(@NonNull Parcel out, int flags) { out.writeFloat(mSatelliteAzimuthDegrees); out.writeFloat(mSatelliteElevationDegrees); - out.writeFloat(mAntennaAzimuthDegrees); - out.writeFloat(mAntennaPitchDegrees); - out.writeFloat(mAntennaRollDegrees); } public static final @android.annotation.NonNull Creator<PointingInfo> CREATOR = @@ -99,18 +77,6 @@ public final class PointingInfo implements Parcelable { sb.append("SatelliteElevationDegrees:"); sb.append(mSatelliteElevationDegrees); - sb.append(","); - - sb.append("AntennaAzimuthDegrees:"); - sb.append(mAntennaAzimuthDegrees); - sb.append(","); - - sb.append("AntennaPitchDegrees:"); - sb.append(mAntennaPitchDegrees); - sb.append(","); - - sb.append("AntennaRollDegrees:"); - sb.append(mAntennaRollDegrees); return sb.toString(); } @@ -122,23 +88,8 @@ public final class PointingInfo implements Parcelable { return mSatelliteElevationDegrees; } - public float getAntennaAzimuthDegrees() { - return mAntennaAzimuthDegrees; - } - - public float getAntennaPitchDegrees() { - return mAntennaPitchDegrees; - } - - public float getAntennaRollDegrees() { - return mAntennaRollDegrees; - } - private void readFromParcel(Parcel in) { mSatelliteAzimuthDegrees = in.readFloat(); mSatelliteElevationDegrees = in.readFloat(); - mAntennaAzimuthDegrees = in.readFloat(); - mAntennaPitchDegrees = in.readFloat(); - mAntennaRollDegrees = in.readFloat(); } } diff --git a/telephony/java/android/telephony/satellite/SatelliteCapabilities.java b/telephony/java/android/telephony/satellite/SatelliteCapabilities.java index 889856b09ae6..df80159780ec 100644 --- a/telephony/java/android/telephony/satellite/SatelliteCapabilities.java +++ b/telephony/java/android/telephony/satellite/SatelliteCapabilities.java @@ -33,31 +33,24 @@ public final class SatelliteCapabilities implements Parcelable { @NonNull @SatelliteManager.NTRadioTechnology private Set<Integer> mSupportedRadioTechnologies; /** - * Whether satellite modem is always on. - * This indicates the power impact of keeping it on is very minimal. - */ - private boolean mIsAlwaysOn; - - /** * Whether UE needs to point to a satellite to send and receive data. */ - private boolean mNeedsPointingToSatellite; + private boolean mIsPointingRequired; /** - * Whether UE needs a separate SIM profile to communicate with the satellite network. + * The maximum number of bytes per datagram that can be sent over satellite. */ - private boolean mNeedsSeparateSimProfile; + private int mMaxBytesPerOutgoingDatagram; /** * @hide */ - public SatelliteCapabilities(Set<Integer> supportedRadioTechnologies, boolean isAlwaysOn, - boolean needsPointingToSatellite, boolean needsSeparateSimProfile) { + public SatelliteCapabilities(Set<Integer> supportedRadioTechnologies, + boolean isPointingRequired, int maxBytesPerOutgoingDatagram) { mSupportedRadioTechnologies = supportedRadioTechnologies == null ? new HashSet<>() : supportedRadioTechnologies; - mIsAlwaysOn = isAlwaysOn; - mNeedsPointingToSatellite = needsPointingToSatellite; - mNeedsSeparateSimProfile = needsSeparateSimProfile; + mIsPointingRequired = isPointingRequired; + mMaxBytesPerOutgoingDatagram = maxBytesPerOutgoingDatagram; } private SatelliteCapabilities(Parcel in) { @@ -80,9 +73,8 @@ public final class SatelliteCapabilities implements Parcelable { out.writeInt(0); } - out.writeBoolean(mIsAlwaysOn); - out.writeBoolean(mNeedsPointingToSatellite); - out.writeBoolean(mNeedsSeparateSimProfile); + out.writeBoolean(mIsPointingRequired); + out.writeInt(mMaxBytesPerOutgoingDatagram); } @NonNull public static final Creator<SatelliteCapabilities> CREATOR = new Creator<>() { @@ -111,16 +103,12 @@ public final class SatelliteCapabilities implements Parcelable { sb.append("none,"); } - sb.append("isAlwaysOn:"); - sb.append(mIsAlwaysOn); - sb.append(","); - - sb.append("needsPointingToSatellite:"); - sb.append(mNeedsPointingToSatellite); + sb.append("isPointingRequired:"); + sb.append(mIsPointingRequired); sb.append(","); - sb.append("needsSeparateSimProfile:"); - sb.append(mNeedsSeparateSimProfile); + sb.append("maxBytesPerOutgoingDatagram"); + sb.append(mMaxBytesPerOutgoingDatagram); return sb.toString(); } @@ -133,33 +121,22 @@ public final class SatelliteCapabilities implements Parcelable { } /** - * Get whether the satellite modem is always on. - * This indicates the power impact of keeping it on is very minimal. - * - * @return {@code true} if the satellite modem is always on and {@code false} otherwise. - */ - public boolean isAlwaysOn() { - return mIsAlwaysOn; - } - - /** * Get whether UE needs to point to a satellite to send and receive data. * - * @return {@code true} if UE needs to pointing to a satellite to send and receive data and + * @return {@code true} if UE needs to point to a satellite to send and receive data and * {@code false} otherwise. */ - public boolean needsPointingToSatellite() { - return mNeedsPointingToSatellite; + public boolean isPointingRequired() { + return mIsPointingRequired; } /** - * Get whether UE needs a separate SIM profile to communicate with the satellite network. + * The maximum number of bytes per datagram that can be sent over satellite. * - * @return {@code true} if UE needs a separate SIM profile to comunicate with the satellite - * network and {@code false} otherwise. + * @return The maximum number of bytes per datagram that can be sent over satellite. */ - public boolean needsSeparateSimProfile() { - return mNeedsSeparateSimProfile; + public int getMaxBytesPerOutgoingDatagram() { + return mMaxBytesPerOutgoingDatagram; } private void readFromParcel(Parcel in) { @@ -171,8 +148,7 @@ public final class SatelliteCapabilities implements Parcelable { } } - mIsAlwaysOn = in.readBoolean(); - mNeedsPointingToSatellite = in.readBoolean(); - mNeedsSeparateSimProfile = in.readBoolean(); + mIsPointingRequired = in.readBoolean(); + mMaxBytesPerOutgoingDatagram = in.readInt(); } } diff --git a/telephony/java/android/telephony/satellite/SatelliteDatagram.java b/telephony/java/android/telephony/satellite/SatelliteDatagram.java index cc5a9f45de83..d3cb8a07e4ba 100644 --- a/telephony/java/android/telephony/satellite/SatelliteDatagram.java +++ b/telephony/java/android/telephony/satellite/SatelliteDatagram.java @@ -17,7 +17,6 @@ package android.telephony.satellite; import android.annotation.NonNull; -import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; @@ -28,7 +27,7 @@ public final class SatelliteDatagram implements Parcelable { /** * Datagram to be sent or received over satellite. */ - private byte[] mData; + @NonNull private byte[] mData; /** * @hide @@ -51,8 +50,8 @@ public final class SatelliteDatagram implements Parcelable { out.writeByteArray(mData); } - public static final @android.annotation.NonNull Creator<SatelliteDatagram> CREATOR = - new Creator<SatelliteDatagram>() { + @NonNull public static final Creator<SatelliteDatagram> CREATOR = + new Creator<>() { @Override public SatelliteDatagram createFromParcel(Parcel in) { return new SatelliteDatagram(in); @@ -64,8 +63,7 @@ public final class SatelliteDatagram implements Parcelable { } }; - @Nullable - public byte[] getSatelliteDatagram() { + @NonNull public byte[] getSatelliteDatagram() { return mData; } diff --git a/telephony/java/android/telephony/satellite/SatelliteDatagramCallback.java b/telephony/java/android/telephony/satellite/SatelliteDatagramCallback.java index 213b98549344..f237ada9d1e0 100644 --- a/telephony/java/android/telephony/satellite/SatelliteDatagramCallback.java +++ b/telephony/java/android/telephony/satellite/SatelliteDatagramCallback.java @@ -17,48 +17,18 @@ package android.telephony.satellite; import android.annotation.NonNull; -import android.os.Binder; import com.android.internal.telephony.ILongConsumer; -import java.util.concurrent.Executor; - /** * A callback class for listening to satellite datagrams. * * @hide */ -public class SatelliteDatagramCallback { - private final CallbackBinder mBinder = new CallbackBinder(this); - - private static class CallbackBinder extends ISatelliteDatagramCallback.Stub { - private final SatelliteDatagramCallback mLocalCallback; - private Executor mExecutor; - - private CallbackBinder(SatelliteDatagramCallback localCallback) { - mLocalCallback = localCallback; - } - - @Override - public void onSatelliteDatagramReceived(long datagramId, - @NonNull SatelliteDatagram datagram, int pendingCount, - @NonNull ILongConsumer callback) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - mExecutor.execute(() -> mLocalCallback.onSatelliteDatagramReceived(datagramId, - datagram, pendingCount, callback)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - - private void setExecutor(Executor executor) { - mExecutor = executor; - } - } - +public interface SatelliteDatagramCallback { /** * Called when there is an incoming datagram to be received. + * * @param datagramId An id that uniquely identifies incoming datagram. * @param datagram Datagram to be received over satellite. * @param pendingCount Number of datagrams yet to be received by the app. @@ -66,19 +36,6 @@ public class SatelliteDatagramCallback { * datagramId to Telephony. If the callback is not received within five minutes, * Telephony will resend the datagram. */ - public void onSatelliteDatagramReceived(long datagramId, @NonNull SatelliteDatagram datagram, - int pendingCount, @NonNull ILongConsumer callback) { - // Base Implementation - } - - /** @hide */ - @NonNull - final ISatelliteDatagramCallback getBinder() { - return mBinder; - } - - /** @hide */ - public void setExecutor(@NonNull Executor executor) { - mBinder.setExecutor(executor); - } + void onSatelliteDatagramReceived(long datagramId, @NonNull SatelliteDatagram datagram, + int pendingCount, @NonNull ILongConsumer callback); } diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java index 9ec6929543de..d0abfbf80e76 100644 --- a/telephony/java/android/telephony/satellite/SatelliteManager.java +++ b/telephony/java/android/telephony/satellite/SatelliteManager.java @@ -36,12 +36,15 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyFrameworkInitializer; import com.android.internal.telephony.IIntegerConsumer; +import com.android.internal.telephony.ILongConsumer; import com.android.internal.telephony.ITelephony; import com.android.telephony.Rlog; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.time.Duration; import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.function.Consumer; @@ -55,6 +58,17 @@ import java.util.function.Consumer; public class SatelliteManager { private static final String TAG = "SatelliteManager"; + private static final ConcurrentHashMap<SatelliteDatagramCallback, ISatelliteDatagramCallback> + sSatelliteDatagramCallbackMap = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap<SatelliteProvisionStateCallback, + ISatelliteProvisionStateCallback> sSatelliteProvisionStateCallbackMap = + new ConcurrentHashMap<>(); + private static final ConcurrentHashMap<SatelliteStateCallback, ISatelliteStateCallback> + sSatelliteStateCallbackMap = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap<SatelliteTransmissionUpdateCallback, + ISatelliteTransmissionUpdateCallback> sSatelliteTransmissionUpdateCallbackMap = + new ConcurrentHashMap<>(); + private final int mSubId; /** @@ -66,6 +80,7 @@ public class SatelliteManager { * Create an instance of the SatelliteManager. * * @param context The context the SatelliteManager belongs to. + * @hide */ public SatelliteManager(@Nullable Context context) { this(context, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); @@ -116,7 +131,7 @@ public class SatelliteManager { /** * Bundle key to get the response from - * {@link #requestIsSatelliteDemoModeEnabled(Executor, OutcomeReceiver)}. + * {@link #requestIsDemoModeEnabled(Executor, OutcomeReceiver)}. * @hide */ public static final String KEY_DEMO_MODE_ENABLED = "demo_mode_enabled"; @@ -137,14 +152,6 @@ public class SatelliteManager { /** * Bundle key to get the response from - * {@link #requestMaxSizePerSendingDatagram(Executor, OutcomeReceiver)} . - * @hide - */ - public static final String KEY_MAX_CHARACTERS_PER_SATELLITE_TEXT = - "max_characters_per_satellite_text"; - - /** - * Bundle key to get the response from * {@link #requestIsSatelliteProvisioned(Executor, OutcomeReceiver)}. * @hide */ @@ -319,23 +326,25 @@ public class SatelliteManager { public @interface NTRadioTechnology {} /** - * Request to enable or disable the satellite modem. If the satellite modem is enabled, this - * will also disable the cellular modem, and if the satellite modem is disabled, this will also - * re-enable the cellular modem. + * Request to enable or disable the satellite modem and demo mode. If the satellite modem is + * enabled, this may also disable the cellular modem, and if the satellite modem is disabled, + * this may also re-enable the cellular modem. * - * @param enable {@code true} to enable the satellite modem and {@code false} to disable. + * @param enableSatellite {@code true} to enable the satellite modem and + * {@code false} to disable. + * @param enableDemoMode {@code true} to enable demo mode and {@code false} to disable. * @param executor The executor on which the error code listener will be called. - * @param errorCodeListener Listener for the {@link SatelliteError} result of the operation. + * @param resultListener 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 requestSatelliteEnabled( - boolean enable, @NonNull @CallbackExecutor Executor executor, - @NonNull Consumer<Integer> errorCodeListener) { + public void requestSatelliteEnabled(boolean enableSatellite, boolean enableDemoMode, + @NonNull @CallbackExecutor Executor executor, + @SatelliteError @NonNull Consumer<Integer> resultListener) { Objects.requireNonNull(executor); - Objects.requireNonNull(errorCodeListener); + Objects.requireNonNull(resultListener); try { ITelephony telephony = getITelephony(); @@ -344,10 +353,11 @@ public class SatelliteManager { @Override public void accept(int result) { executor.execute(() -> Binder.withCleanCallingIdentity( - () -> errorCodeListener.accept(result))); + () -> resultListener.accept(result))); } }; - telephony.requestSatelliteEnabled(mSubId, enable, errorCallback); + telephony.requestSatelliteEnabled(mSubId, enableSatellite, enableDemoMode, + errorCallback); } else { throw new IllegalStateException("telephony service is null."); } @@ -412,50 +422,13 @@ public class SatelliteManager { } /** - * Request to enable or disable the satellite service demo mode. - * - * @param enable {@code true} to enable the satellite demo mode and {@code false} to disable. - * @param executor The executor on which the error code listener will be called. - * @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 requestSatelliteDemoModeEnabled(boolean enable, - @NonNull @CallbackExecutor Executor executor, - @NonNull Consumer<Integer> errorCodeListener) { - 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.requestSatelliteDemoModeEnabled(mSubId, enable, errorCallback); - } else { - throw new IllegalStateException("telephony service is null."); - } - } catch (RemoteException ex) { - Rlog.e(TAG, "requestSatelliteDemoModeEnabled() RemoteException: ", ex); - ex.rethrowFromSystemServer(); - } - } - - /** * Request to get whether the satellite service demo mode is enabled. * * @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 a {@code boolean} with value {@code true} if the satellite - * demo mode is enabled and {@code false} otherwise. + * will return a {@code boolean} with value {@code true} if demo mode is enabled + * and {@code false} otherwise. * If the request is not successful, {@link OutcomeReceiver#onError(Throwable)} * will return a {@link SatelliteException} with the {@link SatelliteError}. * @@ -463,7 +436,7 @@ public class SatelliteManager { * @throws IllegalStateException if the Telephony process is not currently available. */ @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) - public void requestIsSatelliteDemoModeEnabled(@NonNull @CallbackExecutor Executor executor, + public void requestIsDemoModeEnabled(@NonNull @CallbackExecutor Executor executor, @NonNull OutcomeReceiver<Boolean, SatelliteException> callback) { Objects.requireNonNull(executor); Objects.requireNonNull(callback); @@ -492,12 +465,12 @@ public class SatelliteManager { } } }; - telephony.requestIsSatelliteDemoModeEnabled(mSubId, receiver); + telephony.requestIsDemoModeEnabled(mSubId, receiver); } else { throw new IllegalStateException("telephony service is null."); } } catch (RemoteException ex) { - loge("requestIsSatelliteDemoModeEnabled() RemoteException: " + ex); + loge("requestIsDemoModeEnabled() RemoteException: " + ex); ex.rethrowFromSystemServer(); } } @@ -742,145 +715,117 @@ public class SatelliteManager { public @interface DatagramType {} /** - * Start receiving satellite position updates. + * Start receiving satellite transmission updates. * This can be called by the pointing UI when the user starts pointing to the satellite. * Modem should continue to report the pointing input as the device or satellite moves. - * Satellite position updates are started only on {@link #SATELLITE_ERROR_NONE}. + * Satellite transmission updates are started only on {@link #SATELLITE_ERROR_NONE}. * All other results indicate that this operation failed. - * Once satellite position updates begin, datagram transfer state updates will be sent - * through {@link SatellitePositionUpdateCallback}. + * Once satellite transmission updates begin, position and datagram transfer state updates + * will be sent through {@link SatelliteTransmissionUpdateCallback}. * * @param executor The executor on which the callback and error code listener will be called. - * @param errorCodeListener Listener for the {@link SatelliteError} result of the operation. - * @param callback The callback to notify of changes in satellite position. + * @param resultListener Listener for the {@link SatelliteError} result of the operation. + * @param callback The callback to notify of satellite transmission updates. * * @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 startSatellitePositionUpdates(@NonNull @CallbackExecutor Executor executor, - @NonNull Consumer<Integer> errorCodeListener, - @NonNull SatellitePositionUpdateCallback callback) { + public void startSatelliteTransmissionUpdates(@NonNull @CallbackExecutor Executor executor, + @SatelliteError @NonNull Consumer<Integer> resultListener, + @NonNull SatelliteTransmissionUpdateCallback callback) { Objects.requireNonNull(executor); - Objects.requireNonNull(errorCodeListener); + Objects.requireNonNull(resultListener); Objects.requireNonNull(callback); try { ITelephony telephony = getITelephony(); if (telephony != null) { - callback.setExecutor(executor); IIntegerConsumer errorCallback = new IIntegerConsumer.Stub() { @Override public void accept(int result) { executor.execute(() -> Binder.withCleanCallingIdentity( - () -> errorCodeListener.accept(result))); + () -> resultListener.accept(result))); } }; - telephony.startSatellitePositionUpdates( - mSubId, errorCallback, callback.getBinder()); + ISatelliteTransmissionUpdateCallback internalCallback = + new ISatelliteTransmissionUpdateCallback.Stub() { + @Override + public void onDatagramTransferStateChanged(int state, + int sendPendingCount, int receivePendingCount, int errorCode) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> callback.onDatagramTransferStateChanged( + state, sendPendingCount, receivePendingCount, + errorCode))); + } + + @Override + public void onSatellitePositionChanged(PointingInfo pointingInfo) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> callback.onSatellitePositionChanged(pointingInfo))); + } + }; + sSatelliteTransmissionUpdateCallbackMap.put(callback, internalCallback); + telephony.startSatelliteTransmissionUpdates(mSubId, errorCallback, + internalCallback); } else { throw new IllegalStateException("telephony service is null."); } } catch (RemoteException ex) { - loge("startSatellitePositionUpdates() RemoteException: " + ex); + loge("startSatelliteTransmissionUpdates() RemoteException: " + ex); ex.rethrowFromSystemServer(); } } /** - * Stop receiving satellite position updates. + * Stop receiving satellite transmission updates. * This can be called by the pointing UI when the user stops pointing to the satellite. - * Satellite position updates are stopped and the callback is unregistered only on + * Satellite transmission updates are stopped and the callback is unregistered only on * {@link #SATELLITE_ERROR_NONE}. All other results that this operation failed. * - * @param callback The callback that was passed to - * {@link #startSatellitePositionUpdates(Executor, Consumer, SatellitePositionUpdateCallback)}. + * @param callback The callback that was passed to {@link + * #startSatelliteTransmissionUpdates(Executor, Consumer, SatelliteTransmissionUpdateCallback)}. * @param executor The executor on which the error code listener will be called. - * @param errorCodeListener Listener for the {@link SatelliteError} result of the operation. + * @param resultListener 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 stopSatellitePositionUpdates(@NonNull SatellitePositionUpdateCallback callback, + public void stopSatelliteTransmissionUpdates( + @NonNull SatelliteTransmissionUpdateCallback callback, @NonNull @CallbackExecutor Executor executor, - @NonNull Consumer<Integer> errorCodeListener) { + @SatelliteError @NonNull Consumer<Integer> resultListener) { Objects.requireNonNull(callback); 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.stopSatellitePositionUpdates(mSubId, errorCallback, - callback.getBinder()); - // TODO: Notify SmsHandler that pointing UI stopped - } else { - throw new IllegalStateException("telephony service is null."); - } - } catch (RemoteException ex) { - loge("stopSatellitePositionUpdates() RemoteException: " + ex); - ex.rethrowFromSystemServer(); - } - } - - /** - * Request to get the maximum number of bytes per datagram that can be sent to satellite. - * - * @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 the maximum number of bytes per datagram that can be sent to - * satellite. - * If the request is not successful, {@link OutcomeReceiver#onError(Throwable)} - * - * @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 requestMaxSizePerSendingDatagram( - @NonNull @CallbackExecutor Executor executor, - @NonNull OutcomeReceiver<Integer, SatelliteException> callback) { - Objects.requireNonNull(executor); - Objects.requireNonNull(callback); + Objects.requireNonNull(resultListener); + ISatelliteTransmissionUpdateCallback internalCallback = + sSatelliteTransmissionUpdateCallbackMap.remove(callback); try { ITelephony telephony = getITelephony(); if (telephony != null) { - ResultReceiver receiver = new ResultReceiver(null) { - @Override - protected void onReceiveResult(int resultCode, Bundle resultData) { - if (resultCode == SATELLITE_ERROR_NONE) { - if (resultData.containsKey(KEY_MAX_CHARACTERS_PER_SATELLITE_TEXT)) { - int maxCharacters = - resultData.getInt(KEY_MAX_CHARACTERS_PER_SATELLITE_TEXT); - executor.execute(() -> Binder.withCleanCallingIdentity(() -> - callback.onResult(maxCharacters))); - } else { - loge("KEY_MAX_CHARACTERS_PER_SATELLITE_TEXT does not exist."); - executor.execute(() -> Binder.withCleanCallingIdentity(() -> - callback.onError( - new SatelliteException(SATELLITE_REQUEST_FAILED)))); - } - } else { - executor.execute(() -> Binder.withCleanCallingIdentity(() -> - callback.onError(new SatelliteException(resultCode)))); + if (internalCallback != null) { + IIntegerConsumer errorCallback = new IIntegerConsumer.Stub() { + @Override + public void accept(int result) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> resultListener.accept(result))); } - } - }; - telephony.requestMaxSizePerSendingDatagram(mSubId, receiver); + }; + telephony.stopSatelliteTransmissionUpdates(mSubId, errorCallback, + internalCallback); + // TODO: Notify SmsHandler that pointing UI stopped + } else { + loge("stopSatelliteTransmissionUpdates: No internal callback."); + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> resultListener.accept(SATELLITE_INVALID_ARGUMENTS))); + } } else { throw new IllegalStateException("telephony service is null."); } } catch (RemoteException ex) { - loge("requestMaxCharactersPerSatelliteTextMessage() RemoteException: " + ex); + loge("stopSatelliteTransmissionUpdates() RemoteException: " + ex); ex.rethrowFromSystemServer(); } } @@ -891,23 +836,24 @@ public class SatelliteManager { * * @param token The token to be used as a unique identifier for provisioning with satellite * gateway. + * @param regionId The region ID for the device's current location. * @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. * @param executor The executor on which the error code listener will be called. - * @param errorCodeListener Listener for the {@link SatelliteError} result of the operation. + * @param resultListener 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 provisionSatelliteService(@NonNull String token, + public void provisionSatelliteService(@NonNull String token, @NonNull String regionId, @Nullable CancellationSignal cancellationSignal, @NonNull @CallbackExecutor Executor executor, - @SatelliteError @NonNull Consumer<Integer> errorCodeListener) { + @SatelliteError @NonNull Consumer<Integer> resultListener) { Objects.requireNonNull(token); Objects.requireNonNull(executor); - Objects.requireNonNull(errorCodeListener); + Objects.requireNonNull(resultListener); ICancellationSignal cancelRemote = null; try { @@ -917,10 +863,11 @@ public class SatelliteManager { @Override public void accept(int result) { executor.execute(() -> Binder.withCleanCallingIdentity( - () -> errorCodeListener.accept(result))); + () -> resultListener.accept(result))); } }; - cancelRemote = telephony.provisionSatelliteService(mSubId, token, errorCallback); + cancelRemote = telephony.provisionSatelliteService(mSubId, token, regionId, + errorCallback); } else { throw new IllegalStateException("telephony service is null."); } @@ -942,7 +889,7 @@ public class SatelliteManager { * {@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. + * @param resultListener 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. @@ -950,10 +897,10 @@ public class SatelliteManager { @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) public void deprovisionSatelliteService(@NonNull String token, @NonNull @CallbackExecutor Executor executor, - @SatelliteError @NonNull Consumer<Integer> errorCodeListener) { + @SatelliteError @NonNull Consumer<Integer> resultListener) { Objects.requireNonNull(token); Objects.requireNonNull(executor); - Objects.requireNonNull(errorCodeListener); + Objects.requireNonNull(resultListener); try { ITelephony telephony = getITelephony(); @@ -962,7 +909,7 @@ public class SatelliteManager { @Override public void accept(int result) { executor.execute(() -> Binder.withCleanCallingIdentity( - () -> errorCodeListener.accept(result))); + () -> resultListener.accept(result))); } }; telephony.deprovisionSatelliteService(mSubId, token, errorCallback); @@ -996,9 +943,18 @@ public class SatelliteManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - callback.setExecutor(executor); + ISatelliteProvisionStateCallback internalCallback = + new ISatelliteProvisionStateCallback.Stub() { + @Override + public void onSatelliteProvisionStateChanged(boolean provisioned) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> callback.onSatelliteProvisionStateChanged( + provisioned))); + } + }; + sSatelliteProvisionStateCallbackMap.put(callback, internalCallback); return telephony.registerForSatelliteProvisionStateChanged( - mSubId, callback.getBinder()); + mSubId, internalCallback); } else { throw new IllegalStateException("telephony service is null."); } @@ -1023,11 +979,17 @@ public class SatelliteManager { public void unregisterForSatelliteProvisionStateChanged( @NonNull SatelliteProvisionStateCallback callback) { Objects.requireNonNull(callback); + ISatelliteProvisionStateCallback internalCallback = + sSatelliteProvisionStateCallbackMap.remove(callback); try { ITelephony telephony = getITelephony(); if (telephony != null) { - telephony.unregisterForSatelliteProvisionStateChanged(mSubId, callback.getBinder()); + if (internalCallback != null) { + telephony.unregisterForSatelliteProvisionStateChanged(mSubId, internalCallback); + } else { + loge("unregisterForSatelliteProvisionStateChanged: No internal callback."); + } } else { throw new IllegalStateException("telephony service is null."); } @@ -1112,9 +1074,15 @@ public class SatelliteManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - callback.setExecutor(executor); - return telephony.registerForSatelliteModemStateChanged(mSubId, - callback.getBinder()); + ISatelliteStateCallback internalCallback = new ISatelliteStateCallback.Stub() { + @Override + public void onSatelliteModemStateChanged(int state) { + executor.execute(() -> Binder.withCleanCallingIdentity(() -> + callback.onSatelliteModemStateChanged(state))); + } + }; + sSatelliteStateCallbackMap.put(callback, internalCallback); + return telephony.registerForSatelliteModemStateChanged(mSubId, internalCallback); } else { throw new IllegalStateException("telephony service is null."); } @@ -1138,11 +1106,16 @@ public class SatelliteManager { @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) public void unregisterForSatelliteModemStateChanged(@NonNull SatelliteStateCallback callback) { Objects.requireNonNull(callback); + ISatelliteStateCallback internalCallback = sSatelliteStateCallbackMap.remove(callback); try { ITelephony telephony = getITelephony(); if (telephony != null) { - telephony.unregisterForSatelliteModemStateChanged(mSubId, callback.getBinder()); + if (internalCallback != null) { + telephony.unregisterForSatelliteModemStateChanged(mSubId, internalCallback); + } else { + loge("unregisterForSatelliteModemStateChanged: No internal callback."); + } } else { throw new IllegalStateException("telephony service is null."); } @@ -1155,8 +1128,6 @@ public class SatelliteManager { /** * Register to receive incoming datagrams over satellite. * - * @param datagramType datagram type indicating whether the datagram is of type - * SOS_SMS or LOCATION_SHARING. * @param executor The executor on which the callback will be called. * @param callback The callback to handle incoming datagrams over satellite. * This callback with be invoked when a new datagram is received from satellite. @@ -1167,7 +1138,7 @@ public class SatelliteManager { * @throws IllegalStateException if the Telephony process is not currently available. */ @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) - @SatelliteError public int registerForSatelliteDatagram(@DatagramType int datagramType, + @SatelliteError public int registerForSatelliteDatagram( @NonNull @CallbackExecutor Executor executor, @NonNull SatelliteDatagramCallback callback) { Objects.requireNonNull(executor); @@ -1176,9 +1147,19 @@ public class SatelliteManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - callback.setExecutor(executor); - return telephony.registerForSatelliteDatagram(mSubId, datagramType, - callback.getBinder()); + ISatelliteDatagramCallback internalCallback = + new ISatelliteDatagramCallback.Stub() { + @Override + public void onSatelliteDatagramReceived(long datagramId, + @NonNull SatelliteDatagram datagram, int pendingCount, + @NonNull ILongConsumer ack) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> callback.onSatelliteDatagramReceived( + datagramId, datagram, pendingCount, ack))); + } + }; + sSatelliteDatagramCallbackMap.put(callback, internalCallback); + return telephony.registerForSatelliteDatagram(mSubId, internalCallback); } else { throw new IllegalStateException("telephony service is null."); } @@ -1194,7 +1175,7 @@ public class SatelliteManager { * If callback was not registered before, the request will be ignored. * * @param callback The callback that was passed to - * {@link #registerForSatelliteDatagram(int, Executor, SatelliteDatagramCallback)}. + * {@link #registerForSatelliteDatagram(Executor, SatelliteDatagramCallback)}. * * @throws SecurityException if the caller doesn't have required permission. * @throws IllegalStateException if the Telephony process is not currently available. @@ -1202,11 +1183,17 @@ public class SatelliteManager { @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) public void unregisterForSatelliteDatagram(@NonNull SatelliteDatagramCallback callback) { Objects.requireNonNull(callback); + ISatelliteDatagramCallback internalCallback = + sSatelliteDatagramCallbackMap.remove(callback); try { ITelephony telephony = getITelephony(); if (telephony != null) { - telephony.unregisterForSatelliteDatagram(mSubId, callback.getBinder()); + if (internalCallback != null) { + telephony.unregisterForSatelliteDatagram(mSubId, internalCallback); + } else { + loge("unregisterForSatelliteDatagram: No internal callback."); + } } else { throw new IllegalStateException("telephony service is null."); } @@ -1222,7 +1209,7 @@ public class SatelliteManager { * This method requests modem to check if there are any pending datagrams to be received over * satellite. If there are any incoming datagrams, they will be received via * {@link SatelliteDatagramCallback#onSatelliteDatagramReceived(long, SatelliteDatagram, int, - * ISatelliteDatagramReceiverAck)} + * ILongConsumer)} * * @param executor The executor on which the result listener will be called. * @param resultListener Listener for the {@link SatelliteError} result of the operation. @@ -1371,9 +1358,8 @@ public class SatelliteManager { } /** - * Request to get the time after which the satellite will be visible. This is an - * {@code int} representing the duration in seconds after which the satellite will be visible. - * This will return {@code 0} if the satellite is currently visible. + * Request to get the duration in seconds after which the satellite will be visible. + * This will be {@link Duration#ZERO} if the satellite is currently visible. * * @param executor The executor on which the callback will be called. * @param callback The callback object to which the result will be delivered. @@ -1387,7 +1373,7 @@ public class SatelliteManager { */ @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION) public void requestTimeForNextSatelliteVisibility(@NonNull @CallbackExecutor Executor executor, - @NonNull OutcomeReceiver<Integer, SatelliteException> callback) { + @NonNull OutcomeReceiver<Duration, SatelliteException> callback) { Objects.requireNonNull(executor); Objects.requireNonNull(callback); @@ -1402,7 +1388,8 @@ public class SatelliteManager { int nextVisibilityDuration = resultData.getInt(KEY_SATELLITE_NEXT_VISIBILITY); executor.execute(() -> Binder.withCleanCallingIdentity(() -> - callback.onResult(nextVisibilityDuration))); + callback.onResult( + Duration.ofSeconds(nextVisibilityDuration)))); } else { loge("KEY_SATELLITE_NEXT_VISIBILITY does not exist."); executor.execute(() -> Binder.withCleanCallingIdentity(() -> diff --git a/telephony/java/android/telephony/satellite/SatellitePositionUpdateCallback.java b/telephony/java/android/telephony/satellite/SatellitePositionUpdateCallback.java deleted file mode 100644 index d44a84d6db88..000000000000 --- a/telephony/java/android/telephony/satellite/SatellitePositionUpdateCallback.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.telephony.satellite; - -import android.annotation.NonNull; -import android.os.Binder; - -import java.util.concurrent.Executor; - -/** - * A callback class for monitoring satellite position update and datagram transfer state change - * events. - * - * @hide - */ -public class SatellitePositionUpdateCallback { - private final CallbackBinder mBinder = new CallbackBinder(this); - - private static class CallbackBinder extends ISatellitePositionUpdateCallback.Stub { - private final SatellitePositionUpdateCallback mLocalCallback; - private Executor mExecutor; - - private CallbackBinder(SatellitePositionUpdateCallback localCallback) { - mLocalCallback = localCallback; - } - - @Override - public void onSatellitePositionChanged(@NonNull PointingInfo pointingInfo) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - mExecutor.execute(() -> - mLocalCallback.onSatellitePositionChanged(pointingInfo)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - - @Override - public void onDatagramTransferStateChanged( - @SatelliteManager.SatelliteDatagramTransferState int state, int sendPendingCount, - int receivePendingCount, @SatelliteManager.SatelliteError int errorCode) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - mExecutor.execute(() -> - mLocalCallback.onDatagramTransferStateChanged( - state, sendPendingCount, receivePendingCount, errorCode)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - - private void setExecutor(Executor executor) { - mExecutor = executor; - } - } - - /** - * Called when the satellite position changed. - * - * @param pointingInfo The pointing info containing the satellite location. - */ - public void onSatellitePositionChanged(@NonNull PointingInfo pointingInfo) { - // Base Implementation - } - - /** - * Called when satellite datagram transfer state changed. - * - * @param state The new datagram transfer state. - * @param sendPendingCount The number of datagrams that are currently being sent. - * @param receivePendingCount The number of datagrams that are currently being received. - * @param errorCode If datagram transfer failed, the reason for failure. - */ - public void onDatagramTransferStateChanged( - @SatelliteManager.SatelliteDatagramTransferState int state, int sendPendingCount, - int receivePendingCount, @SatelliteManager.SatelliteError int errorCode) { - // Base Implementation - } - - /**@hide*/ - @NonNull - final ISatellitePositionUpdateCallback getBinder() { - return mBinder; - } - - /**@hide*/ - public void setExecutor(@NonNull Executor executor) { - mBinder.setExecutor(executor); - } -} diff --git a/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java b/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java index 2b6a5d97d3a6..a62eb8b8a5fb 100644 --- a/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java +++ b/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java @@ -16,61 +16,17 @@ package android.telephony.satellite; -import android.annotation.NonNull; -import android.os.Binder; - -import java.util.concurrent.Executor; - /** * A callback class for monitoring satellite provision state change events. * * @hide */ -public class SatelliteProvisionStateCallback { - private final CallbackBinder mBinder = new CallbackBinder(this); - - private static class CallbackBinder extends ISatelliteProvisionStateCallback.Stub { - private final SatelliteProvisionStateCallback mLocalCallback; - private Executor mExecutor; - - private CallbackBinder(SatelliteProvisionStateCallback localCallback) { - mLocalCallback = localCallback; - } - - @Override - public void onSatelliteProvisionStateChanged(boolean provisioned) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - mExecutor.execute(() -> - mLocalCallback.onSatelliteProvisionStateChanged(provisioned)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - - private void setExecutor(Executor executor) { - mExecutor = executor; - } - } - +public interface SatelliteProvisionStateCallback { /** * Called when satellite provision state changes. * * @param provisioned The new provision state. {@code true} means satellite is provisioned * {@code false} means satellite is not provisioned. */ - public void onSatelliteProvisionStateChanged(boolean provisioned) { - // Base Implementation - } - - /**@hide*/ - @NonNull - final ISatelliteProvisionStateCallback getBinder() { - return mBinder; - } - - /**@hide*/ - public void setExecutor(@NonNull Executor executor) { - mBinder.setExecutor(executor); - } + void onSatelliteProvisionStateChanged(boolean provisioned); } diff --git a/telephony/java/android/telephony/satellite/SatelliteStateCallback.java b/telephony/java/android/telephony/satellite/SatelliteStateCallback.java index 17d05b79fef5..d9ecaa3467e3 100644 --- a/telephony/java/android/telephony/satellite/SatelliteStateCallback.java +++ b/telephony/java/android/telephony/satellite/SatelliteStateCallback.java @@ -16,80 +16,15 @@ package android.telephony.satellite; -import android.annotation.NonNull; -import android.os.Binder; - -import java.util.concurrent.Executor; - /** * A callback class for monitoring satellite modem state change events. * * @hide */ -public class SatelliteStateCallback { - private final CallbackBinder mBinder = new CallbackBinder(this); - - private static class CallbackBinder extends ISatelliteStateCallback.Stub { - private final SatelliteStateCallback mLocalCallback; - private Executor mExecutor; - - private CallbackBinder(SatelliteStateCallback localCallback) { - mLocalCallback = localCallback; - } - - @Override - public void onSatelliteModemStateChanged(@SatelliteManager.SatelliteModemState int state) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - mExecutor.execute(() -> - mLocalCallback.onSatelliteModemStateChanged(state)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - - @Override - public void onPendingDatagramCount(int count) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - mExecutor.execute(() -> - mLocalCallback.onPendingDatagramCount(count)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - - private void setExecutor(Executor executor) { - mExecutor = executor; - } - } - +public interface SatelliteStateCallback { /** * Called when satellite modem state changes. * @param state The new satellite modem state. */ - public void onSatelliteModemStateChanged(@SatelliteManager.SatelliteModemState int state) { - // Base Implementation - } - - /** - * Called when there are pending datagrams to be received from satellite. - * @param count Pending datagram count. - */ - public void onPendingDatagramCount(int count) { - // Base Implementation - } - - //TODO: Add an API for datagram transfer state update here. - - /**@hide*/ - @NonNull - final ISatelliteStateCallback getBinder() { - return mBinder; - } - - /**@hide*/ - public void setExecutor(@NonNull Executor executor) { - mBinder.setExecutor(executor); - } + void onSatelliteModemStateChanged(@SatelliteManager.SatelliteModemState int state); } diff --git a/telephony/java/android/telephony/satellite/SatelliteTransmissionUpdateCallback.java b/telephony/java/android/telephony/satellite/SatelliteTransmissionUpdateCallback.java new file mode 100644 index 000000000000..0efbd1fbdfef --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatelliteTransmissionUpdateCallback.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony.satellite; + +import android.annotation.NonNull; + +/** + * A callback class for monitoring satellite position update and datagram transfer state change + * events. + * + * @hide + */ +public interface SatelliteTransmissionUpdateCallback { + /** + * Called when the satellite position changed. + * + * @param pointingInfo The pointing info containing the satellite location. + */ + void onSatellitePositionChanged(@NonNull PointingInfo pointingInfo); + + /** + * Called when satellite datagram transfer state changed. + * + * @param state The new datagram transfer state. + * @param sendPendingCount The number of datagrams that are currently being sent. + * @param receivePendingCount The number of datagrams that are currently being received. + * @param errorCode If datagram transfer failed, the reason for failure. + */ + void onDatagramTransferStateChanged(@SatelliteManager.SatelliteDatagramTransferState int state, + int sendPendingCount, int receivePendingCount, + @SatelliteManager.SatelliteError int errorCode); +} diff --git a/telephony/java/android/telephony/satellite/stub/ISatellite.aidl b/telephony/java/android/telephony/satellite/stub/ISatellite.aidl index d93ee217c2fb..a780cb936ebd 100644 --- a/telephony/java/android/telephony/satellite/stub/ISatellite.aidl +++ b/telephony/java/android/telephony/satellite/stub/ISatellite.aidl @@ -49,10 +49,9 @@ oneway interface ISatellite { * Listening mode allows the satellite service to listen for incoming pages. * * @param enable True to enable satellite listening mode and false to disable. - * @param isDemoMode Whether demo mode is enabled. * @param timeout How long the satellite modem should wait for the next incoming page before * disabling listening mode. - * @param errorCallback The callback to receive the error code result of the operation. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -64,16 +63,17 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestSatelliteListeningEnabled(in boolean enable, in boolean isDemoMode, in int timeout, - in IIntegerConsumer errorCallback); + void requestSatelliteListeningEnabled(in boolean enable, in int timeout, + in IIntegerConsumer resultCallback); /** - * Request to enable or disable the satellite modem. If the satellite modem is enabled, - * this will also disable the cellular modem, and if the satellite modem is disabled, - * this will also re-enable the cellular modem. + * Request to enable or disable the satellite modem and demo mode. If the satellite modem + * is enabled, this may also disable the cellular modem, and if the satellite modem is disabled, + * this may also re-enable the cellular modem. * - * @param enable True to enable the satellite modem and false to disable. - * @param errorCallback The callback to receive the error code result of the operation. + * @param enableSatellite True to enable the satellite modem and false to disable. + * @param enableDemoMode True to enable demo mode and false to disable. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -85,13 +85,14 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestSatelliteEnabled(in boolean enabled, in IIntegerConsumer errorCallback); + void requestSatelliteEnabled(in boolean enableSatellite, in boolean enableDemoMode, + in IIntegerConsumer resultCallback); /** * Request to get whether the satellite modem is enabled. * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. + * @param resultCallback The callback to receive the error code result of the operation. + * This must only be sent when the error is not SatelliteError#ERROR_NONE. * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive * whether the satellite modem is enabled. * @@ -105,13 +106,13 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestIsSatelliteEnabled(in IIntegerConsumer errorCallback, in IBooleanConsumer callback); + void requestIsSatelliteEnabled(in IIntegerConsumer resultCallback, in IBooleanConsumer callback); /** * Request to get whether the satellite service is supported on the device. * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. + * @param resultCallback The callback to receive the error code result of the operation. + * This must only be sent when the error is not SatelliteError#ERROR_NONE. * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive * whether the satellite service is supported on the device. * @@ -125,14 +126,14 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestIsSatelliteSupported(in IIntegerConsumer errorCallback, + void requestIsSatelliteSupported(in IIntegerConsumer resultCallback, in IBooleanConsumer callback); /** * Request to get the SatelliteCapabilities of the satellite service. * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. + * @param resultCallback The callback to receive the error code result of the operation. + * This must only be sent when the error is not SatelliteError#ERROR_NONE. * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive * the SatelliteCapabilities of the satellite service. * @@ -146,7 +147,7 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestSatelliteCapabilities(in IIntegerConsumer errorCallback, + void requestSatelliteCapabilities(in IIntegerConsumer resultCallback, in ISatelliteCapabilitiesConsumer callback); /** @@ -154,7 +155,7 @@ oneway interface ISatellite { * The satellite service should report the satellite pointing info via * ISatelliteListener#onSatellitePositionChanged as the user device/satellite moves. * - * @param errorCallback The callback to receive the error code result of the operation. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -166,13 +167,13 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void startSendingSatellitePointingInfo(in IIntegerConsumer errorCallback); + void startSendingSatellitePointingInfo(in IIntegerConsumer resultCallback); /** * User stopped pointing to the satellite. * The satellite service should stop reporting satellite pointing info to the framework. * - * @param errorCallback The callback to receive the error code result of the operation. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -184,28 +185,7 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void stopSendingSatellitePointingInfo(in IIntegerConsumer errorCallback); - - /** - * Request to get the maximum number of characters per MO text message on satellite. - * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. - * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive - * the maximum number of characters per MO text message on satellite. - * - * Valid error codes returned: - * SatelliteError:ERROR_NONE - * SatelliteError:SERVICE_ERROR - * SatelliteError:MODEM_ERROR - * SatelliteError:INVALID_MODEM_STATE - * SatelliteError:INVALID_ARGUMENTS - * SatelliteError:RADIO_NOT_AVAILABLE - * SatelliteError:REQUEST_NOT_SUPPORTED - * SatelliteError:NO_RESOURCES - */ - void requestMaxCharactersPerMOTextMessage(in IIntegerConsumer errorCallback, - in IIntegerConsumer callback); + void stopSendingSatellitePointingInfo(in IIntegerConsumer resultCallback); /** * Provision the device with a satellite provider. @@ -214,7 +194,8 @@ oneway interface ISatellite { * * @param token The token to be used as a unique identifier for provisioning with satellite * gateway. - * @param errorCallback The callback to receive the error code result of the operation. + * @param regionId The region ID for the device's current location. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -229,7 +210,8 @@ oneway interface ISatellite { * SatelliteError:REQUEST_ABORTED * SatelliteError:NETWORK_TIMEOUT */ - void provisionSatelliteService(in String token, in IIntegerConsumer errorCallback); + void provisionSatelliteService(in String token, in String regionId, + in IIntegerConsumer resultCallback); /** * Deprovision the device with the satellite provider. @@ -237,7 +219,7 @@ oneway interface ISatellite { * Once deprovisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report false. * * @param token The token of the device/subscription to be deprovisioned. - * @param errorCallback The callback to receive the error code result of the operation. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -252,13 +234,13 @@ oneway interface ISatellite { * SatelliteError:REQUEST_ABORTED * SatelliteError:NETWORK_TIMEOUT */ - void deprovisionSatelliteService(in String token, in IIntegerConsumer errorCallback); + void deprovisionSatelliteService(in String token, in IIntegerConsumer resultCallback); /** * Request to get whether this device is provisioned with a satellite provider. * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. + * @param resultCallback The callback to receive the error code result of the operation. + * This must only be sent when the error is not SatelliteError#ERROR_NONE. * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive * whether this device is provisioned with a satellite provider. * @@ -272,7 +254,7 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestIsSatelliteProvisioned(in IIntegerConsumer errorCallback, + void requestIsSatelliteProvisioned(in IIntegerConsumer resultCallback, in IBooleanConsumer callback); /** @@ -280,7 +262,7 @@ oneway interface ISatellite { * The satellite service should check if there are any pending datagrams to be received over * satellite and report them via ISatelliteListener#onSatelliteDatagramsReceived. * - * @param errorCallback The callback to receive the error code result of the operation. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -297,15 +279,14 @@ oneway interface ISatellite { * SatelliteError:SATELLITE_NOT_REACHABLE * SatelliteError:NOT_AUTHORIZED */ - void pollPendingSatelliteDatagrams(in IIntegerConsumer errorCallback); + void pollPendingSatelliteDatagrams(in IIntegerConsumer resultCallback); /** * Send datagram over satellite. * * @param datagram Datagram to send in byte format. - * @param isDemoMode Whether demo mode is enabled. * @param isEmergency Whether this is an emergency datagram. - * @param errorCallback The callback to receive the error code result of the operation. + * @param resultCallback The callback to receive the error code result of the operation. * * Valid error codes returned: * SatelliteError:ERROR_NONE @@ -323,16 +304,16 @@ oneway interface ISatellite { * SatelliteError:SATELLITE_NOT_REACHABLE * SatelliteError:NOT_AUTHORIZED */ - void sendSatelliteDatagram(in SatelliteDatagram datagram, in boolean isDemoMode, - in boolean isEmergency, in IIntegerConsumer errorCallback); + void sendSatelliteDatagram(in SatelliteDatagram datagram, in boolean isEmergency, + in IIntegerConsumer resultCallback); /** * Request the current satellite modem state. * The satellite service should report the current satellite modem state via * ISatelliteListener#onSatelliteModemStateChanged. * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. + * @param resultCallback The callback to receive the error code result of the operation. + * This must only be sent when the error is not SatelliteError#ERROR_NONE. * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive * the current satellite modem state. * @@ -346,14 +327,14 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestSatelliteModemState(in IIntegerConsumer errorCallback, + void requestSatelliteModemState(in IIntegerConsumer resultCallback, in IIntegerConsumer callback); /** * Request to get whether satellite communication is allowed for the current location. * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. + * @param resultCallback The callback to receive the error code result of the operation. + * This must only be sent when the error is not SatelliteError#ERROR_NONE. * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive * whether satellite communication is allowed for the current location. * @@ -368,15 +349,15 @@ oneway interface ISatellite { * SatelliteError:NO_RESOURCES */ void requestIsSatelliteCommunicationAllowedForCurrentLocation( - in IIntegerConsumer errorCallback, in IBooleanConsumer callback); + in IIntegerConsumer resultCallback, in IBooleanConsumer callback); /** * Request to get the time after which the satellite will be visible. This is an int * representing the duration in seconds after which the satellite will be visible. * This will return 0 if the satellite is currently visible. * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. + * @param resultCallback The callback to receive the error code result of the operation. + * This must only be sent when the error is not SatelliteError#ERROR_NONE. * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive * the time after which the satellite will be visible. * @@ -390,6 +371,6 @@ oneway interface ISatellite { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - void requestTimeForNextSatelliteVisibility(in IIntegerConsumer errorCallback, + void requestTimeForNextSatelliteVisibility(in IIntegerConsumer resultCallback, in IIntegerConsumer callback); } diff --git a/telephony/java/android/telephony/satellite/stub/ISatelliteListener.aidl b/telephony/java/android/telephony/satellite/stub/ISatelliteListener.aidl index d9668687e6e6..5e692151c604 100644 --- a/telephony/java/android/telephony/satellite/stub/ISatelliteListener.aidl +++ b/telephony/java/android/telephony/satellite/stub/ISatelliteListener.aidl @@ -43,10 +43,8 @@ oneway interface ISatelliteListener { /** * Indicates that the satellite has pending datagrams for the device to be pulled. - * - * @param count Number of pending datagrams. */ - void onPendingDatagramCount(in int count); + void onPendingDatagrams(); /** * Indicates that the satellite pointing input has changed. @@ -61,11 +59,4 @@ oneway interface ISatelliteListener { * @param state The current satellite modem state. */ void onSatelliteModemStateChanged(in SatelliteModemState state); - - /** - * Indicates that the satellite radio technology has changed. - * - * @param technology The current satellite radio technology. - */ - void onSatelliteRadioTechnologyChanged(in NTRadioTechnology technology); } diff --git a/telephony/java/android/telephony/satellite/stub/PointingInfo.aidl b/telephony/java/android/telephony/satellite/stub/PointingInfo.aidl index 83392dd3585e..52a36d8b29a3 100644 --- a/telephony/java/android/telephony/satellite/stub/PointingInfo.aidl +++ b/telephony/java/android/telephony/satellite/stub/PointingInfo.aidl @@ -29,21 +29,4 @@ parcelable PointingInfo { * Satellite elevation in degrees. */ float satelliteElevation; - - /** - * Antenna azimuth in degrees. - */ - float antennaAzimuth; - - /** - * Angle of rotation about the x axis. This value represents the angle between a plane - * parallel to the device's screen and a plane parallel to the ground. - */ - float antennaPitch; - - /** - * Angle of rotation about the y axis. This value represents the angle between a plane - * perpendicular to the device's screen and a plane parallel to the ground. - */ - float antennaRoll; } diff --git a/telephony/java/android/telephony/satellite/stub/SatelliteCapabilities.aidl b/telephony/java/android/telephony/satellite/stub/SatelliteCapabilities.aidl index 10c2ea384e1b..cd69da18c5b0 100644 --- a/telephony/java/android/telephony/satellite/stub/SatelliteCapabilities.aidl +++ b/telephony/java/android/telephony/satellite/stub/SatelliteCapabilities.aidl @@ -28,18 +28,12 @@ parcelable SatelliteCapabilities { NTRadioTechnology[] supportedRadioTechnologies; /** - * Whether satellite modem is always on. - * This indicates the power impact of keeping it on is very minimal. - */ - boolean isAlwaysOn; - - /** * Whether UE needs to point to a satellite to send and receive data. */ - boolean needsPointingToSatellite; + boolean isPointingRequired; /** - * Whether UE needs a separate SIM profile to communicate with the satellite network. + * The maximum number of bytes per datagram that can be sent over satellite. */ - boolean needsSeparateSimProfile; + int maxBytesPerOutgoingDatagram; } diff --git a/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java b/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java index 711dcbe3f62b..debb394ed234 100644 --- a/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java +++ b/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java @@ -70,20 +70,21 @@ public class SatelliteImplBase extends SatelliteService { } @Override - public void requestSatelliteListeningEnabled(boolean enable, boolean isDemoMode, - int timeout, IIntegerConsumer errorCallback) throws RemoteException { + public void requestSatelliteListeningEnabled(boolean enable, int timeout, + IIntegerConsumer errorCallback) throws RemoteException { executeMethodAsync( () -> SatelliteImplBase.this - .requestSatelliteListeningEnabled( - enable, isDemoMode, timeout, errorCallback), + .requestSatelliteListeningEnabled(enable, timeout, errorCallback), "requestSatelliteListeningEnabled"); } @Override - public void requestSatelliteEnabled(boolean enable, IIntegerConsumer errorCallback) - throws RemoteException { + public void requestSatelliteEnabled(boolean enableSatellite, boolean enableDemoMode, + IIntegerConsumer errorCallback) throws RemoteException { executeMethodAsync( - () -> SatelliteImplBase.this.requestSatelliteEnabled(enable, errorCallback), + () -> SatelliteImplBase.this + .requestSatelliteEnabled( + enableSatellite, enableDemoMode, errorCallback), "requestSatelliteEnabled"); } @@ -131,19 +132,11 @@ public class SatelliteImplBase extends SatelliteService { } @Override - public void requestMaxCharactersPerMOTextMessage(IIntegerConsumer errorCallback, - IIntegerConsumer callback) throws RemoteException { + public void provisionSatelliteService(String token, String regionId, + IIntegerConsumer errorCallback) throws RemoteException { executeMethodAsync( () -> SatelliteImplBase.this - .requestMaxCharactersPerMOTextMessage(errorCallback, callback), - "requestMaxCharactersPerMOTextMessage"); - } - - @Override - public void provisionSatelliteService(String token, IIntegerConsumer errorCallback) - throws RemoteException { - executeMethodAsync( - () -> SatelliteImplBase.this.provisionSatelliteService(token, errorCallback), + .provisionSatelliteService(token, regionId, errorCallback), "provisionSatelliteService"); } @@ -173,12 +166,11 @@ public class SatelliteImplBase extends SatelliteService { } @Override - public void sendSatelliteDatagram(SatelliteDatagram datagram, boolean isDemoMode, - boolean isEmergency, IIntegerConsumer errorCallback) throws RemoteException { + public void sendSatelliteDatagram(SatelliteDatagram datagram, boolean isEmergency, + IIntegerConsumer errorCallback) throws RemoteException { executeMethodAsync( () -> SatelliteImplBase.this - .sendSatelliteDatagram( - datagram, isDemoMode, isEmergency, errorCallback), + .sendSatelliteDatagram(datagram, isEmergency, errorCallback), "sendSatelliteDatagram"); } @@ -249,7 +241,6 @@ public class SatelliteImplBase extends SatelliteService { * Listening mode allows the satellite service to listen for incoming pages. * * @param enable True to enable satellite listening mode and false to disable. - * @param isDemoMode Whether demo mode is enabled. * @param timeout How long the satellite modem should wait for the next incoming page before * disabling listening mode. * @param errorCallback The callback to receive the error code result of the operation. @@ -264,17 +255,18 @@ public class SatelliteImplBase extends SatelliteService { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - public void requestSatelliteListeningEnabled(boolean enable, boolean isDemoMode, int timeout, + public void requestSatelliteListeningEnabled(boolean enable, int timeout, @NonNull IIntegerConsumer errorCallback) { // stub implementation } /** - * Request to enable or disable the satellite modem. If the satellite modem is enabled, - * this will also disable the cellular modem, and if the satellite modem is disabled, - * this will also re-enable the cellular modem. + * Request to enable or disable the satellite modem and demo mode. If the satellite modem is + * enabled, this may also disable the cellular modem, and if the satellite modem is disabled, + * this may also re-enable the cellular modem. * - * @param enable True to enable the satellite modem and false to disable. + * @param enableSatellite True to enable the satellite modem and false to disable. + * @param enableDemoMode True to enable demo mode and false to disable. * @param errorCallback The callback to receive the error code result of the operation. * * Valid error codes returned: @@ -287,7 +279,8 @@ public class SatelliteImplBase extends SatelliteService { * SatelliteError:REQUEST_NOT_SUPPORTED * SatelliteError:NO_RESOURCES */ - public void requestSatelliteEnabled(boolean enable, @NonNull IIntegerConsumer errorCallback) { + public void requestSatelliteEnabled(boolean enableSatellite, boolean enableDemoMode, + @NonNull IIntegerConsumer errorCallback) { // stub implementation } @@ -402,35 +395,13 @@ public class SatelliteImplBase extends SatelliteService { } /** - * Request to get the maximum number of characters per MO text message on satellite. - * - * @param errorCallback The callback to receive the error code result of the operation. - * This must only be sent when the result is not SatelliteError#ERROR_NONE. - * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive - * the maximum number of characters per MO text message on satellite. - * - * Valid error codes returned: - * SatelliteError:ERROR_NONE - * SatelliteError:SERVICE_ERROR - * SatelliteError:MODEM_ERROR - * SatelliteError:INVALID_MODEM_STATE - * SatelliteError:INVALID_ARGUMENTS - * SatelliteError:RADIO_NOT_AVAILABLE - * SatelliteError:REQUEST_NOT_SUPPORTED - * SatelliteError:NO_RESOURCES - */ - public void requestMaxCharactersPerMOTextMessage(@NonNull IIntegerConsumer errorCallback, - @NonNull IIntegerConsumer callback) { - // stub implementation - } - - /** * Provision the device with a satellite provider. * This is needed if the provider allows dynamic registration. * Once provisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report true. * * @param token The token to be used as a unique identifier for provisioning with satellite * gateway. + * @param regionId The region ID for the device's current location. * @param errorCallback The callback to receive the error code result of the operation. * * Valid error codes returned: @@ -446,7 +417,7 @@ public class SatelliteImplBase extends SatelliteService { * SatelliteError:REQUEST_ABORTED * SatelliteError:NETWORK_TIMEOUT */ - public void provisionSatelliteService(@NonNull String token, + public void provisionSatelliteService(@NonNull String token, @NonNull String regionId, @NonNull IIntegerConsumer errorCallback) { // stub implementation } @@ -530,7 +501,6 @@ public class SatelliteImplBase extends SatelliteService { * Send datagram over satellite. * * @param datagram Datagram to send in byte format. - * @param isDemoMode Whether demo mode is enabled. * @param isEmergency Whether this is an emergency datagram. * @param errorCallback The callback to receive the error code result of the operation. * @@ -550,8 +520,8 @@ public class SatelliteImplBase extends SatelliteService { * SatelliteError:SATELLITE_NOT_REACHABLE * SatelliteError:NOT_AUTHORIZED */ - public void sendSatelliteDatagram(@NonNull SatelliteDatagram datagram, boolean isDemoMode, - boolean isEmergency, @NonNull IIntegerConsumer errorCallback) { + public void sendSatelliteDatagram(@NonNull SatelliteDatagram datagram, boolean isEmergency, + @NonNull IIntegerConsumer errorCallback) { // stub implementation } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 323fa6faaf09..d0de3acdf257 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -68,7 +68,7 @@ import android.telephony.ims.aidl.IImsRegistration; import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.aidl.IRcsConfigCallback; import android.telephony.satellite.ISatelliteDatagramCallback; -import android.telephony.satellite.ISatellitePositionUpdateCallback; +import android.telephony.satellite.ISatelliteTransmissionUpdateCallback; import android.telephony.satellite.ISatelliteProvisionStateCallback; import android.telephony.satellite.ISatelliteStateCallback; import android.telephony.satellite.SatelliteCapabilities; @@ -2726,11 +2726,13 @@ interface ITelephony { * * @param subId The subId of the subscription to enable or disable the satellite modem for. * @param enable True to enable the satellite modem and false to disable. - * @param callback The callback to get the error code of the request. + * @param isDemoModeEnabled True if demo mode is enabled and false otherwise. + * @param callback The callback to get the result of the request. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - void requestSatelliteEnabled(int subId, boolean enable, in IIntegerConsumer callback); + void requestSatelliteEnabled(int subId, boolean enable, boolean isDemoModeEnabled, + in IIntegerConsumer callback); /** * Request to get whether the satellite modem is enabled. @@ -2744,17 +2746,6 @@ interface ITelephony { void requestIsSatelliteEnabled(int subId, in ResultReceiver receiver); /** - * Request to enable or disable the satellite service demo mode. - * - * @param subId The subId of the subscription to enable or disable the satellite demo mode for. - * @param enable True to enable the satellite demo mode and false to disable. - * @param callback The callback to get the error code of the request. - */ - @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" - + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - void requestSatelliteDemoModeEnabled(int subId, boolean enable, in IIntegerConsumer callback); - - /** * Request to get whether the satellite service demo mode is enabled. * * @param subId The subId of the subscription to request whether the satellite demo mode is @@ -2764,7 +2755,7 @@ interface ITelephony { */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - void requestIsSatelliteDemoModeEnabled(int subId, in ResultReceiver receiver); + void requestIsDemoModeEnabled(int subId, in ResultReceiver receiver); /** * Request to get whether the satellite service is supported on the device. @@ -2787,39 +2778,28 @@ interface ITelephony { void requestSatelliteCapabilities(int subId, in ResultReceiver receiver); /** - * Start receiving satellite pointing updates. + * Start receiving satellite transmission updates. * - * @param subId The subId of the subscription to stop satellite position updates for. - * @param errorCallback The callback to get the error code of the request. - * @param callback The callback to handle position updates. + * @param subId The subId of the subscription to stop satellite transmission updates for. + * @param resultCallback The callback to get the result of the request. + * @param callback The callback to handle transmission updates. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - void startSatellitePositionUpdates(int subId, in IIntegerConsumer errorCallback, - in ISatellitePositionUpdateCallback callback); + void startSatelliteTransmissionUpdates(int subId, in IIntegerConsumer resultCallback, + in ISatelliteTransmissionUpdateCallback callback); /** - * Stop receiving satellite pointing updates. + * Stop receiving satellite transmission updates. * - * @param subId The subId of the subscritpion to stop satellite position updates for. - * @param errorCallback The callback to get the error code of the request. - * @param callback The callback that was passed to startSatellitePositionUpdates. - */ - @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" - + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - void stopSatellitePositionUpdates(int subId, in IIntegerConsumer errorCallback, - in ISatellitePositionUpdateCallback callback); - - /** - * Request to get the maximum number of bytes per datagram that can be sent to satellite. - * - * @param subId The subId of the subscription to get the maximum number of characters for. - * @param receiver Result receiver to get the error code of the request and the requested - * maximum number of bytes per datagram that can be sent to satellite. + * @param subId The subId of the subscritpion to stop satellite transmission updates for. + * @param resultCallback The callback to get the result of the request. + * @param callback The callback that was passed to startSatelliteTransmissionUpdates. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - void requestMaxSizePerSendingDatagram(int subId, in ResultReceiver receiver); + void stopSatelliteTransmissionUpdates(int subId, in IIntegerConsumer resultCallback, + in ISatelliteTransmissionUpdateCallback callback); /** * Register the subscription with a satellite provider. @@ -2828,13 +2808,14 @@ interface ITelephony { * @param subId The subId of the 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. + * @param regionId The region ID for the device's current location. + * @param callback The callback to get the result of the request. * * @return The signal transport used by callers to cancel the provision request. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - ICancellationSignal provisionSatelliteService(int subId, in String token, + ICancellationSignal provisionSatelliteService(int subId, in String token, in String regionId, in IIntegerConsumer callback); /** @@ -2846,7 +2827,7 @@ interface ITelephony { * * @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. + * @param callback The callback to get the result of the request. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") @@ -2916,15 +2897,13 @@ interface ITelephony { * Register to receive incoming datagrams over satellite. * * @param subId The subId of the subscription to register for incoming satellite datagrams. - * @param datagramType Type of datagram. * @param callback The callback to handle the incoming datagrams. * * @return The {@link SatelliteError} result of the operation. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") - int registerForSatelliteDatagram( - int subId, int datagramType, ISatelliteDatagramCallback callback); + int registerForSatelliteDatagram(int subId, ISatelliteDatagramCallback callback); /** * Unregister to stop receiving incoming datagrams over satellite. @@ -2941,7 +2920,7 @@ interface ITelephony { * Poll pending satellite datagrams over satellite. * * @param subId The subId of the subscription used for receiving datagrams. - * @param callback The callback to get the error code of the request. + * @param callback The callback to get the result of the request. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") @@ -2955,7 +2934,7 @@ interface ITelephony { * @param datagram Datagram to send over satellite. * @param needFullScreenPointingUI this is used to indicate pointingUI app to open in * full screen mode. - * @param callback The callback to get the error code of the request. + * @param callback The callback to get the result of the request. */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + "android.Manifest.permission.SATELLITE_COMMUNICATION)") |