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

Commit 820837c1 authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "Satellite API changes"

parents a3f76ef2 9871076e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@ import android.telephony.satellite.SatelliteDatagram;
oneway interface ISatelliteStateListener {
    void onSatelliteProvisionStateChanged(in boolean provisioned);
    void onSatellitePositionUpdate(in PointingInfo pointingInfo);
    void onMessageTransferStateUpdate(in int state);
    void onMessageTransferStateUpdate(in int state, in int sendPendingCount,
            in int receivePendingCount, in int errorCode);
    void onSatelliteModemStateChange(in int state);
    void onPendingMessageCount(in int count);
    void onSatelliteDatagrams(in SatelliteDatagram[] datagrams);
+13 −8
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
import android.os.Binder;

import java.lang.ref.WeakReference;
import java.util.List;
import java.util.concurrent.Executor;

/**
@@ -70,7 +69,7 @@ public class SatelliteCallback {
    }

    /**
     * Interface for position update change listener.
     * Interface for position update and message transfer state change listener.
     */
    public interface SatellitePositionUpdateListener {
        /**
@@ -84,9 +83,13 @@ public class SatelliteCallback {
         * Called when satellite message transfer state changes.
         *
         * @param state The new message transfer state.
         * @param sendPendingCount The number of messages that are currently being sent.
         * @param receivePendingCount The number of messages that are currently being received.
         * @param errorCode If message transfer failed, the reason for failure.
         */
        void onMessageTransferStateUpdate(
                @SatelliteManager.SatelliteMessageTransferState int state);
                @SatelliteManager.SatelliteMessageTransferState int state, int sendPendingCount,
                int receivePendingCount, @SatelliteManager.SatelliteError int errorCode);
    }

    /**
@@ -95,13 +98,13 @@ public class SatelliteCallback {
    public interface SatelliteStateListener {
        /**
         * Called when satellite state changes.
         * @param state - The new satellite state.
         * @param state The new satellite state.
         */
        void onSatelliteModemStateChange(@SatelliteManager.SatelliteModemState int state);

        /**
         * Called when there are pending messages to be received from satellite.
         * @param count - pending message count.
         * @param count Pending message count.
         */
        void onPendingMessageCount(int count);
    }
@@ -112,7 +115,7 @@ public class SatelliteCallback {
    public interface SatelliteDatagramListener {
        /**
         * Called when there are incoming datagrams to be received.
         * @param datagrams - datagrams to be received over satellite.
         * @param datagrams Datagrams to be received over satellite.
         */
        void onSatelliteDatagrams(SatelliteDatagram[] datagrams);
    }
@@ -145,13 +148,15 @@ public class SatelliteCallback {
        }

        public void onMessageTransferStateUpdate(
                @SatelliteManager.SatelliteMessageTransferState int state) {
                @SatelliteManager.SatelliteMessageTransferState int state, int sendPendingCount,
                int receivePendingCount, @SatelliteManager.SatelliteError int errorCode) {
            SatellitePositionUpdateListener listener =
                    (SatellitePositionUpdateListener) mSatelliteCallbackWeakRef.get();
            if (listener == null) return;

            Binder.withCleanCallingIdentity(() -> mExecutor.execute(
                    () -> listener.onMessageTransferStateUpdate(state)));
                    () -> listener.onMessageTransferStateUpdate(
                            state, sendPendingCount, receivePendingCount, errorCode)));
        }


