Merge 24Q3 (ab/11976889) to aosp-main-future Bug: 347831320 Merged-In: I23cbadc31c48413afcdf52cc6d3768611b9df083 Change-Id: Ia00b1a0c814f2a797f8e9696632f45ba453e5d19
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/CarrierRoamingNtnModeListenerWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/CarrierRoamingNtnModeListenerWrapper.java new file mode 100644 index 0000000..4a2436e --- /dev/null +++ b/satellite_client/src/android/telephony/satellite/wrapper/CarrierRoamingNtnModeListenerWrapper.java
@@ -0,0 +1,31 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony.satellite.wrapper; + +/** Interface for carrier roaming non-terrestrial network listener. */ +public interface CarrierRoamingNtnModeListenerWrapper { + /** + * Callback invoked when carrier roaming non-terrestrial network mode changes. + * + * @param active {@code true} If the device is connected to carrier roaming + * non-terrestrial network or was connected within the + * {CarrierConfigManager + * #KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT} duration, + * {code false} otherwise. + */ + void onCarrierRoamingNtnModeChanged(boolean active); +}
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteCommunicationAllowedStateCallbackWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteCommunicationAllowedStateCallbackWrapper.java new file mode 100644 index 0000000..85fb42f --- /dev/null +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteCommunicationAllowedStateCallbackWrapper.java
@@ -0,0 +1,30 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony.satellite.wrapper; + +/** A callback class for monitoring satellite communication allowed state change events. */ +public interface SatelliteCommunicationAllowedStateCallbackWrapper { + /** + * Telephony does not guarantee that whenever there is a change in communication allowed state, + * this API will be called. Telephony does its best to detect the changes and notify its + * listeners accordingly. + * + * @param isAllowed {@code true} means satellite allow state is changed, + * {@code false} satellite allow state is not changed + */ + void onSatelliteCommunicationAllowedStateChanged(boolean isAllowed); +}
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java index d230e8f..59045f6 100644 --- a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java
@@ -32,6 +32,7 @@ import android.telephony.ServiceState; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; +import android.telephony.TelephonyCallback; import android.telephony.TelephonyManager; import android.telephony.satellite.AntennaPosition; import android.telephony.satellite.EnableRequestAttributes; @@ -40,11 +41,14 @@ import android.telephony.satellite.PointingInfo; import android.telephony.satellite.SatelliteCapabilities; import android.telephony.satellite.SatelliteCapabilitiesCallback; +import android.telephony.satellite.SatelliteCommunicationAllowedStateCallback; import android.telephony.satellite.SatelliteDatagram; import android.telephony.satellite.SatelliteDatagramCallback; import android.telephony.satellite.SatelliteManager; import android.telephony.satellite.SatelliteModemStateCallback; import android.telephony.satellite.SatelliteProvisionStateCallback; +import android.telephony.satellite.SatelliteSessionStats; +import android.telephony.satellite.SatelliteSupportedStateCallback; import android.telephony.satellite.SatelliteTransmissionUpdateCallback; import com.android.internal.telephony.flags.Flags; @@ -94,6 +98,18 @@ SatelliteCapabilitiesCallbackWrapper, SatelliteCapabilitiesCallback> sSatelliteCapabilitiesCallbackWrapperMap = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap< + SatelliteSupportedStateCallbackWrapper, SatelliteSupportedStateCallback> + sSatelliteSupportedStateCallbackWrapperMap = new ConcurrentHashMap<>(); + + private static final ConcurrentHashMap< + CarrierRoamingNtnModeListenerWrapper, TelephonyCallback.CarrierRoamingNtnModeListener> + sCarrierRoamingNtnModeListenerWrapperMap = new ConcurrentHashMap<>(); + + private static final ConcurrentHashMap<SatelliteCommunicationAllowedStateCallbackWrapper, + SatelliteCommunicationAllowedStateCallback> + sSatelliteCommunicationAllowedStateCallbackWrapperMap = new ConcurrentHashMap<>(); + private final SatelliteManager mSatelliteManager; private final SubscriptionManager mSubscriptionManager; private final TelephonyManager mTelephonyManager; @@ -124,11 +140,31 @@ * Datagram type indicating that the datagram to be sent or received is of type location sharing. */ public static final int DATAGRAM_TYPE_LOCATION_SHARING = 2; - + /** + * This type of datagram is used to keep the device in satellite connected state. + */ + public static final int DATAGRAM_TYPE_KEEP_ALIVE = 3; + /** + * Datagram type indicating that the datagram to be sent or received is of type SOS message and + * is the last message to emergency service provider indicating still needs help. + */ + public static final int DATAGRAM_TYPE_LAST_SOS_MESSAGE_STILL_NEED_HELP = 4; + /** + * Datagram type indicating that the datagram to be sent or received is of type SOS message and + * is the last message to emergency service provider indicating no more help is needed. + */ + public static final int DATAGRAM_TYPE_LAST_SOS_MESSAGE_NO_HELP_NEEDED = 5; /** @hide */ @IntDef( prefix = "DATAGRAM_TYPE_", - value = {DATAGRAM_TYPE_UNKNOWN, DATAGRAM_TYPE_SOS_MESSAGE, DATAGRAM_TYPE_LOCATION_SHARING}) + value = { + DATAGRAM_TYPE_UNKNOWN, + DATAGRAM_TYPE_SOS_MESSAGE, + DATAGRAM_TYPE_LOCATION_SHARING, + DATAGRAM_TYPE_KEEP_ALIVE, + DATAGRAM_TYPE_LAST_SOS_MESSAGE_STILL_NEED_HELP, + DATAGRAM_TYPE_LAST_SOS_MESSAGE_NO_HELP_NEEDED + }) @Retention(RetentionPolicy.SOURCE) public @interface DatagramType {} @@ -172,6 +208,22 @@ /** Satellite modem is unavailable. */ public static final int SATELLITE_MODEM_STATE_UNAVAILABLE = 5; /** + * The satellite modem is powered on but the device is not registered to a satellite cell. + */ + public static final int SATELLITE_MODEM_STATE_NOT_CONNECTED = 6; + /** + * The satellite modem is powered on and the device is registered to a satellite cell. + */ + public static final int SATELLITE_MODEM_STATE_CONNECTED = 7; + /** + * The satellite modem is being powered on. + */ + public static final int SATELLITE_MODEM_STATE_ENABLING_SATELLITE = 8; + /** + * The satellite modem is being powered off. + */ + public static final int SATELLITE_MODEM_STATE_DISABLING_SATELLITE = 9; + /** * 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. */ @@ -187,6 +239,10 @@ SATELLITE_MODEM_STATE_DATAGRAM_RETRYING, SATELLITE_MODEM_STATE_OFF, SATELLITE_MODEM_STATE_UNAVAILABLE, + SATELLITE_MODEM_STATE_NOT_CONNECTED, + SATELLITE_MODEM_STATE_CONNECTED, + SATELLITE_MODEM_STATE_ENABLING_SATELLITE, + SATELLITE_MODEM_STATE_DISABLING_SATELLITE, SATELLITE_MODEM_STATE_UNKNOWN }) @Retention(RetentionPolicy.SOURCE) @@ -233,6 +289,16 @@ */ public static final int SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_FAILED = 7; /** + * A transition state indicating that Telephony is waiting for satellite modem to connect to a + * satellite network before sending a datagram or polling for datagrams. If the satellite modem + * successfully connects to a satellite network, either + * {@link #SATELLITE_DATAGRAM_TRANSFER_STATE_SENDING} or + * {@link #SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVING} will be sent. Otherwise, + * either {@link #SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_FAILED} or + * {@link #SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_FAILED} will be sent. + */ + public static final int SATELLITE_DATAGRAM_TRANSFER_STATE_WAITING_TO_CONNECT = 8; + /** * The datagram transfer state is unknown. This generic datagram transfer state should be used * only when the datagram transfer state cannot be mapped to other specific datagram transfer * states. @@ -251,6 +317,7 @@ SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_SUCCESS, SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_NONE, SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_FAILED, + SATELLITE_DATAGRAM_TRANSFER_STATE_WAITING_TO_CONNECT, SATELLITE_DATAGRAM_TRANSFER_STATE_UNKNOWN }) @Retention(RetentionPolicy.SOURCE) @@ -565,6 +632,15 @@ } @Override + public void onSendDatagramStateChanged( + @SatelliteManager.DatagramType int datagramType, + @SatelliteDatagramTransferState int state, + int sendPendingCount, + @SatelliteResult int errorCode) { + callback.onSendDatagramStateChanged(datagramType, state, sendPendingCount, errorCode); + } + + @Override public void onReceiveDatagramStateChanged( @SatelliteDatagramTransferState int state, int receivePendingCount, @@ -747,6 +823,34 @@ } } + /** Register for carrier roaming non-terrestrial network mode changes. */ + public void registerForCarrierRoamingNtnModeChanged(int subId, + @NonNull @CallbackExecutor Executor executor, + @NonNull CarrierRoamingNtnModeListenerWrapper listener) { + TelephonyCallback.CarrierRoamingNtnModeListener internalListener = new TelephonyCallback + .CarrierRoamingNtnModeListener() { + @Override + public void onCarrierRoamingNtnModeChanged(boolean active) { + listener.onCarrierRoamingNtnModeChanged(active); + } + }; + sCarrierRoamingNtnModeListenerWrapperMap.put(listener, internalListener); + + TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId); + tm.registerTelephonyCallback(executor, (TelephonyCallback) internalListener); + } + + /** Unregister for carrier roaming non-terrestrial network mode changes. */ + public void unregisterForCarrierRoamingNtnModeChanged(int subId, + @NonNull CarrierRoamingNtnModeListenerWrapper listener) { + TelephonyCallback.CarrierRoamingNtnModeListener internalListener = + sCarrierRoamingNtnModeListenerWrapperMap.get(listener); + if (internalListener != null) { + TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId); + tm.unregisterTelephonyCallback((TelephonyCallback) internalListener); + } + } + /** Poll pending satellite datagrams over satellite. */ public void pollPendingDatagrams( @NonNull @CallbackExecutor Executor executor, @@ -1170,6 +1274,100 @@ return mSatelliteManager.getSatellitePlmnsForCarrier(subId); } + /** Registers for the satellite supported state changed. */ + @SatelliteResult + public int registerForSupportedStateChanged( + @NonNull @CallbackExecutor Executor executor, + @NonNull SatelliteSupportedStateCallbackWrapper callback) { + SatelliteSupportedStateCallback internalCallback = + new SatelliteSupportedStateCallback() { + @Override + public void onSatelliteSupportedStateChanged(boolean supported) { + callback.onSatelliteSupportedStateChanged(supported); + } + }; + sSatelliteSupportedStateCallbackWrapperMap.put(callback, internalCallback); + int result = + mSatelliteManager.registerForSupportedStateChanged(executor, internalCallback); + return result; + } + + /** Request to get the {@link SatelliteSessionStatsWrapper} of the satellite service. */ + public void requestSessionStats( + @NonNull @CallbackExecutor Executor executor, + @NonNull OutcomeReceiver<SatelliteSessionStatsWrapper, + SatelliteExceptionWrapper> callback) { + OutcomeReceiver internalCallback = + new OutcomeReceiver<SatelliteSessionStats, SatelliteException>() { + @Override + public void onResult(SatelliteSessionStats result) { + SatelliteSessionStatsWrapper statsWrapper = new SatelliteSessionStatsWrapper + .Builder() + .setCountOfSuccessfulUserMessages(result.getCountOfSuccessfulUserMessages()) + .setCountOfUnsuccessfulUserMessages( + result.getCountOfUnsuccessfulUserMessages()) + .setCountOfTimedOutUserMessagesWaitingForConnection( + result.getCountOfTimedOutUserMessagesWaitingForConnection()) + .setCountOfTimedOutUserMessagesWaitingForAck( + result.getCountOfTimedOutUserMessagesWaitingForAck()) + .setCountOfUserMessagesInQueueToBeSent( + result.getCountOfUserMessagesInQueueToBeSent()) + .build(); + callback.onResult(statsWrapper); + } + + @Override + public void onError(SatelliteException exception) { + callback.onError(new SatelliteExceptionWrapper(exception.getErrorCode())); + } + }; + mSatelliteManager.requestSessionStats(executor, internalCallback); + } + + /** + * Unregisters for the satellite supported state changed. If callback was not registered before, + * the request will be ignored. + */ + public void unregisterForSupportedStateChanged( + @NonNull SatelliteSupportedStateCallbackWrapper callback) { + SatelliteSupportedStateCallback internalCallback = + sSatelliteSupportedStateCallbackWrapperMap.get(callback); + if (internalCallback != null) { + mSatelliteManager.unregisterForSupportedStateChanged(internalCallback); + } + } + + /** Registers for the satellite communication allowed state changed. */ + @SatelliteResult + public int registerForCommunicationAllowedStateChanged( + @NonNull @CallbackExecutor Executor executor, + @NonNull SatelliteCommunicationAllowedStateCallbackWrapper callback) { + SatelliteCommunicationAllowedStateCallback internalCallback = + new SatelliteCommunicationAllowedStateCallback() { + @Override + public void onSatelliteCommunicationAllowedStateChanged(boolean supported) { + callback.onSatelliteCommunicationAllowedStateChanged(supported); + } + }; + sSatelliteCommunicationAllowedStateCallbackWrapperMap.put(callback, internalCallback); + int result = mSatelliteManager.registerForCommunicationAllowedStateChanged(executor, + internalCallback); + return result; + } + + /** + * Unregisters for the satellite communication allowed state changed. If callback was not + * registered before, the request will be ignored. + */ + public void unregisterForCommunicationAllowedStateChanged( + @NonNull SatelliteCommunicationAllowedStateCallbackWrapper callback) { + SatelliteCommunicationAllowedStateCallback internalCallback = + sSatelliteCommunicationAllowedStateCallbackWrapperMap.get(callback); + if (internalCallback != null) { + mSatelliteManager.unregisterForCommunicationAllowedStateChanged(internalCallback); + } + } + @Nullable private ServiceState getServiceStateForSubscriptionId(int subId) { if (!mSubscriptionManager.isValidSubscriptionId(subId)) {
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSessionStatsWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSessionStatsWrapper.java new file mode 100644 index 0000000..81969e9 --- /dev/null +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSessionStatsWrapper.java
@@ -0,0 +1,220 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony.satellite.wrapper; + +import android.annotation.NonNull; +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.Objects; + +public class SatelliteSessionStatsWrapper implements Parcelable { + private int mCountOfSuccessfulUserMessages; + private int mCountOfUnsuccessfulUserMessages; + private int mCountOfTimedOutUserMessagesWaitingForConnection; + private int mCountOfTimedOutUserMessagesWaitingForAck; + private int mCountOfUserMessagesInQueueToBeSent; + + /** + * SatelliteSessionStats constructor + * @param builder Builder to create SatelliteSessionStats object/ + */ + public SatelliteSessionStatsWrapper(@NonNull Builder builder) { + mCountOfSuccessfulUserMessages = builder.mCountOfSuccessfulUserMessages; + mCountOfUnsuccessfulUserMessages = builder.mCountOfUnsuccessfulUserMessages; + mCountOfTimedOutUserMessagesWaitingForConnection = + builder.mCountOfTimedOutUserMessagesWaitingForConnection; + mCountOfTimedOutUserMessagesWaitingForAck = + builder.mCountOfTimedOutUserMessagesWaitingForAck; + mCountOfUserMessagesInQueueToBeSent = builder.mCountOfUserMessagesInQueueToBeSent; + } + + private SatelliteSessionStatsWrapper(Parcel in) { + readFromParcel(in); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel out, int flags) { + out.writeInt(mCountOfSuccessfulUserMessages); + out.writeInt(mCountOfUnsuccessfulUserMessages); + out.writeInt(mCountOfTimedOutUserMessagesWaitingForConnection); + out.writeInt(mCountOfTimedOutUserMessagesWaitingForAck); + out.writeInt(mCountOfUserMessagesInQueueToBeSent); + } + + @NonNull + public static final Parcelable.Creator<SatelliteSessionStatsWrapper> CREATOR = + new Parcelable.Creator<>() { + @Override + public SatelliteSessionStatsWrapper createFromParcel(Parcel in) { + return new SatelliteSessionStatsWrapper(in); + } + + @Override + public SatelliteSessionStatsWrapper[] newArray(int size) { + return new SatelliteSessionStatsWrapper[size]; + } + }; + + @Override + @NonNull + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("countOfSuccessfulUserMessages:"); + sb.append(mCountOfSuccessfulUserMessages); + sb.append(","); + + sb.append("countOfUnsuccessfulUserMessages:"); + sb.append(mCountOfUnsuccessfulUserMessages); + sb.append(","); + + sb.append("countOfTimedOutUserMessagesWaitingForConnection:"); + sb.append(mCountOfTimedOutUserMessagesWaitingForConnection); + sb.append(","); + + sb.append("countOfTimedOutUserMessagesWaitingForAck:"); + sb.append(mCountOfTimedOutUserMessagesWaitingForAck); + sb.append(","); + + sb.append("countOfUserMessagesInQueueToBeSent:"); + sb.append(mCountOfUserMessagesInQueueToBeSent); + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SatelliteSessionStatsWrapper that = (SatelliteSessionStatsWrapper) o; + return mCountOfSuccessfulUserMessages == that.mCountOfSuccessfulUserMessages + && mCountOfUnsuccessfulUserMessages == that.mCountOfUnsuccessfulUserMessages + && mCountOfTimedOutUserMessagesWaitingForConnection + == that.mCountOfTimedOutUserMessagesWaitingForConnection + && mCountOfTimedOutUserMessagesWaitingForAck + == that.mCountOfTimedOutUserMessagesWaitingForAck + && mCountOfUserMessagesInQueueToBeSent + == that.mCountOfUserMessagesInQueueToBeSent; + } + + @Override + public int hashCode() { + return Objects.hash(mCountOfSuccessfulUserMessages, mCountOfUnsuccessfulUserMessages, + mCountOfTimedOutUserMessagesWaitingForConnection, + mCountOfTimedOutUserMessagesWaitingForAck, + mCountOfUserMessagesInQueueToBeSent); + } + + public int getCountOfSuccessfulUserMessages() { + return mCountOfSuccessfulUserMessages; + } + + public int getCountOfUnsuccessfulUserMessages() { + return mCountOfUnsuccessfulUserMessages; + } + + public int getCountOfTimedOutUserMessagesWaitingForConnection() { + return mCountOfTimedOutUserMessagesWaitingForConnection; + } + + public int getCountOfTimedOutUserMessagesWaitingForAck() { + return mCountOfTimedOutUserMessagesWaitingForAck; + } + + public int getCountOfUserMessagesInQueueToBeSent() { + return mCountOfUserMessagesInQueueToBeSent; + } + + private void readFromParcel(Parcel in) { + mCountOfSuccessfulUserMessages = in.readInt(); + mCountOfUnsuccessfulUserMessages = in.readInt(); + mCountOfTimedOutUserMessagesWaitingForConnection = in.readInt(); + mCountOfTimedOutUserMessagesWaitingForAck = in.readInt(); + mCountOfUserMessagesInQueueToBeSent = in.readInt(); + } + + /** + * A builder class to create {@link SatelliteSessionStatsWrapper} data object. + */ + public static final class Builder { + private int mCountOfSuccessfulUserMessages; + private int mCountOfUnsuccessfulUserMessages; + private int mCountOfTimedOutUserMessagesWaitingForConnection; + private int mCountOfTimedOutUserMessagesWaitingForAck; + private int mCountOfUserMessagesInQueueToBeSent; + + /** + * Sets countOfSuccessfulUserMessages value of {@link SatelliteSessionStatsWrapper} + * and then returns the Builder class. + */ + @NonNull + public Builder setCountOfSuccessfulUserMessages(int count) { + mCountOfSuccessfulUserMessages = count; + return this; + } + + /** + * Sets countOfUnsuccessfulUserMessages value of {@link SatelliteSessionStatsWrapper} + * and then returns the Builder class. + */ + @NonNull + public Builder setCountOfUnsuccessfulUserMessages(int count) { + mCountOfUnsuccessfulUserMessages = count; + return this; + } + + /** + * Sets countOfTimedOutUserMessagesWaitingForConnection value of + * {@link SatelliteSessionStatsWrapper} and then returns the Builder class. + */ + @NonNull + public Builder setCountOfTimedOutUserMessagesWaitingForConnection(int count) { + mCountOfTimedOutUserMessagesWaitingForConnection = count; + return this; + } + + /** + * Sets countOfTimedOutUserMessagesWaitingForAck value of + * {@link SatelliteSessionStatsWrapper} and then returns the Builder class. + */ + @NonNull + public Builder setCountOfTimedOutUserMessagesWaitingForAck(int count) { + mCountOfTimedOutUserMessagesWaitingForAck = count; + return this; + } + + /** + * Sets countOfUserMessagesInQueueToBeSent value of {@link SatelliteSessionStatsWrapper} + * and then returns the Builder class. + */ + @NonNull + public Builder setCountOfUserMessagesInQueueToBeSent(int count) { + mCountOfUserMessagesInQueueToBeSent = count; + return this; + } + + /** Returns SatelliteSessionStats object. */ + @NonNull + public SatelliteSessionStatsWrapper build() { + return new SatelliteSessionStatsWrapper(this); + } + } +}
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSupportedStateCallbackWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSupportedStateCallbackWrapper.java new file mode 100644 index 0000000..8915b91 --- /dev/null +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSupportedStateCallbackWrapper.java
@@ -0,0 +1,28 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony.satellite.wrapper; + +/** A callback class for monitoring satellite supported state change events. */ +public interface SatelliteSupportedStateCallbackWrapper { + /** + * Called when satellite supported state changes. + * + * @param supported The new supported state. {@code true} means satellite is supported {@code + * false} means satellite is not supported. + */ + void onSatelliteSupportedStateChanged(boolean supported); +}
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteTransmissionUpdateCallbackWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteTransmissionUpdateCallbackWrapper.java index 381b397..8235c30 100644 --- a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteTransmissionUpdateCallbackWrapper.java +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteTransmissionUpdateCallbackWrapper.java
@@ -43,6 +43,20 @@ @SatelliteManagerWrapper.SatelliteResult int errorCode); /** + * Called when satellite datagram send state changed. + * + * @param datagramType The datagram type of currently being sent. + * @param state The new send datagram transfer state. + * @param sendPendingCount The number of datagrams that are currently being sent. + * @param errorCode If datagram transfer failed, the reason for failure. + * + * @hide + */ + default void onSendDatagramStateChanged(@SatelliteManagerWrapper.DatagramType int datagramType, + @SatelliteManagerWrapper.SatelliteDatagramTransferState int state, int sendPendingCount, + @SatelliteManagerWrapper.SatelliteResult int errorCode) {} + + /** * Called when satellite datagram receive state changed. * * @param state The new receive datagram transfer state.