Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20c31a02 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Update datagram transfer state.

The following changes are made in this CL:
- Removed onDatagramTransferStateChanged() callback
- Added onSendDatagramStateChanged() callback
- Added onReceiveDatagramStateChanged() callback.

Bug: 269637555
Test: atest SatelliteManagerTest, Flashed build on raven-userdebug: calls and SMS are working.
Change-Id: I339bf7a06208ede7b70b2a8a4ad657f77e3bd2cb
parent 56954d17
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -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.
+16 −7
Original line number Diff line number Diff line
@@ -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,19 +751,27 @@ public class SatelliteManager {
                };
                ISatelliteTransmissionUpdateCallback internalCallback =
                        new ISatelliteTransmissionUpdateCallback.Stub() {

                            @Override
                            public void onDatagramTransferStateChanged(int state,
                                    int sendPendingCount, int receivePendingCount, int errorCode) {
                            public void onSatellitePositionChanged(PointingInfo pointingInfo) {
                                executor.execute(() -> Binder.withCleanCallingIdentity(
                                        () -> callback.onDatagramTransferStateChanged(
                                                state, sendPendingCount, receivePendingCount,
                                                errorCode)));
                                        () -> callback.onSatellitePositionChanged(pointingInfo)));
                            }

                            @Override
                            public void onSatellitePositionChanged(PointingInfo pointingInfo) {
                            public void onSendDatagramStateChanged(int state, int sendPendingCount,
                                    int errorCode) {
                                executor.execute(() -> Binder.withCleanCallingIdentity(
                                        () -> callback.onSatellitePositionChanged(pointingInfo)));
                                        () -> 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);
+15 −5
Original line number Diff line number Diff line
@@ -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);
}