+37 −62
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@ public final class SatelliteCapabilities implements Parcelable {
    private Set<Integer> mSupportedRadioTechnologies;

    /**
     * Whether satellite mode is always on (this to indicate power impact of keeping it on is
     * very minimal).
     * Whether satellite modem is always on.
     * This indicates the power impact of keeping it on is very minimal.
     */
    private boolean mIsAlwaysOn;

@@ -44,12 +44,7 @@ public final class SatelliteCapabilities implements Parcelable {
    private boolean mNeedsPointingToSatellite;

    /**
     * List of features supported by the Satellite modem.
     */
    private Set<Integer> mSupportedFeatures;

    /**
     * Whether UE needs a separate SIM profile to communicate with the Satellite network.
     * Whether UE needs a separate SIM profile to communicate with the satellite network.
     */
    private boolean mNeedsSeparateSimProfile;

@@ -57,12 +52,10 @@ public final class SatelliteCapabilities implements Parcelable {
     * @hide
     */
    public SatelliteCapabilities(Set<Integer> supportedRadioTechnologies, boolean isAlwaysOn,
            boolean needsPointingToSatellite, Set<Integer> supportedFeatures,
            boolean needsSeparateSimProfile) {
            boolean needsPointingToSatellite, boolean needsSeparateSimProfile) {
        mSupportedRadioTechnologies = supportedRadioTechnologies;
        mIsAlwaysOn = isAlwaysOn;
        mNeedsPointingToSatellite = needsPointingToSatellite;
        mSupportedFeatures = supportedFeatures;
        mNeedsSeparateSimProfile = needsSeparateSimProfile;
    }

@@ -88,21 +81,10 @@ public final class SatelliteCapabilities implements Parcelable {

        out.writeBoolean(mIsAlwaysOn);
        out.writeBoolean(mNeedsPointingToSatellite);

        if (mSupportedFeatures != null && !mSupportedFeatures.isEmpty()) {
            out.writeInt(mSupportedFeatures.size());
            for (int feature : mSupportedFeatures) {
                out.writeInt(feature);
            }
        } else {
            out.writeInt(0);
        }

        out.writeBoolean(mNeedsSeparateSimProfile);
    }

    public static final @android.annotation.NonNull Creator<SatelliteCapabilities> CREATOR =
            new Creator<SatelliteCapabilities>() {
    @NonNull public static final Creator<SatelliteCapabilities> CREATOR = new Creator<>() {
        @Override
        public SatelliteCapabilities createFromParcel(Parcel in) {
            return new SatelliteCapabilities(in);
@@ -114,9 +96,8 @@ public final class SatelliteCapabilities implements Parcelable {
        }
    };

    @NonNull
    @Override
    public String toString() {
    @NonNull public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("SupportedRadioTechnology:");
@@ -129,16 +110,6 @@ public final class SatelliteCapabilities implements Parcelable {
            sb.append("none,");
        }

        sb.append("SupportedFeatures:");
        if (mSupportedFeatures != null && !mSupportedFeatures.isEmpty()) {
            for (int feature : mSupportedFeatures) {
                sb.append(feature);
                sb.append(",");
            }
        } else {
            sb.append("none,");
        }

        sb.append("isAlwaysOn:");
        sb.append(mIsAlwaysOn);
        sb.append(",");
@@ -152,26 +123,39 @@ public final class SatelliteCapabilities implements Parcelable {
        return sb.toString();
    }

    @NonNull
    public Set<Integer> getSupportedRadioTechnologies() {
    /**
     * @return The list of technologies supported by the satellite modem.
     */
    @NonNull public Set<Integer> getSupportedRadioTechnologies() {
        return mSupportedRadioTechnologies;
    }

    /**
     * Get whether the satellite modem is always on.
     * This indicates the power impact of keeping it on is very minimal.
     *
     * @return {@code true} if the satellite modem is always on and {@code false} otherwise.
     */
    public boolean isAlwaysOn() {
        return mIsAlwaysOn;
    }

    /** Get function for mNeedsPointingToSatellite */
    /**
     * Get whether UE needs to point to a satellite to send and receive data.
     *
     * @return {@code true} if UE needs to pointing to a satellite to send and receive data and
     *         {@code false} otherwise.
     */
    public boolean needsPointingToSatellite() {
        return mNeedsPointingToSatellite;
    }

    @NonNull
    public Set<Integer> getSupportedFeatures() {
        return mSupportedFeatures;
    }

    /** Get function for mNeedsSeparateSimProfile */
    /**
     * Get whether UE needs a separate SIM profile to communicate with the satellite network.
     *
     * @return {@code true} if UE needs a separate SIM profile to comunicate with the satellite
     *         network and {@code false} otherwise.
     */
    public boolean needsSeparateSimProfile() {
        return mNeedsSeparateSimProfile;
    }
@@ -187,15 +171,6 @@ public final class SatelliteCapabilities implements Parcelable {

        mIsAlwaysOn = in.readBoolean();
        mNeedsPointingToSatellite = in.readBoolean();

        mSupportedFeatures = new HashSet<>();
        int numSupportedFeatures = in.readInt();
        if (numSupportedFeatures > 0) {
            for (int i = 0; i < numSupportedFeatures; i++) {
                mSupportedFeatures.add(in.readInt());
            }
        }

        mNeedsSeparateSimProfile = in.readBoolean();
    }
}
+216 −92

File changed.

Preview size limit exceeded, changes collapsed.

+61 −27
Original line number Diff line number Diff line
@@ -2771,7 +2771,7 @@ interface ITelephony {
    /**
     * Request to get the maximum number of characters per text message on satellite.
     *
     * @param subId The subId to get the maximum number of characters for.
     * @param subId The subId of the subscription to get the maximum number of characters for.
     * @param receiver Result receiver to get the error code of the request and the requested
     *                 maximum number of characters per text message on satellite.
     */
@@ -2814,26 +2814,26 @@ interface ITelephony {
    /**
     * Register for the satellite provision state change.
     *
     * @param subId The subId of the subscription to register for provision state changes for.
     * @param errorCallback The callback to get the error code of the request.
     * @param subId The subId of the subscription to register for provision state changes.
     * @param callback The callback to handle the satellite provision state changed event.
     *
     * @return The {@link SatelliteError} result of the operation.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void registerForSatelliteProvisionStateChanged(int subId,
            in IIntegerConsumer errorCallback, in ISatelliteStateListener callback);
    int registerForSatelliteProvisionStateChanged(int subId, in ISatelliteStateListener callback);

    /**
     * Unregister for the satellite provision state change.
     *
     * @param subId The subId of the subscription associated with the satellite service.
     * @param errorCallback The callback to get the error code of the request.
     * @param subId The subId of the subscription to unregister for provision state changes.
     * @param callback The callback that was passed to registerForSatelliteProvisionStateChanged.
     *
     * @return The {@link SatelliteError} result of the operation.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void unregisterForSatelliteProvisionStateChanged(int subId,
            in IIntegerConsumer errorCallback, in ISatelliteStateListener callback);
    int unregisterForSatelliteProvisionStateChanged(int subId, in ISatelliteStateListener callback);

    /**
     * Request to get whether the device is provisioned with a satellite provider.
@@ -2849,8 +2849,10 @@ interface ITelephony {
    /**
     * Register for listening to satellite modem state changes.
     *
     * @param subId - The subId of the subscription used for listening to satellite state changes.
     * @param callback - The callback to handle the satellite state changed event.
     * @param subId The subId of the subscription to register for satellite modem state changes.
     * @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)")
@@ -2859,8 +2861,10 @@ interface ITelephony {
    /**
     * Unregister to stop listening to satellite modem state changes.
     *
     * @param subId - The subId of the subscription associated with the satellite service.
     * @param callback - The callback that was passed to registerForSatelliteStateChange.
     * @param subId The subId of the subscription to unregister for satellite modem state changes.
     * @param callback The callback that was passed to registerForSatelliteStateChange.
     *
     * @return The {@link SatelliteError} result of the operation.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
@@ -2869,9 +2873,11 @@ interface ITelephony {
   /**
     * Register to receive incoming datagrams over satellite.
     *
     * @param subId - The subId of the subscription used for receiving datagrams.
     * @param datagramType - type of datagram
     * @param callback - The callback to receive incoming datagrams.
     * @param subId The subId of the subscription to register for incoming satellite datagrams.
     * @param datagramType Type of datagram.
     * @param callback The callback to handle receiving incoming datagrams.
     *
     * @return The {@link SatelliteError} result of the operation.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
@@ -2880,8 +2886,10 @@ interface ITelephony {
   /**
     * Unregister to stop receiving incoming datagrams over satellite.
     *
     * @param subId - The subId of the subscription associated with the satellite service.
     * @param callback - The callback that was passed to registerForSatelliteDatagram.
     * @param subId The subId of the subscription to unregister for incoming satellite datagrams.
     * @param callback The callback that was passed to registerForSatelliteDatagram.
     *
     * @return The {@link SatelliteError} result of the operation.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
@@ -2890,7 +2898,9 @@ interface ITelephony {
   /**
    * Poll pending satellite datagrams over satellite.
    *
    * @param subId - The subId of the subscription used for receiving datagrams.
    * @param subId The subId of the subscription to poll pending satellite datagrams for.
    *
    * @return The {@link SatelliteError} result of the operation.
    */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
@@ -2899,13 +2909,37 @@ interface ITelephony {
   /**
    * Send datagram over satellite.
    *
    * @param subId - The subId of the subscription used for receiving datagrams.
    * @param datagramType - type of datagram
    * @param datagram - datagram to send over satellite
    * @param callback - The callback to get the error code of the request.
    * @param subId The subId of the subscription to send satellite datagrams for.
    * @param datagramType Type of datagram.
    * @param datagram Datagram to send over satellite.
    * @param callback The callback to get the error code of the request.
    */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void sendSatelliteDatagram(int subId, int datagramType, in SatelliteDatagram datagram,
            IIntegerConsumer callback);

    /**
     * Request to get whether satellite communication is allowed for the current location.
     *
     * @param subId The subId of the subscription to get whether satellite communication is allowed
     *              for the current location for.
     * @param receiver Result receiver to get the error code of the request and whether satellite
     *                 communication is allowed for the current location.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void requestIsSatelliteCommunicationAllowedForCurrentLocation(int subId,
            in ResultReceiver receiver);

    /**
     * Request to get the time after which the satellite will next be visible.
     *
     * @param subId The subId to get the time after which the satellite will next be visible for.
     * @param receiver Result receiver to get the error code of the request and the requested
     *                 time after which the satellite will next be visible.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    void requestTimeForNextSatelliteVisibility(int subId, in ResultReceiver receiver);
}