Update satellite APIs from modem requirements

requestSatelliteListeningEnabled takes in an int timeout
onSatelliteDatagramsReceived only reports 1 datagram
setSatelliteListener remove Consumer<Integer> callback
add SATELLITE_MODEM_STATE_UNAVAILABLE

Test: atest SatelliteManagerTest
Bug: 270534472
Change-Id: I4ac3a9e8420bf97d6dec0ec8df4d810d1bcd7538
This commit is contained in:
Sarah Chin
2023-02-25 02:29:41 -08:00
parent bbf2ceda75
commit d96318ac9d
5 changed files with 27 additions and 17 deletions

View File

@@ -166,8 +166,8 @@ public class SatelliteManager {
public static final String KEY_SATELLITE_NEXT_VISIBILITY = "satellite_next_visibility";
/**
* Bundle key to get the respoonse from
* {@link #sendSatelliteDatagram(long, int, SatelliteDatagram, Executor, OutcomeReceiver)}.
* Bundle key to get the respoonse from {@link
* #sendSatelliteDatagram(long, int, SatelliteDatagram, boolean, Executor, OutcomeReceiver)}.
* @hide
*/
public static final String KEY_SEND_SATELLITE_DATAGRAM = "send_satellite_datagram";
@@ -684,6 +684,10 @@ public class SatelliteManager {
* Satellite modem is powered off.
*/
public static final int SATELLITE_MODEM_STATE_OFF = 4;
/**
* Satellite modem is unavailable.
*/
public static final int SATELLITE_MODEM_STATE_UNAVAILABLE = 5;
/**
* 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.
@@ -697,6 +701,7 @@ public class SatelliteManager {
SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING,
SATELLITE_MODEM_STATE_DATAGRAM_RETRYING,
SATELLITE_MODEM_STATE_OFF,
SATELLITE_MODEM_STATE_UNAVAILABLE,
SATELLITE_MODEM_STATE_UNKNOWN
})
@Retention(RetentionPolicy.SOURCE)

View File

@@ -31,7 +31,6 @@ oneway interface ISatellite {
* Register the callback interface with satellite service.
*
* @param listener The callback interface to handle satellite service indications.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
@@ -43,7 +42,7 @@ oneway interface ISatellite {
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void setSatelliteListener(in ISatelliteListener listener, in IIntegerConsumer errorCallback);
void setSatelliteListener(in ISatelliteListener listener);
/**
* Request to enable or disable the satellite service listening mode.
@@ -51,6 +50,8 @@ oneway interface ISatellite {
*
* @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.
*
* Valid error codes returned:
@@ -63,7 +64,7 @@ oneway interface ISatellite {
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestSatelliteListeningEnabled(in boolean enable, in boolean isDemoMode,
void requestSatelliteListeningEnabled(in boolean enable, in boolean isDemoMode, in int timeout,
in IIntegerConsumer errorCallback);
/**

View File

@@ -36,10 +36,10 @@ oneway interface ISatelliteListener {
/**
* Indicates that new datagrams have been received on the device.
*
* @param datagrams Array of new datagrams received.
* @param pendingCount The number of datagrams that are pending.
* @param datagram New datagram that was received.
* @param pendingCount Number of additional datagrams yet to be received.
*/
void onSatelliteDatagramsReceived(in SatelliteDatagram[] datagrams, in int pendingCount);
void onSatelliteDatagramReceived(in SatelliteDatagram datagram, in int pendingCount);
/**
* Indicates that the satellite has pending datagrams for the device to be pulled.

View File

@@ -63,19 +63,19 @@ public class SatelliteImplBase extends SatelliteService {
private final IBinder mBinder = new ISatellite.Stub() {
@Override
public void setSatelliteListener(ISatelliteListener listener,
IIntegerConsumer errorCallback) throws RemoteException {
public void setSatelliteListener(ISatelliteListener listener) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.setSatelliteListener(listener, errorCallback),
() -> SatelliteImplBase.this.setSatelliteListener(listener),
"setSatelliteListener");
}
@Override
public void requestSatelliteListeningEnabled(boolean enable, boolean isDemoMode,
IIntegerConsumer errorCallback) throws RemoteException {
int timeout, IIntegerConsumer errorCallback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestSatelliteListeningEnabled(enable, isDemoMode, errorCallback),
.requestSatelliteListeningEnabled(
enable, isDemoMode, timeout, errorCallback),
"requestSatelliteListeningEnabled");
}
@@ -229,7 +229,6 @@ public class SatelliteImplBase extends SatelliteService {
* Register the callback interface with satellite service.
*
* @param listener The callback interface to handle satellite service indications.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
@@ -241,8 +240,7 @@ public class SatelliteImplBase extends SatelliteService {
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void setSatelliteListener(@NonNull ISatelliteListener listener,
@NonNull IIntegerConsumer errorCallback) {
public void setSatelliteListener(@NonNull ISatelliteListener listener) {
// stub implementation
}
@@ -252,6 +250,8 @@ public class SatelliteImplBase extends SatelliteService {
*
* @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.
*
* Valid error codes returned:
@@ -264,7 +264,7 @@ public class SatelliteImplBase extends SatelliteService {
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestSatelliteListeningEnabled(boolean enable, boolean isDemoMode,
public void requestSatelliteListeningEnabled(boolean enable, boolean isDemoMode, int timeout,
@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}

View File

@@ -41,6 +41,10 @@ enum SatelliteModemState {
* Satellite modem is powered off.
*/
SATELLITE_MODEM_STATE_OFF = 4,
/**
* Satellite modem is unavailable.
*/
SATELLITE_MODEM_STATE_UNAVAILABLE = 5,
/**
* 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.