Merge "Update datagram transfer state." into udc-dev

This commit is contained in:
Aishwarya Mallampati
2023-03-16 04:26:09 +00:00
committed by Android (Google) Code Review
3 changed files with 44 additions and 18 deletions

View File

@@ -24,15 +24,22 @@ import android.telephony.satellite.PointingInfo;
*/
oneway interface ISatelliteTransmissionUpdateCallback {
/**
* Called when satellite datagram transfer state changed.
* Called when satellite datagram send state changed.
*
* @param state The new datagram transfer state.
* @param state The new send 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(in int state, in int sendPendingCount,
in int receivePendingCount, in int errorCode);
void onSendDatagramStateChanged(in int state, in int sendPendingCount, in int errorCode);
/**
* Called when satellite datagram receive state changed.
*
* @param state The new receive datagram transfer state.
* @param receivePendingCount The number of datagrams that are currently pending to be received.
* @param errorCode If datagram transfer failed, the reason for failure.
*/
void onReceiveDatagramStateChanged(in int state, in int receivePendingCount, in int errorCode);
/**
* Called when the satellite position changed.

View File

@@ -647,6 +647,7 @@ public class SatelliteManager {
})
@Retention(RetentionPolicy.SOURCE)
public @interface SatelliteDatagramTransferState {}
// TODO: Split into two enums for sending and receiving states
/**
* Satellite modem is in idle state.
@@ -750,20 +751,28 @@ public class SatelliteManager {
};
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)));
}
@Override
public void onSendDatagramStateChanged(int state, int sendPendingCount,
int errorCode) {
executor.execute(() -> Binder.withCleanCallingIdentity(
() -> callback.onSendDatagramStateChanged(
state, sendPendingCount, errorCode)));
}
@Override
public void onReceiveDatagramStateChanged(int state,
int receivePendingCount, int errorCode) {
executor.execute(() -> Binder.withCleanCallingIdentity(
() -> callback.onReceiveDatagramStateChanged(
state, receivePendingCount, errorCode)));
}
};
sSatelliteTransmissionUpdateCallbackMap.put(callback, internalCallback);
telephony.startSatelliteTransmissionUpdates(mSubId, errorCallback,

View File

@@ -33,14 +33,24 @@ public interface SatelliteTransmissionUpdateCallback {
void onSatellitePositionChanged(@NonNull PointingInfo pointingInfo);
/**
* Called when satellite datagram transfer state changed.
* Called when satellite datagram send state changed.
*
* @param state The new datagram transfer state.
* @param state The new send 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,
void onSendDatagramStateChanged(
@SatelliteManager.SatelliteDatagramTransferState int state, int sendPendingCount,
@SatelliteManager.SatelliteError int errorCode);
/**
* Called when satellite datagram receive state changed.
*
* @param state The new receive datagram transfer state.
* @param receivePendingCount The number of datagrams that are currently pending to be received.
* @param errorCode If datagram transfer failed, the reason for failure.
*/
void onReceiveDatagramStateChanged(
@SatelliteManager.SatelliteDatagramTransferState int state, int receivePendingCount,
@SatelliteManager.SatelliteError int errorCode);
}