diff options
| author | 2024-08-08 20:23:08 +0000 | |
|---|---|---|
| committer | 2024-08-13 18:03:59 +0000 | |
| commit | 6413e4b1fecce141a91dd00fe1a9996e461c0943 (patch) | |
| tree | f5db03fd2b901135b775f4751efc8b06b243cfc9 | |
| parent | 43243dc4f92c42485bcff5b27e50c902445bf465 (diff) | |
Add api for provision state change per SatelliteSubscriberInfo
1. Add SatelliteSubscriberProvisionStatus
2. Add api for provision state change per SatelliteSubscriberInfo
Bug: 358692459
Test: atest SatelliteControllerTest
Test: manual test with test apk
Flag: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
Change-Id: I01030577a4f6cc855ae59f9dccd92fd99ea9393b
5 files changed, 230 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/satellite/ISatelliteProvisionStateCallback.aidl b/telephony/java/android/telephony/satellite/ISatelliteProvisionStateCallback.aidl index f981fb1d67c7..5f0d986912a1 100644 --- a/telephony/java/android/telephony/satellite/ISatelliteProvisionStateCallback.aidl +++ b/telephony/java/android/telephony/satellite/ISatelliteProvisionStateCallback.aidl @@ -16,6 +16,8 @@ package android.telephony.satellite; +import android.telephony.satellite.SatelliteSubscriberProvisionStatus; + /** * Interface for satellite provision state callback. * @hide @@ -27,4 +29,14 @@ oneway interface ISatelliteProvisionStateCallback { * @param provisioned True means the service is provisioned and false means it is not. */ void onSatelliteProvisionStateChanged(in 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. + * @hide + */ + void onSatelliteSubscriptionProvisionStateChanged(in List<SatelliteSubscriberProvisionStatus> + satelliteSubscriberProvisionStatus); } diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java index e657d7faad15..0c983278c1f6 100644 --- a/telephony/java/android/telephony/satellite/SatelliteManager.java +++ b/telephony/java/android/telephony/satellite/SatelliteManager.java @@ -1404,6 +1404,16 @@ public final class SatelliteManager { () -> callback.onSatelliteProvisionStateChanged( provisioned))); } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + @Override + public void onSatelliteSubscriptionProvisionStateChanged( + @NonNull List<SatelliteSubscriberProvisionStatus> + satelliteSubscriberProvisionStatus) { + executor.execute(() -> Binder.withCleanCallingIdentity(() -> + callback.onSatelliteSubscriptionProvisionStateChanged( + satelliteSubscriberProvisionStatus))); + } }; sSatelliteProvisionStateCallbackMap.put(callback, internalCallback); return telephony.registerForSatelliteProvisionStateChanged( diff --git a/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java b/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java index a12952be7620..e8ae0f56ee9e 100644 --- a/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java +++ b/telephony/java/android/telephony/satellite/SatelliteProvisionStateCallback.java @@ -17,10 +17,13 @@ package android.telephony.satellite; import android.annotation.FlaggedApi; +import android.annotation.NonNull; import android.annotation.SystemApi; import com.android.internal.telephony.flags.Flags; +import java.util.List; + /** * A callback class for monitoring satellite provision state change events. * @@ -39,4 +42,16 @@ public interface SatelliteProvisionStateCallback { */ @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) 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. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + default void onSatelliteSubscriptionProvisionStateChanged( + @NonNull List<SatelliteSubscriberProvisionStatus> + satelliteSubscriberProvisionStatus) {}; } diff --git a/telephony/java/android/telephony/satellite/SatelliteSubscriberProvisionStatus.aidl b/telephony/java/android/telephony/satellite/SatelliteSubscriberProvisionStatus.aidl new file mode 100644 index 000000000000..80de77905f80 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatelliteSubscriberProvisionStatus.aidl @@ -0,0 +1,19 @@ +/* + * Copyright 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; + +parcelable SatelliteSubscriberProvisionStatus;
\ No newline at end of file diff --git a/telephony/java/android/telephony/satellite/SatelliteSubscriberProvisionStatus.java b/telephony/java/android/telephony/satellite/SatelliteSubscriberProvisionStatus.java new file mode 100644 index 000000000000..e3d619ea0fc8 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatelliteSubscriberProvisionStatus.java @@ -0,0 +1,174 @@ +/* + * 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; + +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; + +/** + * Represents the provisioning state of SatelliteSubscriberInfo. + * + * @hide + */ +@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) +public class SatelliteSubscriberProvisionStatus implements Parcelable { + private SatelliteSubscriberInfo mSubscriberInfo; + /** {@code true} mean the satellite subscriber is provisioned, {@code false} otherwise. */ + private boolean mProvisionStatus; + + public SatelliteSubscriberProvisionStatus(@NonNull Builder builder) { + mSubscriberInfo = builder.mSubscriberInfo; + mProvisionStatus = builder.mProvisionStatus; + } + + /** + * Builder class for constructing SatelliteSubscriberProvisionStatus objects + * + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public static class Builder { + private SatelliteSubscriberInfo mSubscriberInfo; + private boolean mProvisionStatus; + + /** + * Set the SatelliteSubscriberInfo and returns the Builder class. + * @hide + */ + public Builder setSatelliteSubscriberInfo(SatelliteSubscriberInfo satelliteSubscriberInfo) { + mSubscriberInfo = satelliteSubscriberInfo; + return this; + } + + /** + * Set the SatelliteSubscriberInfo's provisionStatus and returns the Builder class. + * @hide + */ + @NonNull + public Builder setProvisionStatus(boolean provisionStatus) { + mProvisionStatus = provisionStatus; + return this; + } + + /** + * Returns SatelliteSubscriberProvisionStatus object. + * @hide + */ + @NonNull + public SatelliteSubscriberProvisionStatus build() { + return new SatelliteSubscriberProvisionStatus(this); + } + } + + private SatelliteSubscriberProvisionStatus(Parcel in) { + readFromParcel(in); + } + + /** + * @hide + */ + @Override + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public void writeToParcel(@NonNull Parcel out, int flags) { + mSubscriberInfo.writeToParcel(out, flags); + out.writeBoolean(mProvisionStatus); + } + + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + public static final @android.annotation.NonNull Creator<SatelliteSubscriberProvisionStatus> + CREATOR = + new Creator<SatelliteSubscriberProvisionStatus>() { + @Override + public SatelliteSubscriberProvisionStatus createFromParcel(Parcel in) { + return new SatelliteSubscriberProvisionStatus(in); + } + + @Override + public SatelliteSubscriberProvisionStatus[] newArray(int size) { + return new SatelliteSubscriberProvisionStatus[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 SatelliteSubscriberInfo 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("SatelliteSubscriberInfo:"); + 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 SatelliteSubscriberProvisionStatus)) return false; + SatelliteSubscriberProvisionStatus that = (SatelliteSubscriberProvisionStatus) o; + return Objects.equals(mSubscriberInfo, that.mSubscriberInfo) + && mProvisionStatus == that.mProvisionStatus; + } + + private void readFromParcel(Parcel in) { + mSubscriberInfo = in.readParcelable(SatelliteSubscriberInfo.class.getClassLoader(), + SatelliteSubscriberInfo.class); + mProvisionStatus = in.readBoolean(); + } +} |