Merge "Update API surface to handle satellite service indications" into udc-dev

This commit is contained in:
Sarah Chin
2023-02-21 23:16:22 +00:00
committed by Android (Google) Code Review
16 changed files with 348 additions and 184 deletions

View File

@@ -25,10 +25,10 @@ import android.telephony.satellite.SatelliteDatagram;
*/
oneway interface ISatelliteDatagramCallback {
/**
* Called when datagrams are received from satellite.
* Called when there is an incoming datagram to be received from satellite.
*
* @param datagramId An id that uniquely identifies incoming datagram.
* @param datagram datagram received from satellite.
* @param datagram Datagram received from satellite.
* @param pendingCount Number of datagrams yet to be received from satellite.
* @param callback This callback will be used by datagram receiver app to send ack back to
* Telephony. If the callback is not received within five minutes,

View File

@@ -24,20 +24,20 @@ import android.telephony.satellite.PointingInfo;
*/
oneway interface ISatellitePositionUpdateCallback {
/**
* Called when satellite datagram transfer state changes.
* 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 onDatagramTransferStateUpdate(in int state, in int sendPendingCount,
void onDatagramTransferStateChanged(in int state, in int sendPendingCount,
in int receivePendingCount, in int errorCode);
/**
* Called when the satellite position changes.
* Called when the satellite position changed.
*
* @param pointingInfo The pointing info containing the satellite location.
*/
void onSatellitePositionUpdate(in PointingInfo pointingInfo);
void onSatellitePositionChanged(in PointingInfo pointingInfo);
}

View File

@@ -33,5 +33,5 @@ oneway interface ISatelliteStateCallback {
*
* @param state The current satellite modem state.
*/
void onSatelliteModemStateChange(in int state);
void onSatelliteModemStateChanged(in int state);
}

View File

@@ -48,10 +48,10 @@ public final class PointingInfo implements Parcelable {
/**
* @hide
*/
public PointingInfo(float satelliteAzimuthDegress, float satelliteElevationDegress,
public PointingInfo(float satelliteAzimuthDegrees, float satelliteElevationDegrees,
float antennaAzimuthDegrees, float antennaPitchDegrees, float antennaRollDegrees) {
mSatelliteAzimuthDegrees = satelliteAzimuthDegress;
mSatelliteElevationDegrees = satelliteElevationDegress;
mSatelliteAzimuthDegrees = satelliteAzimuthDegrees;
mSatelliteElevationDegrees = satelliteElevationDegrees;
mAntennaAzimuthDegrees = antennaAzimuthDegrees;
mAntennaPitchDegrees = antennaPitchDegrees;
mAntennaRollDegrees = antennaRollDegrees;

View File

@@ -30,7 +30,7 @@ public final class SatelliteCapabilities implements Parcelable {
/**
* List of technologies supported by the satellite modem.
*/
private Set<Integer> mSupportedRadioTechnologies;
@NonNull @SatelliteManager.NTRadioTechnology private Set<Integer> mSupportedRadioTechnologies;
/**
* Whether satellite modem is always on.
@@ -53,7 +53,8 @@ public final class SatelliteCapabilities implements Parcelable {
*/
public SatelliteCapabilities(Set<Integer> supportedRadioTechnologies, boolean isAlwaysOn,
boolean needsPointingToSatellite, boolean needsSeparateSimProfile) {
mSupportedRadioTechnologies = supportedRadioTechnologies;
mSupportedRadioTechnologies = supportedRadioTechnologies == null
? new HashSet<>() : supportedRadioTechnologies;
mIsAlwaysOn = isAlwaysOn;
mNeedsPointingToSatellite = needsPointingToSatellite;
mNeedsSeparateSimProfile = needsSeparateSimProfile;
@@ -126,7 +127,8 @@ public final class SatelliteCapabilities implements Parcelable {
/**
* @return The list of technologies supported by the satellite modem.
*/
@NonNull public Set<Integer> getSupportedRadioTechnologies() {
@NonNull @SatelliteManager.NTRadioTechnology public Set<Integer>
getSupportedRadioTechnologies() {
return mSupportedRadioTechnologies;
}

View File

@@ -55,9 +55,9 @@ public class SatelliteDatagramCallback {
}
/**
* Called when there are incoming datagrams to be received.
* 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 datagram Datagram to be received over satellite.
* @param pendingCount Number of datagrams yet to be received by the app.
* @param callback This callback will be used by datagram receiver app to send ack back to
* Telephony.
@@ -67,13 +67,13 @@ public class SatelliteDatagramCallback {
// Base Implementation
}
/**@hide*/
/** @hide */
@NonNull
public final ISatelliteDatagramCallback getBinder() {
return mBinder;
}
/**@hide*/
/** @hide */
public void setExecutor(@NonNull Executor executor) {
mBinder.setExecutor(executor);
}

View File

@@ -114,6 +114,13 @@ public class SatelliteManager {
*/
public static final String KEY_SATELLITE_ENABLED = "satellite_enabled";
/**
* Bundle key to get the response from
* {@link #requestIsSatelliteDemoModeEnabled(Executor, OutcomeReceiver)}.
* @hide
*/
public static final String KEY_DEMO_MODE_ENABLED = "demo_mode_enabled";
/**
* Bundle key to get the response from
* {@link #requestIsSatelliteSupported(Executor, OutcomeReceiver)}.
@@ -283,6 +290,39 @@ public class SatelliteManager {
@Retention(RetentionPolicy.SOURCE)
public @interface SatelliteError {}
/**
* 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology.
*/
public static final int NT_RADIO_TECHNOLOGY_NB_IOT_NTN = 0;
/**
* 3GPP 5G NR over Non-Terrestrial-Networks technology.
*/
public static final int NT_RADIO_TECHNOLOGY_NR_NTN = 1;
/**
* 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology.
*/
public static final int NT_RADIO_TECHNOLOGY_EMTC_NTN = 2;
/**
* Proprietary technology.
*/
public static final int NT_RADIO_TECHNOLOGY_PROPRIETARY = 3;
/**
* Unknown Non-Terrestrial radio technology. This generic radio technology should be used
* only when the radio technology cannot be mapped to other specific radio technologies.
*/
public static final int NT_RADIO_TECHNOLOGY_UNKNOWN = -1;
/** @hide */
@IntDef(prefix = "NT_RADIO_TECHNOLOGY_", value = {
NT_RADIO_TECHNOLOGY_NB_IOT_NTN,
NT_RADIO_TECHNOLOGY_NR_NTN,
NT_RADIO_TECHNOLOGY_EMTC_NTN,
NT_RADIO_TECHNOLOGY_PROPRIETARY,
NT_RADIO_TECHNOLOGY_UNKNOWN
})
@Retention(RetentionPolicy.SOURCE)
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
@@ -376,6 +416,97 @@ 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.
* If the request is not successful, {@link OutcomeReceiver#onError(Throwable)}
* will return a {@link SatelliteException} with the {@link SatelliteError}.
*
* @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 requestIsSatelliteDemoModeEnabled(@NonNull @CallbackExecutor Executor executor,
@NonNull OutcomeReceiver<Boolean, SatelliteException> callback) {
Objects.requireNonNull(executor);
Objects.requireNonNull(callback);
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
ResultReceiver receiver = new ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == SATELLITE_ERROR_NONE) {
if (resultData.containsKey(KEY_DEMO_MODE_ENABLED)) {
boolean isDemoModeEnabled =
resultData.getBoolean(KEY_DEMO_MODE_ENABLED);
executor.execute(() -> Binder.withCleanCallingIdentity(() ->
callback.onResult(isDemoModeEnabled)));
} else {
loge("KEY_DEMO_MODE_ENABLED does not exist.");
executor.execute(() -> Binder.withCleanCallingIdentity(() ->
callback.onError(
new SatelliteException(SATELLITE_REQUEST_FAILED))));
}
} else {
executor.execute(() -> Binder.withCleanCallingIdentity(() ->
callback.onError(new SatelliteException(resultCode))));
}
}
};
telephony.requestIsSatelliteDemoModeEnabled(mSubId, receiver);
} else {
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException ex) {
loge("requestIsSatelliteDemoModeEnabled() RemoteException: " + ex);
ex.rethrowFromSystemServer();
}
}
/**
* Request to get whether the satellite service is supported on the device.
*
@@ -513,6 +644,12 @@ public class SatelliteManager {
* must be sent before reporting any additional datagram transfer state changes.
*/
public static final int SATELLITE_DATAGRAM_TRANSFER_STATE_FAILED = 5;
/**
* The datagram transfer state is unknown. This generic datagram transfer state should be used
* only when the datagram transfer state cannot be mapped to other specific datagram transfer
* states.
*/
public static final int SATELLITE_DATAGRAM_TRANSFER_STATE_UNKNOWN = -1;
/** @hide */
@IntDef(prefix = {"SATELLITE_DATAGRAM_TRANSFER_STATE_"}, value = {
@@ -521,46 +658,70 @@ public class SatelliteManager {
SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVING,
SATELLITE_DATAGRAM_TRANSFER_STATE_RETRYING,
SATELLITE_DATAGRAM_TRANSFER_STATE_SUCCESS,
SATELLITE_DATAGRAM_TRANSFER_STATE_FAILED
SATELLITE_DATAGRAM_TRANSFER_STATE_FAILED,
SATELLITE_DATAGRAM_TRANSFER_STATE_UNKNOWN
})
@Retention(RetentionPolicy.SOURCE)
public @interface SatelliteDatagramTransferState {}
/* Satellite modem is in idle state. */
/**
* Satellite modem is in idle state.
*/
public static final int SATELLITE_MODEM_STATE_IDLE = 0;
/* Satellite modem is listening for incoming datagrams. */
/**
* Satellite modem is listening for incoming datagrams.
*/
public static final int SATELLITE_MODEM_STATE_LISTENING = 1;
/* Satellite modem is sending and/or receiving datagrams. */
/**
* Satellite modem is sending and/or receiving datagrams.
*/
public static final int SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING = 2;
/* Satellite modem is powered off. */
public static final int SATELLITE_MODEM_STATE_OFF = 3;
/**
* Satellite modem is retrying to send and/or receive datagrams.
*/
public static final int SATELLITE_MODEM_STATE_DATAGRAM_RETRYING = 3;
/**
* Satellite modem is powered off.
*/
public static final int SATELLITE_MODEM_STATE_OFF = 4;
/**
* Satellite modem state is unknown. This generic modem state should be used only when the
* modem state cannot be mapped to other specific modem states.
*/
public static final int SATELLITE_MODEM_STATE_UNKNOWN = -1;
/** @hide */
@IntDef(prefix = {"SATELLITE_STATE_"},
value = {
SATELLITE_MODEM_STATE_IDLE,
SATELLITE_MODEM_STATE_LISTENING,
SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING,
SATELLITE_MODEM_STATE_OFF
})
@IntDef(prefix = {"SATELLITE_MODEM_STATE_"}, value = {
SATELLITE_MODEM_STATE_IDLE,
SATELLITE_MODEM_STATE_LISTENING,
SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING,
SATELLITE_MODEM_STATE_DATAGRAM_RETRYING,
SATELLITE_MODEM_STATE_OFF,
SATELLITE_MODEM_STATE_UNKNOWN
})
@Retention(RetentionPolicy.SOURCE)
public @interface SatelliteModemState {}
/** Datagram type indicating that the datagram to be sent or received is of type SOS message. */
/**
* Datagram type indicating that the datagram to be sent or received is of type SOS message.
*/
public static final int DATAGRAM_TYPE_SOS_MESSAGE = 0;
/**
* Datagram type indicating that the datagram to be sent or received is of type
* location sharing.
*/
public static final int DATAGRAM_TYPE_LOCATION_SHARING = 1;
/**
* Datagram type is unknown. This generic datagram type should be used only when the
* datagram type cannot be mapped to other specific datagram types.
*/
public static final int DATAGRAM_TYPE_UNKNOWN = -1;
/** Datagram type indicating that the datagram to be sent or received is of type
* location sharing. */
public static final int DATAGRAM_TYPE_LOCATION_SHARING = 3;
@IntDef(
prefix = "DATAGRAM_TYPE_",
value = {
DATAGRAM_TYPE_SOS_MESSAGE,
DATAGRAM_TYPE_LOCATION_SHARING,
})
@IntDef(prefix = "DATAGRAM_TYPE_", value = {
DATAGRAM_TYPE_SOS_MESSAGE,
DATAGRAM_TYPE_LOCATION_SHARING,
DATAGRAM_TYPE_UNKNOWN
})
@Retention(RetentionPolicy.SOURCE)
public @interface DatagramType {}
@@ -802,7 +963,7 @@ public class SatelliteManager {
}
/**
* Register for the satellite provision state change.
* Registers for the satellite provision state changed.
*
* @param executor The executor on which the callback will be called.
* @param callback The callback to handle the satellite provision state changed event.
@@ -836,7 +997,7 @@ public class SatelliteManager {
}
/**
* Unregister for the satellite provision state change.
* Unregisters for the satellite provision state changed.
* If callback was not registered before, the request will be ignored.
*
* @param callback The callback that was passed to
@@ -918,10 +1079,10 @@ public class SatelliteManager {
}
/**
* Register for listening to satellite modem state changes.
* Registers for modem state changed from satellite modem.
*
* @param executor The executor on which the callback will be called.
* @param callback The callback to handle the satellite modem state change event.
* @param callback The callback to handle the satellite modem state changed event.
*
* @return The {@link SatelliteError} result of the operation.
*
@@ -929,7 +1090,7 @@ public class SatelliteManager {
* @throws IllegalStateException if the Telephony process is not currently available.
*/
@RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
@SatelliteError public int registerForSatelliteModemStateChange(
@SatelliteError public int registerForSatelliteModemStateChanged(
@NonNull @CallbackExecutor Executor executor,
@NonNull SatelliteStateCallback callback) {
Objects.requireNonNull(executor);
@@ -939,41 +1100,41 @@ public class SatelliteManager {
ITelephony telephony = getITelephony();
if (telephony != null) {
callback.setExecutor(executor);
return telephony.registerForSatelliteModemStateChange(mSubId,
return telephony.registerForSatelliteModemStateChanged(mSubId,
callback.getBinder());
} else {
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException ex) {
loge("registerForSatelliteModemStateChange() RemoteException:" + ex);
loge("registerForSatelliteModemStateChanged() RemoteException:" + ex);
ex.rethrowFromSystemServer();
}
return SATELLITE_REQUEST_FAILED;
}
/**
* Unregister to stop listening to satellite modem state changes.
* Unregisters for modem state changed from satellite modem.
* If callback was not registered before, the request will be ignored.
*
* @param callback The callback that was passed to
* {@link #registerForSatelliteModemStateChange(Executor, SatelliteStateCallback)}.
* {@link #registerForSatelliteModemStateChanged(Executor, SatelliteStateCallback)}.
*
* @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 unregisterForSatelliteModemStateChange(@NonNull SatelliteStateCallback callback) {
public void unregisterForSatelliteModemStateChanged(@NonNull SatelliteStateCallback callback) {
Objects.requireNonNull(callback);
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
telephony.unregisterForSatelliteModemStateChange(mSubId, callback.getBinder());
telephony.unregisterForSatelliteModemStateChanged(mSubId, callback.getBinder());
} else {
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException ex) {
loge("unregisterForSatelliteModemStateChange() RemoteException:" + ex);
loge("unregisterForSatelliteModemStateChanged() RemoteException:" + ex);
ex.rethrowFromSystemServer();
}
}

View File

@@ -39,24 +39,24 @@ public class SatellitePositionUpdateCallback {
}
@Override
public void onSatellitePositionUpdate(@NonNull PointingInfo pointingInfo) {
public void onSatellitePositionChanged(@NonNull PointingInfo pointingInfo) {
final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() ->
mLocalCallback.onSatellitePositionUpdate(pointingInfo));
mLocalCallback.onSatellitePositionChanged(pointingInfo));
} finally {
restoreCallingIdentity(callingIdentity);
}
}
@Override
public void onDatagramTransferStateUpdate(
public void onDatagramTransferStateChanged(
@SatelliteManager.SatelliteDatagramTransferState int state, int sendPendingCount,
int receivePendingCount, @SatelliteManager.SatelliteError int errorCode) {
final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() ->
mLocalCallback.onDatagramTransferStateUpdate(
mLocalCallback.onDatagramTransferStateChanged(
state, sendPendingCount, receivePendingCount, errorCode));
} finally {
restoreCallingIdentity(callingIdentity);
@@ -69,23 +69,23 @@ public class SatellitePositionUpdateCallback {
}
/**
* Called when the satellite position changes.
* Called when the satellite position changed.
*
* @param pointingInfo The pointing info containing the satellite location.
*/
public void onSatellitePositionUpdate(@NonNull PointingInfo pointingInfo) {
public void onSatellitePositionChanged(@NonNull PointingInfo pointingInfo) {
// Base Implementation
}
/**
* Called when satellite datagram transfer state changes.
* 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 onDatagramTransferStateUpdate(
public void onDatagramTransferStateChanged(
@SatelliteManager.SatelliteDatagramTransferState int state, int sendPendingCount,
int receivePendingCount, @SatelliteManager.SatelliteError int errorCode) {
// Base Implementation

View File

@@ -38,11 +38,11 @@ public class SatelliteStateCallback {
}
@Override
public void onSatelliteModemStateChange(@SatelliteManager.SatelliteModemState int state) {
public void onSatelliteModemStateChanged(@SatelliteManager.SatelliteModemState int state) {
final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() ->
mLocalCallback.onSatelliteModemStateChange(state));
mLocalCallback.onSatelliteModemStateChanged(state));
} finally {
restoreCallingIdentity(callingIdentity);
}
@@ -68,7 +68,7 @@ public class SatelliteStateCallback {
* Called when satellite modem state changes.
* @param state The new satellite modem state.
*/
public void onSatelliteModemStateChange(@SatelliteManager.SatelliteModemState int state) {
public void onSatelliteModemStateChanged(@SatelliteManager.SatelliteModemState int state) {
// Base Implementation
}

View File

@@ -46,10 +46,11 @@ oneway interface ISatellite {
void setSatelliteListener(in ISatelliteListener listener, in IIntegerConsumer errorCallback);
/**
* Enable or disable the satellite service listening mode.
* Request to enable or disable the satellite service listening mode.
* 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 errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
@@ -62,7 +63,8 @@ oneway interface ISatellite {
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void setSatelliteListeningEnabled(in boolean enable, in IIntegerConsumer errorCallback);
void requestSatelliteListeningEnabled(in boolean enable, in boolean isDemoMode,
in IIntegerConsumer errorCallback);
/**
* Request to enable or disable the satellite modem. If the satellite modem is enabled,
@@ -149,7 +151,7 @@ oneway interface ISatellite {
/**
* User started pointing to the satellite.
* The satellite service should report the satellite pointing info via
* ISatelliteListener#onSatellitePointingInfoChanged as the user device/satellite moves.
* ISatelliteListener#onSatellitePositionChanged as the user device/satellite moves.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
@@ -275,7 +277,7 @@ oneway interface ISatellite {
/**
* Poll the pending datagrams to be received over satellite.
* The satellite service should check if there are any pending datagrams to be received over
* satellitea and report them via ISatelliteListener#onNewDatagrams.
* satellite and report them via ISatelliteListener#onSatelliteDatagramsReceived.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
@@ -298,10 +300,9 @@ oneway interface ISatellite {
/**
* Send datagram over satellite.
* Once sent, the satellite service should report whether the operation was successful via
* SatelliteListener#onDatagramsDelivered.
*
* @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.
*
@@ -321,8 +322,8 @@ oneway interface ISatellite {
* SatelliteError:SATELLITE_NOT_REACHABLE
* SatelliteError:NOT_AUTHORIZED
*/
void sendSatelliteDatagram(in SatelliteDatagram datagram, in boolean isEmergency,
in IIntegerConsumer errorCallback);
void sendSatelliteDatagram(in SatelliteDatagram datagram, in boolean isDemoMode,
in boolean isEmergency, in IIntegerConsumer errorCallback);
/**
* Request the current satellite modem state.

View File

@@ -19,6 +19,7 @@ package android.telephony.satellite.stub;
import android.telephony.satellite.stub.NTRadioTechnology;
import android.telephony.satellite.stub.PointingInfo;
import android.telephony.satellite.stub.SatelliteDatagram;
import android.telephony.satellite.stub.SatelliteError;
import android.telephony.satellite.stub.SatelliteModemState;
/**
@@ -35,10 +36,10 @@ oneway interface ISatelliteListener {
/**
* Indicates that new datagrams have been received on the device.
*
* @param datagrams New datagrams received.
* @param datagrams Array of new datagrams received.
* @param pendingCount The number of datagrams that are pending.
*/
void onNewDatagrams(in SatelliteDatagram[] datagrams, in int pendingCount);
void onSatelliteDatagramsReceived(in SatelliteDatagram[] datagrams, in int pendingCount);
/**
* Indicates that the satellite has pending datagrams for the device to be pulled.
@@ -52,27 +53,19 @@ oneway interface ISatelliteListener {
*
* @param pointingInfo The current pointing info.
*/
void onSatellitePointingInfoChanged(in PointingInfo pointingInfo);
void onSatellitePositionChanged(in PointingInfo pointingInfo);
/**
* Indicates that the satellite modem state has changed.
*
* @param mode The current satellite modem state.
* @param state The current satellite modem state.
*/
void onSatelliteModemStateChanged(in SatelliteModemState mode);
void onSatelliteModemStateChanged(in SatelliteModemState state);
/**
* Indicates that the satellite radio technology has changed.
*
* @param technology The current satellite service mode.
* @param technology The current satellite radio technology.
*/
void onSatelliteRadioTechnologyChanged(in NTRadioTechnology technology);
/**
* Indicates that datagram transfer is complete and all datagrams have been delivered.
*
* @param delivered True means all datagrams have been delivered and false means there was an
* error in delivering all datagrams.
*/
void onDatagramsDelivered(in boolean delivered);
}

View File

@@ -21,12 +21,25 @@ package android.telephony.satellite.stub;
*/
@Backing(type="int")
enum NTRadioTechnology {
/* 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology. */
NB_IOT_NTN,
/* 3GPP 5G NR over Non-Terrestrial-Networks technology. */
NR_NTN,
/* 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology. */
EMTC_NTN,
/* Proprietary technology. */
PROPRIETARY,
/**
* 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology.
*/
NB_IOT_NTN = 0,
/*
* 3GPP 5G NR over Non-Terrestrial-Networks technology.
*/
NR_NTN = 1,
/**
* 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology.
*/
EMTC_NTN = 2,
/**
* Proprietary technology.
*/
PROPRIETARY = 3,
/**
* Unknown Non-Terrestrial radio technology. This generic radio technology should be used
* only when the radio technology cannot be mapped to other specific radio technologies.
*/
UNKNOWN = -1,
}

View File

@@ -30,18 +30,20 @@ parcelable PointingInfo {
*/
float satelliteElevation;
/** Antenna azimuth in degrees */
float mAntennaAzimuthDegrees;
/**
* 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 mAntennaPitchDegrees;
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 mAntennaRollDegrees;
float antennaRoll;
}

View File

@@ -16,7 +16,6 @@
package android.telephony.satellite.stub;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.IBinder;
import android.os.RemoteException;
@@ -26,8 +25,6 @@ import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.util.TelephonyUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
@@ -42,53 +39,6 @@ import java.util.concurrent.Executor;
public class SatelliteImplBase extends SatelliteService {
private static final String TAG = "SatelliteImplBase";
/** @hide */
@IntDef(prefix = "NT_RADIO_TECHNOLOGY_", value = {
NT_RADIO_TECHNOLOGY_NB_IOT_NTN,
NT_RADIO_TECHNOLOGY_NR_NTN,
NT_RADIO_TECHNOLOGY_EMTC_NTN,
NT_RADIO_TECHNOLOGY_PROPRIETARY
})
@Retention(RetentionPolicy.SOURCE)
public @interface NTRadioTechnology {}
/** 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology. */
public static final int NT_RADIO_TECHNOLOGY_NB_IOT_NTN =
android.telephony.satellite.stub.NTRadioTechnology.NB_IOT_NTN;
/** 3GPP 5G NR over Non-Terrestrial-Networks technology. */
public static final int NT_RADIO_TECHNOLOGY_NR_NTN =
android.telephony.satellite.stub.NTRadioTechnology.NR_NTN;
/** 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology. */
public static final int NT_RADIO_TECHNOLOGY_EMTC_NTN =
android.telephony.satellite.stub.NTRadioTechnology.EMTC_NTN;
/** Proprietary technology. */
public static final int NT_RADIO_TECHNOLOGY_PROPRIETARY =
android.telephony.satellite.stub.NTRadioTechnology.PROPRIETARY;
/** @hide */
@IntDef(prefix = "SATELLITE_MODEM_STATE_", value = {
SATELLITE_MODEM_STATE_IDLE,
SATELLITE_MODEM_STATE_LISTENING,
SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING,
SATELLITE_MODEM_STATE_OFF
})
@Retention(RetentionPolicy.SOURCE)
public @interface SatelliteModemState {}
/** Satellite modem is in idle state. */
public static final int SATELLITE_MODEM_STATE_IDLE =
android.telephony.satellite.stub.SatelliteModemState.SATELLITE_MODEM_STATE_IDLE;
/** Satellite modem is listening for incoming messages. */
public static final int SATELLITE_MODEM_STATE_LISTENING =
android.telephony.satellite.stub.SatelliteModemState.SATELLITE_MODEM_STATE_LISTENING;
/** Satellite modem is sending and/or receiving messages. */
public static final int SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING =
android.telephony.satellite.stub.SatelliteModemState
.SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING;
/** Satellite modem is powered off. */
public static final int SATELLITE_MODEM_STATE_OFF =
android.telephony.satellite.stub.SatelliteModemState.SATELLITE_MODEM_STATE_OFF;
protected final Executor mExecutor;
/**
@@ -121,12 +71,12 @@ public class SatelliteImplBase extends SatelliteService {
}
@Override
public void setSatelliteListeningEnabled(boolean enable, IIntegerConsumer errorCallback)
throws RemoteException {
public void requestSatelliteListeningEnabled(boolean enable, boolean isDemoMode,
IIntegerConsumer errorCallback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.setSatelliteListeningEnabled(enable, errorCallback),
"setSatelliteListeningEnabled");
.requestSatelliteListeningEnabled(enable, isDemoMode, errorCallback),
"requestSatelliteListeningEnabled");
}
@Override
@@ -223,11 +173,12 @@ public class SatelliteImplBase extends SatelliteService {
}
@Override
public void sendSatelliteDatagram(SatelliteDatagram datagram, boolean isEmergency,
IIntegerConsumer errorCallback) throws RemoteException {
public void sendSatelliteDatagram(SatelliteDatagram datagram, boolean isDemoMode,
boolean isEmergency, IIntegerConsumer errorCallback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.sendSatelliteDatagram(datagram, isEmergency, errorCallback),
.sendSatelliteDatagram(
datagram, isDemoMode, isEmergency, errorCallback),
"sendSatelliteDatagram");
}
@@ -296,10 +247,11 @@ public class SatelliteImplBase extends SatelliteService {
}
/**
* Enable or disable the satellite service listening mode.
* Request to enable or disable the satellite service listening mode.
* 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 errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
@@ -312,7 +264,7 @@ public class SatelliteImplBase extends SatelliteService {
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void setSatelliteListeningEnabled(boolean enable,
public void requestSatelliteListeningEnabled(boolean enable, boolean isDemoMode,
@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
@@ -411,7 +363,7 @@ public class SatelliteImplBase extends SatelliteService {
/**
* User started pointing to the satellite.
* The satellite service should report the satellite pointing info via
* ISatelliteListener#onSatellitePointingInfoChanged as the user device/satellite moves.
* ISatelliteListener#onSatellitePositionChanged as the user device/satellite moves.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
@@ -549,8 +501,9 @@ public class SatelliteImplBase extends SatelliteService {
}
/**
* Poll the pending datagrams.
* The satellite service should report the new datagrams via ISatelliteListener#onNewDatagrams.
* Poll the pending datagrams to be received over satellite.
* 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.
*
@@ -575,10 +528,9 @@ public class SatelliteImplBase extends SatelliteService {
/**
* Send datagram over satellite.
* Once sent, the satellite service should report whether the operation was successful via
* SatelliteListener#onDatagramsDelivered.
*
* @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.
*
@@ -598,8 +550,8 @@ public class SatelliteImplBase extends SatelliteService {
* SatelliteError:SATELLITE_NOT_REACHABLE
* SatelliteError:NOT_AUTHORIZED
*/
public void sendSatelliteDatagram(@NonNull SatelliteDatagram datagram, boolean isEmergency,
@NonNull IIntegerConsumer errorCallback) {
public void sendSatelliteDatagram(@NonNull SatelliteDatagram datagram, boolean isDemoMode,
boolean isEmergency, @NonNull IIntegerConsumer errorCallback) {
// stub implementation
}

View File

@@ -21,12 +21,29 @@ package android.telephony.satellite.stub;
*/
@Backing(type="int")
enum SatelliteModemState {
/* Satellite modem is in idle state. */
/**
* Satellite modem is in idle state.
*/
SATELLITE_MODEM_STATE_IDLE = 0,
/* Satellite modem is listening for incoming messages. */
/**
* Satellite modem is listening for incoming datagrams.
*/
SATELLITE_MODEM_STATE_LISTENING = 1,
/* Satellite modem is sending and/or receiving messages. */
SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING = 2,
/* Satellite modem is powered off. */
SATELLITE_MODEM_STATE_OFF = 3,
/**
* Satellite modem is sending and/or receiving datagrams.
*/
SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING = 2,
/**
* Satellite modem is retrying to send and/or receive datagrams.
*/
SATELLITE_MODEM_STATE_DATAGRAM_RETRYING = 3,
/**
* Satellite modem is powered off.
*/
SATELLITE_MODEM_STATE_OFF = 4,
/**
* Satellite modem state is unknown. This generic modem state should be used only when the
* modem state cannot be mapped to other specific modem states.
*/
SATELLITE_MODEM_STATE_UNKNOWN = -1,
}

View File

@@ -2727,6 +2727,29 @@ interface ITelephony {
+ "android.Manifest.permission.SATELLITE_COMMUNICATION)")
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
* enabled for.
* @param receiver Result receiver to get the error code of the request and whether the
* satellite demo mode is enabled.
*/
@JavaPassthrough(annotation="@android.annotation.RequiresPermission("
+ "android.Manifest.permission.SATELLITE_COMMUNICATION)")
void requestIsSatelliteDemoModeEnabled(int subId, in ResultReceiver receiver);
/**
* Request to get whether the satellite service is supported on the device.
*
@@ -2815,9 +2838,9 @@ interface ITelephony {
/**
* Register for the satellite provision state change.
* Registers for provision state changed from satellite modem.
*
* @param subId The subId of the subscription to register for provision state changes.
* @param subId The subId of the subscription to register for provision state changed.
* @param callback The callback to handle the satellite provision state changed event.
*
* @return The {@link SatelliteError} result of the operation.
@@ -2828,10 +2851,10 @@ interface ITelephony {
in ISatelliteProvisionStateCallback callback);
/**
* Unregister for the satellite provision state change.
* Unregisters for provision state changed from satellite modem.
* If callback was not registered before, the request will be ignored.
*
* @param subId The subId of the subscription to unregister for provision state changes.
* @param subId The subId of the subscription to unregister for provision state changed.
* @param callback The callback that was passed to registerForSatelliteProvisionStateChanged.
*/
@JavaPassthrough(annotation="@android.annotation.RequiresPermission("
@@ -2851,27 +2874,27 @@ interface ITelephony {
void requestIsSatelliteProvisioned(int subId, in ResultReceiver receiver);
/**
* Register for listening to satellite modem state changes.
* Registers for modem state changed from satellite modem.
*
* @param subId The subId of the subscription to register for satellite modem state changes.
* @param subId The subId of the subscription to register for satellite modem state changed.
* @param callback The callback to handle the satellite modem state changed event.
*
* @return The {@link SatelliteError} result of the operation.
*/
@JavaPassthrough(annotation="@android.annotation.RequiresPermission("
+ "android.Manifest.permission.SATELLITE_COMMUNICATION)")
int registerForSatelliteModemStateChange(int subId, ISatelliteStateCallback callback);
int registerForSatelliteModemStateChanged(int subId, ISatelliteStateCallback callback);
/**
* Unregister to stop listening to satellite modem state changes.
* Unregisters for modem state changed from satellite modem.
* If callback was not registered before, the request will be ignored.
*
* @param subId The subId of the subscription to unregister for satellite modem state changes.
* @param callback The callback that was passed to registerForSatelliteStateChange.
* @param subId The subId of the subscription to unregister for satellite modem state changed.
* @param callback The callback that was passed to registerForSatelliteStateChanged.
*/
@JavaPassthrough(annotation="@android.annotation.RequiresPermission("
+ "android.Manifest.permission.SATELLITE_COMMUNICATION)")
void unregisterForSatelliteModemStateChange(int subId, ISatelliteStateCallback callback);
void unregisterForSatelliteModemStateChanged(int subId, ISatelliteStateCallback callback);
/**
* Register to receive incoming datagrams over satellite.