diff options
5 files changed, 289 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/satellite/SystemSelectionSpecifier.aidl b/telephony/java/android/telephony/satellite/SystemSelectionSpecifier.aidl new file mode 100644 index 000000000000..ecd248cbf924 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SystemSelectionSpecifier.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 SystemSelectionSpecifier; diff --git a/telephony/java/android/telephony/satellite/SystemSelectionSpecifier.java b/telephony/java/android/telephony/satellite/SystemSelectionSpecifier.java new file mode 100644 index 000000000000..8a5e7f22888a --- /dev/null +++ b/telephony/java/android/telephony/satellite/SystemSelectionSpecifier.java @@ -0,0 +1,175 @@ +/* + * 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.NonNull; +import android.os.Parcel; +import android.os.Parcelable; +import android.text.TextUtils; +import android.util.IntArray; + +import java.util.Objects; + +/** + * @hide + */ +public final class SystemSelectionSpecifier implements Parcelable { + + /** Network plmn associated with channel information. */ + @NonNull private String mMccMnc; + + /** The frequency bands to scan. Maximum length of the vector is 8. */ + @NonNull private IntArray mBands; + + /** + * The radio channels to scan as defined in 3GPP TS 25.101 and 36.101. + * Maximum length of the vector is 32. + */ + @NonNull private IntArray mEarfcs; + + /** + * @hide + */ + public SystemSelectionSpecifier(@NonNull String mccmnc, @NonNull IntArray bands, + @NonNull IntArray earfcs) { + mMccMnc = mccmnc; + mBands = bands; + mEarfcs = earfcs; + } + + private SystemSelectionSpecifier(Parcel in) { + readFromParcel(in); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel out, int flags) { + mMccMnc = TextUtils.emptyIfNull(mMccMnc); + out.writeString8(mMccMnc); + + if (mBands != null && mBands.size() > 0) { + out.writeInt(mBands.size()); + for (int i = 0; i < mBands.size(); i++) { + out.writeInt(mBands.get(i)); + } + } else { + out.writeInt(0); + } + + if (mEarfcs != null && mEarfcs.size() > 0) { + out.writeInt(mEarfcs.size()); + for (int i = 0; i < mEarfcs.size(); i++) { + out.writeInt(mEarfcs.get(i)); + } + } else { + out.writeInt(0); + } + } + + @NonNull public static final Parcelable.Creator<SystemSelectionSpecifier> CREATOR = + new Creator<>() { + @Override + public SystemSelectionSpecifier createFromParcel(Parcel in) { + return new SystemSelectionSpecifier(in); + } + + @Override + public SystemSelectionSpecifier[] newArray(int size) { + return new SystemSelectionSpecifier[size]; + } + }; + + @Override + @NonNull public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("mccmnc:"); + sb.append(mMccMnc); + sb.append(","); + + sb.append("bands:"); + if (mBands != null && mBands.size() > 0) { + for (int i = 0; i < mBands.size(); i++) { + sb.append(mBands.get(i)); + sb.append(","); + } + } else { + sb.append("none,"); + } + + sb.append("earfcs:"); + if (mEarfcs != null && mEarfcs.size() > 0) { + for (int i = 0; i < mEarfcs.size(); i++) { + sb.append(mEarfcs.get(i)); + sb.append(","); + } + } else { + sb.append("none"); + } + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SystemSelectionSpecifier that = (SystemSelectionSpecifier) o; + return Objects.equals(mMccMnc, that.mMccMnc) + && Objects.equals(mBands, that.mBands) + && Objects.equals(mEarfcs, that.mEarfcs); + } + + @Override + public int hashCode() { + return Objects.hash(mMccMnc, mBands, mEarfcs); + } + + @NonNull public String getMccMnc() { + return mMccMnc; + } + + @NonNull public IntArray getBands() { + return mBands; + } + + @NonNull public IntArray getEarfcs() { + return mEarfcs; + } + + private void readFromParcel(Parcel in) { + mMccMnc = in.readString(); + + mBands = new IntArray(); + int numBands = in.readInt(); + if (numBands > 0) { + for (int i = 0; i < numBands; i++) { + mBands.add(in.readInt()); + } + } + + mEarfcs = new IntArray(); + int numEarfcs = in.readInt(); + if (numEarfcs > 0) { + for (int i = 0; i < numEarfcs; i++) { + mEarfcs.add(in.readInt()); + } + } + } +} diff --git a/telephony/java/android/telephony/satellite/stub/ISatellite.aidl b/telephony/java/android/telephony/satellite/stub/ISatellite.aidl index 16983a0dbca1..b82396e710fd 100644 --- a/telephony/java/android/telephony/satellite/stub/ISatellite.aidl +++ b/telephony/java/android/telephony/satellite/stub/ISatellite.aidl @@ -23,6 +23,7 @@ import android.telephony.satellite.stub.INtnSignalStrengthConsumer; import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer; import android.telephony.satellite.stub.ISatelliteListener; import android.telephony.satellite.stub.SatelliteDatagram; +import android.telephony.satellite.stub.SystemSelectionSpecifier; /** * {@hide} @@ -500,4 +501,21 @@ oneway interface ISatellite { * SatelliteResult:SATELLITE_RESULT_REQUEST_NOT_SUPPORTED */ void abortSendingSatelliteDatagrams(in IIntegerConsumer resultCallback); + + /** + * Request to update the satellite subscription to be used for Non-Terrestrial network. + * + * @param iccId The ICCID of the subscription + * @param resultCallback The callback to receive the error code result of the operation. + */ + void updateSatelliteSubscription(in String iccId, in IIntegerConsumer resultCallback); + + /** + * Request to update system selection channels + * + * @param systemSelectionSpecifiers list of system selection specifiers + * @param resultCallback The callback to receive the error code result of the operation. + */ + void updateSystemSelectionChannels(in List<SystemSelectionSpecifier> systemSelectionSpecifiers, + in IIntegerConsumer resultCallback); } diff --git a/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java b/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java index a62363335fb9..d8b4974f23b9 100644 --- a/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java +++ b/telephony/java/android/telephony/satellite/stub/SatelliteImplBase.java @@ -262,6 +262,22 @@ public class SatelliteImplBase extends SatelliteService { "abortSendingSatelliteDatagrams"); } + @Override + public void updateSatelliteSubscription(String iccId, IIntegerConsumer resultCallback) + throws RemoteException { + executeMethodAsync(() -> SatelliteImplBase.this.updateSatelliteSubscription( + iccId, resultCallback), "updateSatelliteSubscription"); + } + + @Override + public void updateSystemSelectionChannels( + List<SystemSelectionSpecifier> systemSelectionSpecifiers, + IIntegerConsumer resultCallback) throws RemoteException { + executeMethodAsync(() -> SatelliteImplBase.this.updateSystemSelectionChannels( + systemSelectionSpecifiers, resultCallback), + "updateSystemSelectionChannels"); + } + // Call the methods with a clean calling identity on the executor and wait indefinitely for // the future to return. private void executeMethodAsync(Runnable r, String errorLogName) throws RemoteException { @@ -768,4 +784,27 @@ public class SatelliteImplBase extends SatelliteService { public void abortSendingSatelliteDatagrams(@NonNull IIntegerConsumer resultCallback){ // stub implementation } + + /** + * Request to update the satellite subscription to be used for Non-Terrestrial network. + * + * @param iccId The ICCID of the subscription + * @param resultCallback The callback to receive the error code result of the operation. + */ + public void updateSatelliteSubscription(String iccId, + @NonNull IIntegerConsumer resultCallback) { + // stub implementation + } + + /** + * Request to update system selection channels + * + * @param systemSelectionSpecifiers list of system selection specifiers + * @param resultCallback The callback to receive the error code result of the operation. + */ + public void updateSystemSelectionChannels( + @NonNull List<SystemSelectionSpecifier> systemSelectionSpecifiers, + @NonNull IIntegerConsumer resultCallback) { + // stub implementation + } } diff --git a/telephony/java/android/telephony/satellite/stub/SystemSelectionSpecifier.aidl b/telephony/java/android/telephony/satellite/stub/SystemSelectionSpecifier.aidl new file mode 100644 index 000000000000..22240f6324c9 --- /dev/null +++ b/telephony/java/android/telephony/satellite/stub/SystemSelectionSpecifier.aidl @@ -0,0 +1,38 @@ +/* + * 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.stub; + +/** + * {@hide} + */ +parcelable SystemSelectionSpecifier { + /** Network plmn associated with channel information. */ + String mMccMnc; + + /** + * The frequency bands to scan. Bands and earfcns won't overlap. + * Bands will be filled only if the whole band is needed. + * Maximum length of the vector is 8. + */ + int[] mBands; + + /** + * The radio channels to scan as defined in 3GPP TS 25.101 and 36.101. + * Maximum length of the vector is 32. + */ + int[] mEarfcs; +} |