diff options
12 files changed, 724 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/satellite/EarfcnRange.aidl b/telephony/java/android/telephony/satellite/EarfcnRange.aidl new file mode 100644 index 000000000000..0b224d0b09bd --- /dev/null +++ b/telephony/java/android/telephony/satellite/EarfcnRange.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 EarfcnRange; diff --git a/telephony/java/android/telephony/satellite/EarfcnRange.java b/telephony/java/android/telephony/satellite/EarfcnRange.java new file mode 100644 index 000000000000..38043b570c2f --- /dev/null +++ b/telephony/java/android/telephony/satellite/EarfcnRange.java @@ -0,0 +1,124 @@ +/* + * 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.IntRange; +import android.annotation.NonNull; +import android.os.Parcel; +import android.os.Parcelable; + +import com.android.internal.telephony.flags.Flags; + +/** + * EARFCN (E-UTRA Absolute Radio Frequency Channel Number): A number that identifies a + * specific frequency channel in LTE/5G NR, used to define the carrier frequency. + * The range can be [0 ~ 65535] according to the 3GPP TS 36.101 + * + * In satellite communication: + * - Efficient frequency allocation across a wide coverage area. + * - Handles Doppler shift due to satellite movement. + * - Manages interference with terrestrial networks. + * + * See 3GPP TS 36.101 and 38.101-1 for details. + * + * @hide + */ +@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) +public final class EarfcnRange implements Parcelable { + + /** + * The start frequency of the earfcn range and is inclusive in the range + */ + private int mStartEarfcn; + + /** + * The end frequency of the earfcn range and is inclusive in the range. + */ + private int mEndEarfcn; + + private EarfcnRange(@NonNull Parcel in) { + readFromParcel(in); + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(mStartEarfcn); + dest.writeInt(mEndEarfcn); + } + + private void readFromParcel(Parcel in) { + mStartEarfcn = in.readInt(); + mEndEarfcn = in.readInt(); + } + + /** + * Constructor for the EarfcnRange class. + * The range can be [0 ~ 65535] according to the 3GPP TS 36.101 + * + * @param startEarfcn The starting earfcn value. + * @param endEarfcn The ending earfcn value. + */ + public EarfcnRange(@IntRange(from = 0, to = 65535) int endEarfcn, + @IntRange(from = 0, to = 65535) int startEarfcn) { + mEndEarfcn = endEarfcn; + mStartEarfcn = startEarfcn; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public String toString() { + return "startEarfcn: " + mStartEarfcn + ", " + "endEarfcn: " + mEndEarfcn; + } + + @NonNull + public static final Creator<EarfcnRange> CREATOR = new Creator<EarfcnRange>() { + @Override + public EarfcnRange createFromParcel(Parcel in) { + return new EarfcnRange(in); + } + + @Override + public EarfcnRange[] newArray(int size) { + return new EarfcnRange[size]; + } + }; + + /** + * Returns the starting earfcn value for this range. + * It can be [0 ~ 65535] according to the 3GPP TS 36.101 + * + * @return The starting earfcn. + */ + public @IntRange(from = 0, to = 65535) int getStartEarfcn() { + return mStartEarfcn; + } + + /** + * Returns the ending earfcn value for this range. + * It can be [0 ~ 65535] according to the 3GPP TS 36.101 + * + * @return The ending earfcn. + */ + public @IntRange(from = 0, to = 65535) int getEndEarfcn() { + return mEndEarfcn; + } +} diff --git a/telephony/java/android/telephony/satellite/ISatelliteCommunicationAllowedStateCallback.aidl b/telephony/java/android/telephony/satellite/ISatelliteCommunicationAllowedStateCallback.aidl index a7eda482cb76..2730f90c4e5e 100644 --- a/telephony/java/android/telephony/satellite/ISatelliteCommunicationAllowedStateCallback.aidl +++ b/telephony/java/android/telephony/satellite/ISatelliteCommunicationAllowedStateCallback.aidl @@ -16,6 +16,8 @@ package android.telephony.satellite; +import android.telephony.satellite.SatelliteAccessConfiguration; + /** * Interface for satellite communication allowed state callback. * @hide @@ -29,4 +31,14 @@ oneway interface ISatelliteCommunicationAllowedStateCallback { * @param allowed whether satellite communication state or not */ void onSatelliteCommunicationAllowedStateChanged(in boolean isAllowed); + + /** + * Callback method invoked when the satellite access configuration changes + * + * @param The satellite access configuration associated with the current location. + * When satellite is not allowed at the current location, + * {@code satelliteRegionalConfiguration} will be null. + */ + void onSatelliteAccessConfigurationChanged(in SatelliteAccessConfiguration + satelliteAccessConfiguration); } diff --git a/telephony/java/android/telephony/satellite/SatelliteAccessConfiguration.aidl b/telephony/java/android/telephony/satellite/SatelliteAccessConfiguration.aidl new file mode 100644 index 000000000000..0214193a654f --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatelliteAccessConfiguration.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 SatelliteAccessConfiguration;
\ No newline at end of file diff --git a/telephony/java/android/telephony/satellite/SatelliteAccessConfiguration.java b/telephony/java/android/telephony/satellite/SatelliteAccessConfiguration.java new file mode 100644 index 000000000000..c3ae70b48854 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatelliteAccessConfiguration.java @@ -0,0 +1,122 @@ +/* + * 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.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; + +import com.android.internal.telephony.flags.Flags; + +import java.util.List; + +/** + * SatelliteAccessConfiguration is used to store satellite access configuration + * that will be applied to the satellite communication at the corresponding region. + * + * @hide + */ +@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) +public final class SatelliteAccessConfiguration implements Parcelable { + /** + * The list of satellites available at the current location. + */ + @NonNull + private List<SatelliteInfo> mSatelliteInfoList; + + /** + * The list of tag IDs associated with the current location + */ + @NonNull + private int[] mTagIds; + + /** + * Constructor for {@link SatelliteAccessConfiguration}. + * + * @param satelliteInfos The list of {@link SatelliteInfo} objects representing the satellites + * accessible with this configuration. + * @param tagIds The list of tag IDs associated with this configuration. + */ + public SatelliteAccessConfiguration(@NonNull List<SatelliteInfo> satelliteInfos, + @NonNull int[] tagIds) { + mSatelliteInfoList = satelliteInfos; + mTagIds = tagIds; + } + + public SatelliteAccessConfiguration(Parcel in) { + mSatelliteInfoList = in.createTypedArrayList(SatelliteInfo.CREATOR); + mTagIds = new int[in.readInt()]; + in.readIntArray(mTagIds); + } + + public static final Creator<SatelliteAccessConfiguration> CREATOR = + new Creator<SatelliteAccessConfiguration>() { + @Override + public SatelliteAccessConfiguration createFromParcel(Parcel in) { + return new SatelliteAccessConfiguration(in); + } + + @Override + public SatelliteAccessConfiguration[] newArray(int size) { + return new SatelliteAccessConfiguration[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + /** + * @param dest The Parcel in which the object should be written. + * @param flags Additional flags about how the object should be written. + * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. + */ + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeTypedList(mSatelliteInfoList); + if (mTagIds != null && mTagIds.length > 0) { + dest.writeInt(mTagIds.length); + dest.writeIntArray(mTagIds); + } else { + dest.writeInt(0); + } + } + + /** + * Returns a list of {@link SatelliteInfo} objects representing the satellites + * associated with this object. + * + * @return The list of {@link SatelliteInfo} objects. + */ + @NonNull + public List<SatelliteInfo> getSatelliteInfos() { + return mSatelliteInfoList; + } + + /** + * Returns a list of tag IDs associated with this object. + * + * @return The list of tag IDs. + */ + @NonNull + public int[] getTagIds() { + return mTagIds; + } +} diff --git a/telephony/java/android/telephony/satellite/SatelliteCommunicationAllowedStateCallback.java b/telephony/java/android/telephony/satellite/SatelliteCommunicationAllowedStateCallback.java index 1a870202d096..bffb11f23d56 100644 --- a/telephony/java/android/telephony/satellite/SatelliteCommunicationAllowedStateCallback.java +++ b/telephony/java/android/telephony/satellite/SatelliteCommunicationAllowedStateCallback.java @@ -17,6 +17,7 @@ package android.telephony.satellite; import android.annotation.FlaggedApi; +import android.annotation.Nullable; import com.android.internal.telephony.flags.Flags; @@ -40,4 +41,17 @@ public interface SatelliteCommunicationAllowedStateCallback { */ @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) void onSatelliteCommunicationAllowedStateChanged(boolean isAllowed); + + /** + * Callback method invoked when the satellite access configuration changes + * + * @param satelliteAccessConfiguration The satellite access configuration associated with + * the current location. When satellite is not allowed at + * the current location, + * {@code satelliteRegionalConfiguration} will be null. + * @hide + */ + @FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) + default void onSatelliteAccessConfigurationChanged( + @Nullable SatelliteAccessConfiguration satelliteAccessConfiguration) {}; } diff --git a/telephony/java/android/telephony/satellite/SatelliteInfo.aidl b/telephony/java/android/telephony/satellite/SatelliteInfo.aidl new file mode 100644 index 000000000000..fc2303b080a5 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatelliteInfo.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 SatelliteInfo;
\ No newline at end of file diff --git a/telephony/java/android/telephony/satellite/SatelliteInfo.java b/telephony/java/android/telephony/satellite/SatelliteInfo.java new file mode 100644 index 000000000000..bca907e49993 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatelliteInfo.java @@ -0,0 +1,169 @@ +/* + * 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.os.Parcel; +import android.os.ParcelUuid; +import android.os.Parcelable; + +import androidx.annotation.NonNull; + +import com.android.internal.telephony.flags.Flags; + +import java.util.List; +import java.util.UUID; + +/** + * SatelliteInfo stores a satellite's identification, position, and frequency information + * facilitating efficient satellite communications. + * + * @hide + */ +@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) +public class SatelliteInfo implements Parcelable { + /** + * Unique identification number for the satellite. + * This ID is used to distinguish between different satellites in the network. + */ + @NonNull + private UUID mId; + + /** + * Position information of a satellite. + * This includes the longitude and altitude of the satellite. + */ + private SatellitePosition mPosition; + + /** + * 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. + */ + private int[] mBands; + + /** + * EARFCN (E-UTRA Absolute Radio Frequency Channel Number) Ranges + * The supported frequency range list. + * Maximum length of the vector is 8. + */ + private final List<EarfcnRange> mEarfcnRangeList; + + protected SatelliteInfo(Parcel in) { + ParcelUuid parcelUuid = in.readParcelable( + ParcelUuid.class.getClassLoader(), ParcelUuid.class); + if (parcelUuid != null) { + mId = parcelUuid.getUuid(); + } + mPosition = in.readParcelable(SatellitePosition.class.getClassLoader(), + SatellitePosition.class); + int numBands = in.readInt(); + mBands = new int[numBands]; + if (numBands > 0) { + for (int i = 0; i < numBands; i++) { + mBands[i] = in.readInt(); + } + } + mEarfcnRangeList = in.createTypedArrayList(EarfcnRange.CREATOR); + } + + /** + * Constructor for {@link SatelliteInfo}. + * + * @param satelliteId The ID of the satellite. + * @param satellitePosition The {@link SatellitePosition} of the satellite. + * @param bands The list of frequency bands supported by the satellite. + * @param earfcnRanges The list of {@link EarfcnRange} objects representing the EARFCN + * ranges supported by the satellite. + */ + public SatelliteInfo(@NonNull UUID satelliteId, @NonNull SatellitePosition satellitePosition, + @NonNull int[] bands, @NonNull List<EarfcnRange> earfcnRanges) { + mId = satelliteId; + mPosition = satellitePosition; + mBands = bands; + mEarfcnRangeList = earfcnRanges; + } + + public static final Creator<SatelliteInfo> CREATOR = new Creator<SatelliteInfo>() { + @Override + public SatelliteInfo createFromParcel(Parcel in) { + return new SatelliteInfo(in); + } + + @Override + public SatelliteInfo[] newArray(int size) { + return new SatelliteInfo[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeParcelable(new ParcelUuid(mId), flags); + dest.writeParcelable(mPosition, flags); + if (mBands != null && mBands.length > 0) { + dest.writeInt(mBands.length); + dest.writeIntArray(mBands); + } else { + dest.writeInt(0); + } + dest.writeTypedList(mEarfcnRangeList); + } + + /** + * Returns the ID of the satellite. + * + * @return The satellite ID. + */ + @NonNull + public UUID getSatelliteId() { + return mId; + } + + /** + * Returns the position of the satellite. + * + * @return The {@link SatellitePosition} of the satellite. + */ + public SatellitePosition getSatellitePosition() { + return mPosition; + } + + /** + * Returns the list of frequency bands supported by the satellite. + * + * @return The list of frequency bands. + */ + @NonNull + public int[] getBands() { + return mBands; + } + + /** + * Returns the list of EARFCN ranges supported by the satellite. + * + * @return The list of {@link EarfcnRange} objects. + */ + @NonNull + public List<EarfcnRange> getEarfcnRanges() { + return mEarfcnRangeList; + } +} diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java index 88dddcfc9180..7e3d99a5c4ac 100644 --- a/telephony/java/android/telephony/satellite/SatelliteManager.java +++ b/telephony/java/android/telephony/satellite/SatelliteManager.java @@ -36,6 +36,7 @@ import android.os.ICancellationSignal; import android.os.OutcomeReceiver; import android.os.RemoteException; import android.os.ResultReceiver; +import android.telephony.CarrierConfigManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyCallback; import android.telephony.TelephonyFrameworkInitializer; @@ -272,6 +273,14 @@ public final class SatelliteManager { public static final String KEY_DEPROVISION_SATELLITE_TOKENS = "deprovision_satellite"; /** + * Bundle key to get the response from + * {@link #requestSatelliteAccessConfigurationForCurrentLocation(Executor, OutcomeReceiver)}. + * @hide + */ + public static final String KEY_SATELLITE_ACCESS_CONFIGURATION = + "satellite_access_configuration"; + + /** * The request was successfully processed. * @hide */ @@ -2332,6 +2341,68 @@ public final class SatelliteManager { } /** + * Request to get satellite access configuration for the current location. + * + * @param executor The executor on which the callback will be called. + * @param callback The callback object to which the result will be delivered. + * If the request is successful, {@link OutcomeReceiver#onResult(Object)} + * will return a {@code SatelliteAccessConfiguration} with value the regional + * satellite access configuration at the current location. + * If the request is not successful, {@link OutcomeReceiver#onError(Throwable)} + * will return a {@link SatelliteException} with the {@link SatelliteResult}. + * + * @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 requestSatelliteAccessConfigurationForCurrentLocation( + @NonNull @CallbackExecutor Executor executor, + @NonNull OutcomeReceiver<SatelliteAccessConfiguration, SatelliteException> callback) { + 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_SATELLITE_ACCESS_CONFIGURATION)) { + SatelliteAccessConfiguration satelliteAccessConfiguration = + resultData.getParcelable(KEY_SATELLITE_ACCESS_CONFIGURATION, + SatelliteAccessConfiguration.class); + executor.execute(() -> Binder.withCleanCallingIdentity(() -> + callback.onResult(satelliteAccessConfiguration))); + } else { + loge("KEY_SATELLITE_ACCESS_CONFIGURATION 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.requestSatelliteAccessConfigurationForCurrentLocation(receiver); + } else { + loge("requestSatelliteAccessConfigurationForCurrentLocation() invalid telephony"); + executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError( + new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE)))); + } + } catch (RemoteException ex) { + loge("requestSatelliteAccessConfigurationForCurrentLocation() RemoteException: " + + ex); + executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError( + new SatelliteException(SATELLITE_RESULT_ILLEGAL_STATE)))); + } + } + + /** * Request to get the duration in seconds after which the satellite will be visible. * This will be {@link Duration#ZERO} if the satellite is currently visible. * @@ -2436,7 +2507,7 @@ public final class SatelliteManager { * <li>There is no satellite communication restriction, which is added by * {@link #addAttachRestrictionForCarrier(int, int, Executor, Consumer)}</li> * <li>The carrier config {@link - * android.telephony.CarrierConfigManager#KEY_SATELLITE_ATTACH_SUPPORTED_BOOL} is set to + * CarrierConfigManager#KEY_SATELLITE_ATTACH_SUPPORTED_BOOL} is set to * {@code true}.</li> * </ul> * @@ -2759,7 +2830,7 @@ public final class SatelliteManager { * <p> * Note: This API is specifically designed for OEM enabled satellite connectivity only. * For satellite connectivity enabled using carrier roaming, please refer to - * {@link android.telephony.TelephonyCallback.SignalStrengthsListener}, and + * {@link TelephonyCallback.SignalStrengthsListener}, and * {@link TelephonyManager#registerTelephonyCallback(Executor, TelephonyCallback)}. * </p> * @@ -2830,7 +2901,7 @@ public final class SatelliteManager { * <p> * Note: This API is specifically designed for OEM enabled satellite connectivity only. * For satellite connectivity enabled using carrier roaming, please refer to - * {@link android.telephony.TelephonyCallback.SignalStrengthsListener}, and + * {@link TelephonyCallback.SignalStrengthsListener}, and * {@link TelephonyManager#registerTelephonyCallback(Executor, TelephonyCallback)}. * </p> * @@ -3147,6 +3218,15 @@ public final class SatelliteManager { () -> callback.onSatelliteCommunicationAllowedStateChanged( isAllowed))); } + + @Override + public void onSatelliteAccessConfigurationChanged( + @Nullable SatelliteAccessConfiguration + satelliteAccessConfiguration) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> callback.onSatelliteAccessConfigurationChanged( + satelliteAccessConfiguration))); + } }; sSatelliteCommunicationAllowedStateCallbackMap.put(callback, internalCallback); return telephony.registerForCommunicationAllowedStateChanged( diff --git a/telephony/java/android/telephony/satellite/SatellitePosition.aidl b/telephony/java/android/telephony/satellite/SatellitePosition.aidl new file mode 100644 index 000000000000..a8028eb48ee7 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatellitePosition.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 SatellitePosition;
\ No newline at end of file diff --git a/telephony/java/android/telephony/satellite/SatellitePosition.java b/telephony/java/android/telephony/satellite/SatellitePosition.java new file mode 100644 index 000000000000..1e8c0180f456 --- /dev/null +++ b/telephony/java/android/telephony/satellite/SatellitePosition.java @@ -0,0 +1,114 @@ +/* + * 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.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; + +import com.android.internal.telephony.flags.Flags; + +/** + * The position of a satellite in Earth orbit. + * + * Longitude is the angular distance, measured in degrees, east or west of the prime longitude line + * ranging from -180 to 180 degrees + * Altitude is the distance from the center of the Earth to the satellite, measured in kilometers + * + * @hide + */ +@FlaggedApi(Flags.FLAG_CARRIER_ROAMING_NB_IOT_NTN) +public class SatellitePosition implements Parcelable { + + /** + * The longitude of the satellite in degrees, ranging from -180 to 180 degrees + */ + private double mLongitudeDegree; + + /** + * The distance from the center of the earth to the satellite, measured in kilometers + */ + private double mAltitudeKm; + + /** + * Constructor for {@link SatellitePosition} used to create an instance from a {@link Parcel}. + * + * @param in The {@link Parcel} to read the satellite position data from. + */ + public SatellitePosition(Parcel in) { + mLongitudeDegree = in.readDouble(); + mAltitudeKm = in.readDouble(); + } + + /** + * Constructor for {@link SatellitePosition}. + * + * @param longitudeDegree The longitude of the satellite in degrees. + * @param altitudeKm The altitude of the satellite in kilometers. + */ + public SatellitePosition(double longitudeDegree, double altitudeKm) { + mLongitudeDegree = longitudeDegree; + mAltitudeKm = altitudeKm; + } + + public static final Creator<SatellitePosition> CREATOR = new Creator<SatellitePosition>() { + @Override + public SatellitePosition createFromParcel(Parcel in) { + return new SatellitePosition(in); + } + + @Override + public SatellitePosition[] newArray(int size) { + return new SatellitePosition[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + /** + * @param dest The Parcel in which the object should be written. + * @param flags Additional flags about how the object should be written. + * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. + */ + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeDouble(mLongitudeDegree); + dest.writeDouble(mAltitudeKm); + } + + /** + * Returns the longitude of the satellite in degrees, ranging from -180 to 180 degrees. + * + * @return The longitude of the satellite. + */ + public double getLongitudeDegrees() { + return mLongitudeDegree; + } + + /** + * Returns the altitude of the satellite in kilometers + * + * @return The altitude of the satellite. + */ + public double getAltitudeKm() { + return mAltitudeKm; + } +} diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 544bfabcf20b..210200be4cf3 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -2999,6 +2999,16 @@ interface ITelephony { void requestIsCommunicationAllowedForCurrentLocation(int subId, in ResultReceiver receiver); /** + * Request to get satellite access configuration for the current location. + * + * @param receiver Result receiver to get the error code of the request + * and satellite access configuration for the current location. + */ + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + + "android.Manifest.permission.SATELLITE_COMMUNICATION)") + void requestSatelliteAccessConfigurationForCurrentLocation(in ResultReceiver receiver); + + /** * Request to get the time after which the satellite will be visible. * * @param receiver Result receiver to get the error code of the request and the requested |