summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sewook Seo <sewookseo@google.com> 2024-02-22 20:18:04 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-02-22 20:18:04 +0000
commit1176b9ba9e4a83abf89d5ce13e1cadecf63afaaf (patch)
tree6d8bf2ca2188ee0d0b4544158273ca84c15fe178
parente184c47d11cad2763e1c8d4b6a44cbf331b79120 (diff)
parent4acbe2954fa3796848fed753ff6597ee9daee158 (diff)
Merge "Adding QNS API reconnectQualifiedNetworkType" into main
-rw-r--r--telephony/java/android/telephony/data/IQualifiedNetworksServiceCallback.aidl1
-rw-r--r--telephony/java/android/telephony/data/QualifiedNetworksService.java57
2 files changed, 56 insertions, 2 deletions
diff --git a/telephony/java/android/telephony/data/IQualifiedNetworksServiceCallback.aidl b/telephony/java/android/telephony/data/IQualifiedNetworksServiceCallback.aidl
index bdd212afd4b0..e69b60b3a37c 100644
--- a/telephony/java/android/telephony/data/IQualifiedNetworksServiceCallback.aidl
+++ b/telephony/java/android/telephony/data/IQualifiedNetworksServiceCallback.aidl
@@ -26,4 +26,5 @@ oneway interface IQualifiedNetworksServiceCallback
{
void onQualifiedNetworkTypesChanged(int apnTypes, in int[] qualifiedNetworkTypes);
void onNetworkValidationRequested(int networkCapability, IIntegerConsumer callback);
+ void onReconnectQualifedNetworkType(int apnTypes, int qualifiedNetworkType);
}
diff --git a/telephony/java/android/telephony/data/QualifiedNetworksService.java b/telephony/java/android/telephony/data/QualifiedNetworksService.java
index c3ba09248298..7bfe04d025c8 100644
--- a/telephony/java/android/telephony/data/QualifiedNetworksService.java
+++ b/telephony/java/android/telephony/data/QualifiedNetworksService.java
@@ -33,6 +33,7 @@ import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.Annotation.ApnType;
import android.telephony.Annotation.NetCapability;
import android.telephony.PreciseDataConnectionState;
+import android.telephony.TelephonyManager;
import android.util.Log;
import android.util.SparseArray;
@@ -82,6 +83,7 @@ public abstract class QualifiedNetworksService extends Service {
private static final int QNS_APN_THROTTLE_STATUS_CHANGED = 5;
private static final int QNS_EMERGENCY_DATA_NETWORK_PREFERRED_TRANSPORT_CHANGED = 6;
private static final int QNS_REQUEST_NETWORK_VALIDATION = 7;
+ private static final int QNS_RECONNECT_QUALIFIED_NETWORK = 8;
/** Feature flags */
private static final FeatureFlags sFeatureFlag = new FeatureFlagsImpl();
@@ -186,8 +188,42 @@ public abstract class QualifiedNetworksService extends Service {
qualifiedNetworkTypesArray).sendToTarget();
}
- private void onUpdateQualifiedNetworkTypes(@ApnType int apnTypes,
- int[] qualifiedNetworkTypes) {
+ /**
+ * Request to make a clean initial connection instead of handover to a transport type mapped
+ * to the {@code qualifiedNetworkType} for the {@code apnTypes}. This will update the
+ * preferred network type like {@link #updateQualifiedNetworkTypes(int, List)}, however if
+ * the data network for the {@code apnTypes} is not in the state {@link TelephonyManager
+ * #DATA_CONNECTED} or it's already connected on the transport type mapped to the
+ * qualified network type, forced reconnection will be ignored.
+ *
+ * <p>This will tear down current data network even though target transport type mapped to
+ * the {@code qualifiedNetworkType} is not available, and the data network will be connected
+ * to the transport type when it becomes available.
+ *
+ * <p>This is one shot request and does not mean further handover is not allowed to the
+ * qualified network type for this APN type.
+ *
+ * @param apnTypes APN type(s) of the qualified networks. This must be a bitmask combination
+ * of {@link ApnType}. The same qualified networks will be applicable to all APN types
+ * specified here.
+ * @param qualifiedNetworkType Access network types which are qualified for data connection
+ * setup for {@link ApnType}. Empty list means QNS has no suggestion to the frameworks, and
+ * for that APN type frameworks will route the corresponding network requests to
+ * {@link AccessNetworkConstants#TRANSPORT_TYPE_WWAN}.
+ *
+ * <p> If one of the element is invalid, for example, {@link AccessNetworkType#UNKNOWN},
+ * then this operation becomes a no-op.
+ *
+ * @hide
+ */
+ public final void reconnectQualifiedNetworkType(@ApnType int apnTypes,
+ @AccessNetworkConstants.RadioAccessNetworkType int qualifiedNetworkType) {
+ mHandler.obtainMessage(QNS_RECONNECT_QUALIFIED_NETWORK, mSlotIndex, apnTypes,
+ new Integer(qualifiedNetworkType)).sendToTarget();
+ }
+
+ private void onUpdateQualifiedNetworkTypes(
+ @ApnType int apnTypes, int[] qualifiedNetworkTypes) {
mQualifiedNetworkTypesList.put(apnTypes, qualifiedNetworkTypes);
if (mCallback != null) {
try {
@@ -198,6 +234,17 @@ public abstract class QualifiedNetworksService extends Service {
}
}
+ private void onReconnectQualifiedNetworkType(@ApnType int apnTypes,
+ @AccessNetworkConstants.RadioAccessNetworkType int qualifiedNetworkType) {
+ if (mCallback != null) {
+ try {
+ mCallback.onReconnectQualifedNetworkType(apnTypes, qualifiedNetworkType);
+ } catch (RemoteException e) {
+ loge("Failed to call onReconnectQualifiedNetworkType. " + e);
+ }
+ }
+ }
+
/**
* The framework calls this method when the throttle status of an APN changes.
*
@@ -366,6 +413,12 @@ public abstract class QualifiedNetworksService extends Service {
case QNS_REQUEST_NETWORK_VALIDATION:
if (provider == null) break;
provider.onRequestNetworkValidation((NetworkValidationRequestData) message.obj);
+ break;
+
+ case QNS_RECONNECT_QUALIFIED_NETWORK:
+ if (provider == null) break;
+ provider.onReconnectQualifiedNetworkType(message.arg2, (Integer) message.obj);
+ break;
}
}
}