Snap for 12239386 from 572074a671edb8d2aabd31835309a46d64fa4c54 to mainline-ipsec-release Change-Id: I26aa33d30bae36c46ab2493652a01ddd05971cd9
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/ProvisionSubscriberIdWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/ProvisionSubscriberIdWrapper.java deleted file mode 100644 index c547ee0..0000000 --- a/satellite_client/src/android/telephony/satellite/wrapper/ProvisionSubscriberIdWrapper.java +++ /dev/null
@@ -1,78 +0,0 @@ -/* - * 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 java.util.Objects; - -public class ProvisionSubscriberIdWrapper { - @NonNull private final String subscriberId; - private int carrierId; - @NonNull private final String niddApn; - - public ProvisionSubscriberIdWrapper(String subscriberId, int carrierId, String niddApn) { - this.subscriberId = subscriberId; - this.carrierId = carrierId; - this.niddApn = niddApn; - } - - @NonNull - public String getSubscriberId() { - return subscriberId; - } - - public int getCarrierId() { - return carrierId; - } - - @NonNull - public String getNiddApn() { - return niddApn; - } - - @Override - @NonNull - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("SubscriberId:"); - sb.append(subscriberId); - sb.append(","); - - sb.append("carrierId:"); - sb.append(carrierId); - sb.append(","); - - sb.append("niddApn:"); - sb.append(niddApn); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ProvisionSubscriberIdWrapper that = (ProvisionSubscriberIdWrapper) o; - return Objects.equals(subscriberId, that.subscriberId) - && carrierId == that.carrierId && Objects.equals(niddApn, that.niddApn); - } - - @Override - public int hashCode() { - return Objects.hash(subscriberId, carrierId, niddApn); - } -}
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java index 2227a75..21a08c4 100644 --- a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java
@@ -48,8 +48,9 @@ import android.telephony.satellite.SatelliteModemStateCallback; import android.telephony.satellite.SatelliteProvisionStateCallback; import android.telephony.satellite.SatelliteSessionStats; +import android.telephony.satellite.SatelliteSubscriberInfo; +import android.telephony.satellite.SatelliteSubscriberProvisionStatus; import android.telephony.satellite.SatelliteSupportedStateCallback; -import android.telephony.satellite.ProvisionSubscriberId; import android.telephony.satellite.SatelliteTransmissionUpdateCallback; import com.android.internal.telephony.flags.Flags; @@ -57,6 +58,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Method; import java.time.Duration; import java.util.ArrayList; import java.util.HashMap; @@ -401,6 +403,28 @@ public static final int SATELLITE_RESULT_MODEM_BUSY = 22; /** Telephony process is not currently available or satellite is not supported. */ public static final int SATELLITE_RESULT_ILLEGAL_STATE = 23; + /** + * Telephony framework timeout to receive ACK or response from the satellite modem after + * sending a request to the modem. + */ + public static final int SATELLITE_RESULT_MODEM_TIMEOUT = 24; + + /** + * Telephony framework needs to access the current location of the device to perform the + * request. However, location in the settings is disabled by users. + */ + public static final int SATELLITE_RESULT_LOCATION_DISABLED = 25; + + /** + * Telephony framework needs to access the current location of the device to perform the + * request. However, Telephony fails to fetch the current location from location service. + */ + public static final int SATELLITE_RESULT_LOCATION_NOT_AVAILABLE = 26; + + /** + * Emergency call is in progress. + */ + public static final int SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS = 27; /** @hide */ @IntDef( @@ -429,7 +453,11 @@ SATELLITE_RESULT_NOT_SUPPORTED, SATELLITE_RESULT_REQUEST_IN_PROGRESS, SATELLITE_RESULT_MODEM_BUSY, - SATELLITE_RESULT_ILLEGAL_STATE + SATELLITE_RESULT_ILLEGAL_STATE, + SATELLITE_RESULT_MODEM_TIMEOUT, + SATELLITE_RESULT_LOCATION_DISABLED, + SATELLITE_RESULT_LOCATION_NOT_AVAILABLE, + SATELLITE_RESULT_EMERGENCY_CALL_IN_PROGRESS }) @Retention(RetentionPolicy.SOURCE) public @interface SatelliteResult {} @@ -725,6 +753,13 @@ public void onSatelliteProvisionStateChanged(boolean provisioned) { callback.onSatelliteProvisionStateChanged(provisioned); } + + @Override + public void onSatelliteSubscriptionProvisionStateChanged(@NonNull + List<SatelliteSubscriberProvisionStatus> satelliteSubscriberProvisionStatus) { + callback.onSatelliteSubscriptionProvisionStateChanged( + transformToWrapperList(satelliteSubscriberProvisionStatus)); + } }; sSatelliteProvisionStateCallbackWrapperMap.put(callback, internalCallback); int result = @@ -774,6 +809,10 @@ public void onSatelliteModemStateChanged(@SatelliteModemState int state) { callback.onSatelliteModemStateChanged(state); } + + public void onEmergencyModeChanged(boolean isEmergency) { + callback.onEmergencyModeChanged(isEmergency); + } }; sSatelliteModemStateCallbackWrapperMap.put(callback, internalCallback); @@ -1430,19 +1469,18 @@ * SatelliteException. */ @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) - public void requestProvisionSubscriberIds(@NonNull @CallbackExecutor Executor executor, - @NonNull OutcomeReceiver<List<ProvisionSubscriberIdWrapper>, - SatelliteExceptionWrapper> callback) { + public void requestSatelliteSubscriberProvisionStatus( + @NonNull @CallbackExecutor Executor executor, + @NonNull OutcomeReceiver<List<SatelliteSubscriberProvisionStatusWrapper>, + SatelliteExceptionWrapper> callback) { Objects.requireNonNull(executor); Objects.requireNonNull(callback); OutcomeReceiver internalCallback = - new OutcomeReceiver<List<ProvisionSubscriberId>, SatelliteException>() { + new OutcomeReceiver<List<SatelliteSubscriberProvisionStatus>, SatelliteException>() { @Override - public void onResult(List<ProvisionSubscriberId> result) { - callback.onResult(result.stream().map(ids -> new ProvisionSubscriberIdWrapper( - ids.getSubscriberId(), ids.getCarrierId(), ids.getNiddApn())).collect( - Collectors.toList())); + public void onResult(List<SatelliteSubscriberProvisionStatus> result) { + callback.onResult(transformToWrapperList(result)); } @Override @@ -1450,44 +1488,18 @@ callback.onError(new SatelliteExceptionWrapper(exception.getErrorCode())); } }; - mSatelliteManager.requestProvisionSubscriberIds(executor, internalCallback); - } - - /** - * Request to get provisioned status for given a satellite subscriber id. - * - * @param satelliteSubscriberId Satellite subscriber id requiring provisioned status check. - * @param executor The executor on which the callback will be called. - * @param callback The callback object to which the result will be delivered. - */ - @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) - public void requestIsProvisioned(@NonNull String satelliteSubscriberId, - @NonNull @CallbackExecutor Executor executor, - @NonNull OutcomeReceiver<Boolean, SatelliteExceptionWrapper> callback) { - OutcomeReceiver internalCallback = - new OutcomeReceiver<Boolean, SatelliteException>() { - @Override - public void onResult(Boolean result) { - callback.onResult(result); - } - - @Override - public void onError(SatelliteException exception) { - callback.onError(new SatelliteExceptionWrapper(exception.getErrorCode())); - } - }; - mSatelliteManager.requestIsProvisioned(satelliteSubscriberId, executor, internalCallback); + mSatelliteManager.requestSatelliteSubscriberProvisionStatus(executor, internalCallback); } /** * Deliver the list of provisioned satellite subscriber ids. * - * @param list List of ProvisionSubscriberId. + * @param list List of SatelliteSubscriberInfo. * @param executor The executor on which the callback will be called. * @param callback The callback object to which the result will be delivered. */ @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) - public void provisionSatellite(@NonNull List<ProvisionSubscriberIdWrapper> list, + public void provisionSatellite(@NonNull List<SatelliteSubscriberInfoWrapper> list, @NonNull @CallbackExecutor Executor executor, @NonNull OutcomeReceiver<Boolean, SatelliteExceptionWrapper> callback) { OutcomeReceiver internalCallback = @@ -1503,11 +1515,45 @@ } }; mSatelliteManager.provisionSatellite(list.stream() - .map(wrapper -> new ProvisionSubscriberId(wrapper.getSubscriberId(), - wrapper.getCarrierId(), wrapper.getNiddApn())) + .map(info -> new SatelliteSubscriberInfo.Builder() + .setSubscriberId(info.getSubscriberId()) + .setCarrierId(info.getCarrierId()).setNiddApn(info.getNiddApn()) + .setSubId(info.getSubId()).setSubscriberIdType(info.getSubscriberIdType()) + .build()) .collect(Collectors.toList()), executor, internalCallback); } + private List<SatelliteSubscriberProvisionStatusWrapper> transformToWrapperList( + List<SatelliteSubscriberProvisionStatus> input) { + List<SatelliteSubscriberProvisionStatusWrapper> output = new ArrayList<>(); + if (Flags.carrierRoamingNbIotNtn()) { + for (SatelliteSubscriberProvisionStatus status : input) { + SatelliteSubscriberInfo info = status.getSatelliteSubscriberInfo(); + output.add(new SatelliteSubscriberProvisionStatusWrapper.Builder() + .setProvisionStatus(status.getProvisionStatus()) + .setSatelliteSubscriberInfo( + new SatelliteSubscriberInfoWrapper.Builder() + .setSubscriberId(info.getSubscriberId()) + .setCarrierId(info.getCarrierId()).setNiddApn(info.getNiddApn()) + .setSubId(info.getSubId()) + .setSubscriberIdType(info.getSubscriberIdType()) + .build()).build()); + } + } + return output; + } + + public boolean isSatelliteSubscriberIdSupported() { + try { + final String methodName = "requestSatelliteSubscriberProvisioningStatus"; + Method method = mSatelliteManager.getClass().getMethod(methodName, Executor.class, + OutcomeReceiver.class); + return method != null; + } catch (NoSuchMethodException e) { + return false; + } + } + @Nullable private ServiceState getServiceStateForSubscriptionId(int subId) { if (!mSubscriptionManager.isValidSubscriptionId(subId)) {
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteModemStateCallbackWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteModemStateCallbackWrapper.java index 450e48a..f6cb67f 100644 --- a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteModemStateCallbackWrapper.java +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteModemStateCallbackWrapper.java
@@ -25,4 +25,11 @@ * @param state The new satellite modem state. */ void onSatelliteModemStateChanged(@SatelliteManagerWrapper.SatelliteModemState int state); + + /** + * Called when the satellite emergency mode has changed. + * + * @param isEmergency {@code true} enabled for emergency mode, {@code false} otherwise. + */ + default void onEmergencyModeChanged(boolean isEmergency) {}; }
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteProvisionStateCallbackWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteProvisionStateCallbackWrapper.java index 5e69f70..07991cf 100644 --- a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteProvisionStateCallbackWrapper.java +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteProvisionStateCallbackWrapper.java
@@ -16,6 +16,10 @@ package android.telephony.satellite.wrapper; +import android.annotation.NonNull; + +import java.util.List; + /** A callback class for monitoring satellite provision state change events. */ public interface SatelliteProvisionStateCallbackWrapper { /** @@ -25,4 +29,13 @@ * false} means satellite is not provisioned. */ void onSatelliteProvisionStateChanged(boolean provisioned); + + /** + * Called when the provisioning state of one or more SatelliteSubscriberInfos changes. + * + * @param satelliteSubscriberProvisionStatus The list contains the latest provisioning states + * of the SatelliteSubscriberInfos. + */ + default void onSatelliteSubscriptionProvisionStateChanged(@NonNull + List<SatelliteSubscriberProvisionStatusWrapper> satelliteSubscriberProvisionStatus) {} }
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSubscriberInfoWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSubscriberInfoWrapper.java new file mode 100644 index 0000000..ce0daaa --- /dev/null +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSubscriberInfoWrapper.java
@@ -0,0 +1,261 @@ +/* + * 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.FlaggedApi; +import android.annotation.IntDef; +import android.annotation.NonNull; +import android.os.Parcel; +import android.os.Parcelable; + +import com.android.internal.telephony.flags.Flags; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.Objects; + +@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) +public class SatelliteSubscriberInfoWrapper implements Parcelable { + @NonNull private final String mSubscriberId; + @NonNull private final int mCarrierId; + @NonNull private final String mNiddApn; + @NonNull private int mSubId; + + /** SubscriberId format is the ICCID. */ + @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) + public static final int ICCID = 0; + /** SubscriberId format is the 6 digit of IMSI + MSISDN. */ + @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) + public static final int IMSI_MSISDN = 1; + + /** Type of subscriber id */ + @SubscriberIdType + @NonNull private int mSubscriberIdType; + + /** @hide */ + @IntDef(prefix = "SubscriberId_Type_", value = { + ICCID, + IMSI_MSISDN + }) + @Retention(RetentionPolicy.SOURCE) + public @interface SubscriberIdType { + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public SatelliteSubscriberInfoWrapper(@NonNull Builder builder) { + this.mSubscriberId = builder.mSubscriberId; + this.mCarrierId = builder.mCarrierId; + this.mNiddApn = builder.mNiddApn; + this.mSubId = builder.mSubId; + this.mSubscriberIdType = builder.mSubscriberIdType; + } + + /** + * Builder class for constructing SatelliteSubscriberInfoWrapper objects + * + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public static class Builder { + @NonNull private String mSubscriberId; + @NonNull private int mCarrierId; + @NonNull private String mNiddApn; + @NonNull private int mSubId; + @NonNull @SubscriberIdType private int mSubscriberIdType; + + /** + * Set the SubscriberId and returns the Builder class. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public Builder setSubscriberId(String subscriberId) { + mSubscriberId = subscriberId; + return this; + } + + /** + * Set the CarrierId and returns the Builder class. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public Builder setCarrierId(int carrierId) { + mCarrierId = carrierId; + return this; + } + + /** + * Set the niddApn and returns the Builder class. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public Builder setNiddApn(String niddApn) { + mNiddApn = niddApn; + return this; + } + + /** + * Set the subId and returns the Builder class. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public Builder setSubId(int subId) { + mSubId = subId; + return this; + } + + /** + * Set the SubscriberIdType and returns the Builder class. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public Builder setSubscriberIdType(@SubscriberIdType int subscriberIdType) { + mSubscriberIdType = subscriberIdType; + return this; + } + + /** + * Returns SatelliteSubscriberInfoWrapper object. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public SatelliteSubscriberInfoWrapper build() { + return new SatelliteSubscriberInfoWrapper(this); + } + } + + private SatelliteSubscriberInfoWrapper(Parcel in) { + mSubscriberId = in.readString(); + mCarrierId = in.readInt(); + mNiddApn = in.readString(); + mSubId = in.readInt(); + mSubscriberIdType = in.readInt(); + } + + /** + * @hide + */ + @Override + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public void writeToParcel(@NonNull Parcel out, int flags) { + out.writeString(mSubscriberId); + out.writeInt(mCarrierId); + out.writeString(mNiddApn); + out.writeInt(mSubId); + out.writeInt(mSubscriberIdType); + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public static final @android.annotation.NonNull Creator<SatelliteSubscriberInfoWrapper> + CREATOR = + new Creator<SatelliteSubscriberInfoWrapper>() { + @Override + public SatelliteSubscriberInfoWrapper createFromParcel(Parcel in) { + return new SatelliteSubscriberInfoWrapper(in); + } + + @Override + public SatelliteSubscriberInfoWrapper[] newArray(int size) { + return new SatelliteSubscriberInfoWrapper[size]; + } + }; + + /** + * @hide + */ + @Override + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public int describeContents() { + return 0; + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public String getSubscriberId() { + return mSubscriberId; + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public int getCarrierId() { + return mCarrierId; + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public String getNiddApn() { + return mNiddApn; + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public int getSubId() { + return mSubId; + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public @SubscriberIdType int getSubscriberIdType() { + return mSubscriberIdType; + } + + @Override + @NonNull + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("SubscriberId:"); + sb.append(mSubscriberId); + sb.append(","); + + sb.append("carrierId:"); + sb.append(mCarrierId); + sb.append(","); + + sb.append("niddApn:"); + sb.append(mNiddApn); + sb.append(","); + + sb.append("SubId:"); + sb.append(mSubId); + sb.append(","); + + sb.append("SubscriberIdType:"); + sb.append(mSubscriberIdType); + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof SatelliteSubscriberInfoWrapper)) return false; + SatelliteSubscriberInfoWrapper that = (SatelliteSubscriberInfoWrapper) o; + return Objects.equals(mSubscriberId, that.mSubscriberId) + && mCarrierId == that.mCarrierId && Objects.equals(mNiddApn, that.mNiddApn) + && mSubId == that.mSubId && mSubscriberIdType == that.mSubscriberIdType; + } + + @Override + public int hashCode() { + return Objects.hash(mSubscriberId, mCarrierId, mNiddApn, mSubId, mSubscriberIdType); + } +}
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSubscriberProvisionStatusWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSubscriberProvisionStatusWrapper.java new file mode 100644 index 0000000..e89edc3 --- /dev/null +++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteSubscriberProvisionStatusWrapper.java
@@ -0,0 +1,181 @@ +/* + * 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.FlaggedApi; +import android.annotation.NonNull; +import android.os.Parcel; +import android.os.Parcelable; + +import com.android.internal.telephony.flags.Flags; + +import java.util.Objects; + +@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) +public class SatelliteSubscriberProvisionStatusWrapper implements Parcelable { + @NonNull + private SatelliteSubscriberInfoWrapper mSubscriberInfo; + /** {@code true} mean the satellite subscriber is provisioned, {@code false} otherwise. */ + private boolean mProvisionStatus; + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public SatelliteSubscriberProvisionStatusWrapper(@NonNull Builder builder) { + mSubscriberInfo = builder.mSubscriberInfo; + mProvisionStatus = builder.mProvisionStatus; + } + + private SatelliteSubscriberProvisionStatusWrapper(Parcel in) { + readFromParcel(in); + } + + /** + * Builder class for constructing SatelliteSubscriberProvisionStatusWrapper objects + * + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public static class Builder { + private SatelliteSubscriberInfoWrapper mSubscriberInfo; + private boolean mProvisionStatus; + + /** + * Set the SatelliteSubscriberInfo and returns the Builder class. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public Builder setSatelliteSubscriberInfo( + SatelliteSubscriberInfoWrapper satelliteSubscriberInfo) { + mSubscriberInfo = satelliteSubscriberInfo; + return this; + } + + /** + * Set the SatelliteSubscriberInfo's provisionStatus and returns the Builder class. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public Builder setProvisionStatus(boolean provisionStatus) { + mProvisionStatus = provisionStatus; + return this; + } + + /** + * Returns SatelliteSubscriberProvisionStatus object. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @NonNull + public SatelliteSubscriberProvisionStatusWrapper build() { + return new SatelliteSubscriberProvisionStatusWrapper(this); + } + } + + /** + * @hide + */ + @Override + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public void writeToParcel(@NonNull Parcel out, int flags) { + out.writeParcelable(mSubscriberInfo, flags); + out.writeBoolean(mProvisionStatus); + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public static final @android.annotation.NonNull + Creator<SatelliteSubscriberProvisionStatusWrapper> CREATOR = + new Creator<SatelliteSubscriberProvisionStatusWrapper>() { + @Override + public SatelliteSubscriberProvisionStatusWrapper createFromParcel(Parcel in) { + return new SatelliteSubscriberProvisionStatusWrapper(in); + } + + @Override + public SatelliteSubscriberProvisionStatusWrapper[] newArray(int size) { + return new SatelliteSubscriberProvisionStatusWrapper[size]; + } + }; + + /** + * @hide + */ + @Override + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public int describeContents() { + return 0; + } + + /** + * SatelliteSubscriberInfo that has a provisioning state. + * + * @return SatelliteSubscriberInfo. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public @NonNull SatelliteSubscriberInfoWrapper getSatelliteSubscriberInfo() { + return mSubscriberInfo; + } + + /** + * SatelliteSubscriberInfo's provisioning state. + * + * @return {@code true} means provisioning. {@code false} means deprovisioning. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public @NonNull boolean getProvisionStatus() { + return mProvisionStatus; + } + + @NonNull + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append("SatelliteSubscriberInfoWrapper:"); + sb.append(mSubscriberInfo); + sb.append(","); + + sb.append("ProvisionStatus:"); + sb.append(mProvisionStatus); + return sb.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(mSubscriberInfo, mProvisionStatus); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof SatelliteSubscriberProvisionStatusWrapper)) return false; + SatelliteSubscriberProvisionStatusWrapper that = + (SatelliteSubscriberProvisionStatusWrapper) o; + return Objects.equals(mSubscriberInfo, that.mSubscriberInfo) + && mProvisionStatus == that.mProvisionStatus; + } + + private void readFromParcel(Parcel in) { + mSubscriberInfo = in.readParcelable(SatelliteSubscriberInfoWrapper.class.getClassLoader()); + mProvisionStatus = in.readBoolean(); + } +}