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

Commit 3482449f authored by Thomas Nguyen's avatar Thomas Nguyen
Browse files

Cache satellite service states and restructure callback register handling in SatelliteController

Bug: 274136093
Test: Call/SMS/MMS with live network.
atest com.android.internal.telephony.satellite.SatelliteSOSMessageRecommenderTest
atest com.android.internal.telephony.satellite.SatelliteSessionControllerTest
atest android.telephony.cts.SatelliteManagerTest

Change-Id: I86c61cdc3fafeadfbd9a355a730cb2f498006518
parent 1a448079
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3034,6 +3034,13 @@ public interface CommandsInterface {
     */
    default void getSatellitePowerState(Message result) {}

    /**
     * Get satellite provision state.
     *
     * @param result Message that will be sent back to the requester
     */
    default void getSatelliteProvisionState(Message result) {}

    /**
     * Check whether satellite modem is supported by the device.
     *
+8 −0
Original line number Diff line number Diff line
@@ -5315,6 +5315,14 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.isSatelliteSupported(result);
    }

    /**
     * Check whether the satellite modem is provisioned.
     * @param result The Message to send the result of the operation to.
     */
    public void isSatelliteProvisioned(Message result) {
        mCi.getSatelliteProvisionState(result);
    }

    /**
     * Get the satellite capabilities.
     * @param result The Message to send the result of the operation to.
+15 −0
Original line number Diff line number Diff line
@@ -5788,6 +5788,21 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    /**
     * Get satellite provision state.
     *
     * @param result Message that will be sent back to the requester
     */
    @Override
    public void getSatelliteProvisionState(Message result) {
        // Satellite HAL APIs are not supported before Android V.
        if (result != null) {
            AsyncResult.forMessage(result, null,
                    CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }

    /**
     * Provision the subscription with a satellite provider. This is needed to register the
     * subscription if the provider allows dynamic registration.
+13 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class DatagramController {
        mSendErrorCode = errorCode;
        mPointingAppController.updateSendDatagramTransferState(subId, datagramTransferState,
                sendPendingCount, errorCode);
        notifyDatagramTransferStateChangedToSessionController();
    }

    /**
@@ -210,6 +211,7 @@ public class DatagramController {
        mReceiveErrorCode = errorCode;
        mPointingAppController.updateReceiveDatagramTransferState(subId, datagramTransferState,
                receivePendingCount, errorCode);
        notifyDatagramTransferStateChangedToSessionController();
    }

    /**
@@ -220,6 +222,17 @@ public class DatagramController {
        return mReceivePendingCount;
    }

    private void notifyDatagramTransferStateChangedToSessionController() {
        SatelliteSessionController sessionController = SatelliteSessionController.getInstance();
        if (sessionController == null) {
            loge("notifyDatagramTransferStateChangeToSessionController: SatelliteSessionController"
                    + " is not initialized yet");
        } else {
            sessionController.onDatagramTransferStateChanged(
                    mSendDatagramTransferState, mReceiveDatagramTransferState);
        }
    }

    private static void logd(@NonNull String log) {
        Rlog.d(TAG, log);
    }
+0 −4
Original line number Diff line number Diff line
@@ -445,8 +445,6 @@ public class DatagramReceiver extends Handler {
            satelliteDatagramListenerHandler = new SatelliteDatagramListenerHandler(
                    mBackgroundHandler.getLooper(), validSubId);
            if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) {
                // TODO: remove this as SatelliteModemInterface can register for incoming datagrams
                // on boot up itself.
                SatelliteModemInterface.getInstance().registerForSatelliteDatagramsReceived(
                        satelliteDatagramListenerHandler,
                        SatelliteDatagramListenerHandler.EVENT_SATELLITE_DATAGRAM_RECEIVED, null);
@@ -545,6 +543,4 @@ public class DatagramReceiver extends Handler {
    private static void loge(@NonNull String log) {
        Rlog.e(TAG, log);
    }

    // TODO: An api change - do not pass the binder from Telephony to Applications
}
Loading