Update APIs which is the provisioning per SubscriberId related according to the design doc changes.
1. Rename requestProvisionSubscriberIds and parameter.
2. Remove api requestIsProvisioned
3. Add new api isSatelliteSubscriberIdSupported
4. Apply builder pattern to SatelliteSubscriberInfo
5. Add two parameters(subId and SubscriberIdType) in SatelliteSubscriberInfo
Bug: 359366004
Test: build
Flag: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
Change-Id: I42bb743e908615738841c6cef1d83add396b7b19
diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java
index 0c98327..6ef953c 100644
--- a/telephony/java/android/telephony/satellite/SatelliteManager.java
+++ b/telephony/java/android/telephony/satellite/SatelliteManager.java
@@ -234,7 +234,7 @@
/**
* Bundle key to get the response from
- * {@link #requestProvisionSubscriberIds(Executor, OutcomeReceiver)}.
+ * {@link #requestSatelliteSubscriberProvisionStatus(Executor, OutcomeReceiver)}.
* @hide
*/
public static final String KEY_REQUEST_PROVISION_SUBSCRIBER_ID_TOKEN =
@@ -242,13 +242,6 @@
/**
* Bundle key to get the response from
- * {@link #requestIsProvisioned(String, Executor, OutcomeReceiver)}.
- * @hide
- */
- public static final String KEY_IS_SATELLITE_PROVISIONED = "request_is_satellite_provisioned";
-
- /**
- * Bundle key to get the response from
* {@link #provisionSatellite(List, Executor, OutcomeReceiver)}.
* @hide
*/
@@ -2651,8 +2644,10 @@
*/
@RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
- public void requestProvisionSubscriberIds(@NonNull @CallbackExecutor Executor executor,
- @NonNull OutcomeReceiver<List<SatelliteSubscriberInfo>, SatelliteException> callback) {
+ public void requestSatelliteSubscriberProvisionStatus(
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull OutcomeReceiver<List<SatelliteSubscriberProvisionStatus>,
+ SatelliteException> callback) {
Objects.requireNonNull(executor);
Objects.requireNonNull(callback);
@@ -2664,10 +2659,10 @@
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == SATELLITE_RESULT_SUCCESS) {
if (resultData.containsKey(KEY_REQUEST_PROVISION_SUBSCRIBER_ID_TOKEN)) {
- List<SatelliteSubscriberInfo> list =
+ List<SatelliteSubscriberProvisionStatus> list =
resultData.getParcelableArrayList(
KEY_REQUEST_PROVISION_SUBSCRIBER_ID_TOKEN,
- SatelliteSubscriberInfo.class);
+ SatelliteSubscriberProvisionStatus.class);
executor.execute(() -> Binder.withCleanCallingIdentity(() ->
callback.onResult(list)));
} else {
@@ -2682,70 +2677,14 @@
}
}
};
- telephony.requestProvisionSubscriberIds(receiver);
+ telephony.requestSatelliteSubscriberProvisionStatus(receiver);
} else {
- loge("requestProvisionSubscriberIds() invalid telephony");
+ loge("requestSatelliteSubscriberProvisionStatus() invalid telephony");
executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError(
new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE))));
}
} catch (RemoteException ex) {
- loge("requestProvisionSubscriberIds() RemoteException: " + ex);
- executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError(
- new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE))));
- }
- }
-
- /**
- * 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 callback.
- *
- * @throws SecurityException if the caller doesn't have required permission.
- * @hide
- */
- @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
- @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
- public void requestIsProvisioned(@NonNull String satelliteSubscriberId,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull OutcomeReceiver<Boolean, SatelliteException> callback) {
- Objects.requireNonNull(satelliteSubscriberId);
- Objects.requireNonNull(executor);
- Objects.requireNonNull(callback);
-
- try {
- ITelephony telephony = getITelephony();
- if (telephony != null) {
- ResultReceiver receiver = new ResultReceiver(null) {
- @Override
- protected void onReceiveResult(int resultCode, Bundle resultData) {
- if (resultCode == SATELLITE_RESULT_SUCCESS) {
- if (resultData.containsKey(KEY_IS_SATELLITE_PROVISIONED)) {
- boolean isIsProvisioned =
- resultData.getBoolean(KEY_IS_SATELLITE_PROVISIONED);
- executor.execute(() -> Binder.withCleanCallingIdentity(() ->
- callback.onResult(isIsProvisioned)));
- } else {
- loge("KEY_IS_SATELLITE_PROVISIONED does not exist.");
- executor.execute(() -> Binder.withCleanCallingIdentity(() ->
- callback.onError(new SatelliteException(
- SATELLITE_RESULT_REQUEST_FAILED))));
- }
- } else {
- executor.execute(() -> Binder.withCleanCallingIdentity(() ->
- callback.onError(new SatelliteException(resultCode))));
- }
- }
- };
- telephony.requestIsProvisioned(satelliteSubscriberId, receiver);
- } else {
- loge("requestIsSatelliteProvisioned() invalid telephony");
- executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError(
- new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE))));
- }
- } catch (RemoteException ex) {
- loge("requestIsSatelliteProvisioned() RemoteException: " + ex);
+ loge("requestSatelliteSubscriberProvisionStatus() RemoteException: " + ex);
executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError(
new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE))));
}
diff --git a/telephony/java/android/telephony/satellite/SatelliteSubscriberInfo.java b/telephony/java/android/telephony/satellite/SatelliteSubscriberInfo.java
index f26219b..50ed627 100644
--- a/telephony/java/android/telephony/satellite/SatelliteSubscriberInfo.java
+++ b/telephony/java/android/telephony/satellite/SatelliteSubscriberInfo.java
@@ -17,12 +17,15 @@
package android.telephony.satellite;
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;
/**
@@ -39,27 +42,117 @@
/** provision subscriberId */
@NonNull
private String mSubscriberId;
-
/** carrier id */
private int mCarrierId;
/** apn */
private String mNiddApn;
+ private int mSubId;
- /**
- * @hide
- */
- public SatelliteSubscriberInfo(@NonNull String subscriberId, @NonNull int carrierId,
- @NonNull String niddApn) {
- this.mCarrierId = carrierId;
- this.mSubscriberId = subscriberId;
- this.mNiddApn = niddApn;
- }
+ /** SubscriberId format is the ICCID. */
+ @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
+ public static final int ICCID = 0;
+ /** SubscriberId format is the 6 digit of IMSI + MSISDN. */
+ @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
+ public static final int IMSI_MSISDN = 1;
+
+ /** Type of subscriber id */
+ @SubscriberIdType private int mSubscriberIdType;
+ /** @hide */
+ @IntDef(prefix = "SubscriberId_Type_", value = {
+ ICCID,
+ IMSI_MSISDN
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface SubscriberIdType {}
private SatelliteSubscriberInfo(Parcel in) {
readFromParcel(in);
}
+ public SatelliteSubscriberInfo(@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 SatelliteSubscriberInfo objects
+ *
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
+ public static class Builder {
+ @NonNull private String mSubscriberId;
+ private int mCarrierId;
+ @NonNull
+ private String mNiddApn;
+ private int mSubId;
+ @SubscriberIdType
+ private int mSubscriberIdType;
+
+ /**
+ * Set the SubscriberId and returns the Builder class.
+ *
+ * @hide
+ */
+ public Builder setSubscriberId(String subscriberId) {
+ mSubscriberId = subscriberId;
+ return this;
+ }
+
+ /**
+ * Set the CarrierId and returns the Builder class.
+ * @hide
+ */
+ @NonNull
+ public Builder setCarrierId(int carrierId) {
+ mCarrierId = carrierId;
+ return this;
+ }
+
+ /**
+ * Set the niddApn and returns the Builder class.
+ * @hide
+ */
+ @NonNull
+ public Builder setNiddApn(String niddApn) {
+ mNiddApn = niddApn;
+ return this;
+ }
+
+ /**
+ * Set the subId and returns the Builder class.
+ * @hide
+ */
+ @NonNull
+ public Builder setSubId(int subId) {
+ mSubId = subId;
+ return this;
+ }
+
+ /**
+ * Set the SubscriberIdType and returns the Builder class.
+ * @hide
+ */
+ @NonNull
+ public Builder setSubscriberIdType(@SubscriberIdType int subscriberIdType) {
+ mSubscriberIdType = subscriberIdType;
+ return this;
+ }
+
+ /**
+ * Returns SatelliteSubscriberInfo object.
+ * @hide
+ */
+ @NonNull
+ public SatelliteSubscriberInfo build() {
+ return new SatelliteSubscriberInfo(this);
+ }
+ }
+
/**
* @hide
*/
@@ -69,6 +162,8 @@
out.writeString(mSubscriberId);
out.writeInt(mCarrierId);
out.writeString(mNiddApn);
+ out.writeInt(mSubId);
+ out.writeInt(mSubscriberIdType);
}
@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
@@ -121,6 +216,24 @@
return mNiddApn;
}
+ /**
+ * @return subId.
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
+ public int getSubId() {
+ return mSubId;
+ }
+
+ /**
+ * @return subscriberIdType.
+ * @hide
+ */
+ @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN)
+ public @SubscriberIdType int getSubscriberIdType() {
+ return mSubscriberIdType;
+ }
+
@NonNull
@Override
public String toString() {
@@ -136,26 +249,37 @@
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 int hashCode() {
- return Objects.hash(mSubscriberId, mCarrierId, mNiddApn);
+ return Objects.hash(mSubscriberId, mCarrierId, mNiddApn, mSubId, mSubscriberIdType);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof SatelliteSubscriberProvisionStatus)) return false;
SatelliteSubscriberInfo that = (SatelliteSubscriberInfo) o;
- return mSubscriberId.equals(that.mSubscriberId) && mCarrierId
- == that.mCarrierId && mNiddApn.equals(that.mNiddApn);
+ return Objects.equals(mSubscriberId, that.mSubscriberId) && mCarrierId == that.mCarrierId
+ && Objects.equals(mNiddApn, that.mNiddApn) && mSubId == that.mSubId
+ && mSubscriberIdType == that.mSubscriberIdType;
}
private void readFromParcel(Parcel in) {
mSubscriberId = in.readString();
mCarrierId = in.readInt();
mNiddApn = in.readString();
+ mSubId = in.readInt();
+ mSubscriberIdType = in.readInt();
}
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 8919703..0c5f30f 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -3413,19 +3413,7 @@
*/
@JavaPassthrough(annotation="@android.annotation.RequiresPermission("
+ "android.Manifest.permission.SATELLITE_COMMUNICATION)")
- void requestProvisionSubscriberIds(in ResultReceiver result);
-
- /**
- * Request to get provisioned status for given a satellite subscriber id.
- *
- * @param satelliteSubscriberId Satellite subscriber id requiring provisioned status check.
- * @param result The result receiver, which returns the provisioned status of the token if the
- * request is successful or an error code if the request failed.
- * @hide
- */
- @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
- + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
- void requestIsProvisioned(in String satelliteSubscriberId, in ResultReceiver result);
+ void requestSatelliteSubscriberProvisionStatus(in ResultReceiver result);
/**
* Deliver the list of provisioned satellite subscriber infos.