Merge "Support SUPL over satellite" into 24D1-dev am: 091bf9f7aa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/27007616
Change-Id: I918f81705598d172b0a7d0c98c0722a61a98e81d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java b/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java
index 32a0ef4..8002300 100644
--- a/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java
+++ b/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java
@@ -18,6 +18,7 @@
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED;
+import android.annotation.RequiresPermission;
import android.content.Context;
import android.location.flags.Flags;
import android.net.ConnectivityManager;
@@ -32,6 +33,7 @@
import android.os.PowerManager;
import android.telephony.PhoneStateListener;
import android.telephony.PreciseCallState;
+import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -572,6 +574,10 @@
}
}
+ @RequiresPermission(allOf = {
+ android.Manifest.permission.ACCESS_COARSE_LOCATION,
+ android.Manifest.permission.READ_PHONE_STATE
+ })
private void handleRequestSuplConnection(int agpsType, byte[] suplIpAddr) {
mAGpsDataConnectionIpAddr = null;
mAGpsType = agpsType;
@@ -605,6 +611,19 @@
NetworkRequest.Builder networkRequestBuilder = new NetworkRequest.Builder();
networkRequestBuilder.addCapability(getNetworkCapability(mAGpsType));
networkRequestBuilder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
+
+ if (com.android.internal.telephony.flags.Flags.satelliteInternet()) {
+ // Add transport type NetworkCapabilities.TRANSPORT_SATELLITE on satellite network.
+ TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+ if (telephonyManager != null) {
+ ServiceState state = telephonyManager.getServiceState();
+ if (state != null && state.isUsingNonTerrestrialNetwork()) {
+ networkRequestBuilder.removeCapability(NET_CAPABILITY_NOT_RESTRICTED);
+ networkRequestBuilder.addTransportType(NetworkCapabilities.TRANSPORT_SATELLITE);
+ }
+ }
+ }
+
// During an emergency call, and when we have cached the Active Sub Id, we set the
// Network Specifier so that the network request goes to the correct Sub Id
if (mNiHandler.getInEmergency() && mActiveSubId >= 0) {