Merge "Fix the incorrect type signature requestSatelliteConfigurationForCurrentLocation" into main
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteInfoWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteInfoWrapper.java
index eb40593..bdbb379 100644
--- a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteInfoWrapper.java
+++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteInfoWrapper.java
@@ -16,7 +16,6 @@
package android.telephony.satellite.wrapper;
-import android.annotation.FlaggedApi;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.ParcelUuid;
@@ -24,8 +23,6 @@
import androidx.annotation.NonNull;
-import com.android.internal.telephony.flags.Flags;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -46,10 +43,12 @@
private UUID mId;
/**
- * Position information of a satellite.
+ * Position information of a geostationary satellite.
* This includes the longitude and altitude of the satellite.
+ * If the SatellitePosition is invalid,
+ * longitudeDegree and altitudeKm will be represented as DOUBLE.NaN.
*/
- @Nullable
+ @NonNull
private SatellitePositionWrapper mPosition;
/**
@@ -89,7 +88,7 @@
* EARFCN ranges supported by the satellite.
*/
public SatelliteInfoWrapper(@NonNull UUID satelliteId,
- @Nullable SatellitePositionWrapper satellitePosition,
+ @NonNull SatellitePositionWrapper satellitePosition,
@NonNull List<Integer> bandList, @NonNull List<EarfcnRangeWrapper> earfcnRanges) {
mId = satelliteId;
mPosition = satellitePosition;
@@ -136,10 +135,9 @@
/**
* Returns the position of the satellite.
*
- * @return The {@link SatellitePositionWrapper} of the satellite, or {@code null} if the
- * position is not available.
+ * @return The {@link SatellitePositionWrapper} of the satellite.
*/
- @Nullable
+ @NonNull
public SatellitePositionWrapper getSatellitePosition() {
return mPosition;
}
diff --git a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java
index 5169426..2019eb1 100644
--- a/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java
+++ b/satellite_client/src/android/telephony/satellite/wrapper/SatelliteManagerWrapper.java
@@ -66,14 +66,12 @@
import java.lang.reflect.Method;
import java.time.Duration;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
@@ -1312,12 +1310,12 @@
executor, internalCallback);
}
- /** Request to get satellite configuration for the current location. */
- public void requestSatelliteConfigurationForCurrentLocation(
+ /** Request to get satellite access configuration for the current location. */
+ public void requestSatelliteAccessConfigurationForCurrentLocation(
@NonNull @CallbackExecutor Executor executor,
- @NonNull OutcomeReceiver<Boolean, SatelliteExceptionWrapper> callback) {
+ @NonNull OutcomeReceiver<SatelliteAccessConfigurationWrapper, SatelliteExceptionWrapper> callback) {
if (mSatelliteManager == null) {
- logd("requestSatelliteConfigurationForCurrentLocation: mSatelliteManager is null");
+ logd("requestSatelliteAccessConfigurationForCurrentLocation: mSatelliteManager is null");
executor.execute(() -> Binder.withCleanCallingIdentity(() -> callback.onError(
new SatelliteExceptionWrapper(
SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED))));
@@ -1325,10 +1323,12 @@
}
OutcomeReceiver internalCallback =
- new OutcomeReceiver<Boolean, SatelliteException>() {
+ new OutcomeReceiver<SatelliteAccessConfiguration, SatelliteException>() {
@Override
- public void onResult(Boolean result) {
- callback.onResult(result);
+ public void onResult(SatelliteAccessConfiguration result) {
+ callback.onResult(new SatelliteAccessConfigurationWrapper(
+ getSatelliteInfoListWrapper(result.getSatelliteInfos()),
+ result.getTagIds()));
}
@Override
@@ -1336,6 +1336,7 @@
callback.onError(new SatelliteExceptionWrapper(exception.getErrorCode()));
}
};
+
mSatelliteManager.requestSatelliteAccessConfigurationForCurrentLocation(executor,
internalCallback);
}
@@ -1971,23 +1972,24 @@
return result;
}
- private List<SatelliteInfoWrapper> getSatelliteInfoListWrapper(
+ @NonNull
+ private List<SatelliteInfoWrapper> getSatelliteInfoListWrapper(@NonNull
List<SatelliteInfo> satelliteInfoList) {
List<SatelliteInfoWrapper> satelliteInfoWrapperList = new ArrayList<>();
+
for (SatelliteInfo info : satelliteInfoList) {
- SatellitePositionWrapper satellitePositionWrapperWrapper = null;
- if (info.getSatellitePosition() != null) {
- satellitePositionWrapperWrapper = new SatellitePositionWrapper(
+ SatellitePositionWrapper satellitePositionWrapper = new SatellitePositionWrapper(
info.getSatellitePosition().getLongitudeDegrees(),
info.getSatellitePosition().getAltitudeKm());
- }
+
List<EarfcnRangeWrapper> earfcnRangeWrapperList = new ArrayList<>();
for (EarfcnRange range : info.getEarfcnRanges()) {
earfcnRangeWrapperList.add(new EarfcnRangeWrapper(
range.getStartEarfcn(), range.getEndEarfcn()));
}
+
SatelliteInfoWrapper satelliteInfoWrapper = new SatelliteInfoWrapper(
- info.getSatelliteId(), satellitePositionWrapperWrapper,
+ info.getSatelliteId(), satellitePositionWrapper,
info.getBands(), earfcnRangeWrapperList);
satelliteInfoWrapperList.add(satelliteInfoWrapper);