summaryrefslogtreecommitdiff
path: root/telephony/java
diff options
context:
space:
mode:
authorDaniel Bright <dbright@google.com>2020-11-11 18:48:14 -0800
committerDaniel Bright <dbright@google.com>2021-01-05 11:36:34 -0800
commitf2f714a0dc55291acbba3894353b105d08b05ec3 (patch)
tree4d180990618712fe01cfb78ea3e6c7819dfb9d52 /telephony/java
parent133b7dc7596fb2fd0be7893eb0b4a8ba402ea78b (diff)
Add apn throttle status notifications to QNS
* Added wiring for the apn unthrottled indication * Added method to QNS that is notified when there is a change to the way an APN is throttled. Test: Ran telephony tests Test: Booted up device Test: Checked for log message in NetworkAvailabilityProvider#onReportApnThrottleStatusChanged Bug: 167434852 Bug: 174850845 Merged-In: Ia4dd3036f583a97e42b6054019005df1b33dc33c Change-Id: Ia4dd3036f583a97e42b6054019005df1b33dc33c
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/data/ApnThrottleStatus.aidl20
-rw-r--r--telephony/java/android/telephony/data/ApnThrottleStatus.java383
-rw-r--r--telephony/java/android/telephony/data/DataService.java83
-rw-r--r--telephony/java/android/telephony/data/DataServiceCallback.java20
-rw-r--r--telephony/java/android/telephony/data/IDataService.aidl2
-rw-r--r--telephony/java/android/telephony/data/IDataServiceCallback.aidl1
-rw-r--r--telephony/java/android/telephony/data/IQualifiedNetworksService.aidl2
-rw-r--r--telephony/java/android/telephony/data/QualifiedNetworksService.java26
-rw-r--r--telephony/java/com/android/internal/telephony/DctConstants.java1
9 files changed, 537 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/data/ApnThrottleStatus.aidl b/telephony/java/android/telephony/data/ApnThrottleStatus.aidl
new file mode 100644
index 000000000000..46bc4abde159
--- /dev/null
+++ b/telephony/java/android/telephony/data/ApnThrottleStatus.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2020 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.
+ */
+
+/** @hide */
+package android.telephony.data;
+
+parcelable ApnThrottleStatus;
diff --git a/telephony/java/android/telephony/data/ApnThrottleStatus.java b/telephony/java/android/telephony/data/ApnThrottleStatus.java
new file mode 100644
index 000000000000..51461d17690a
--- /dev/null
+++ b/telephony/java/android/telephony/data/ApnThrottleStatus.java
@@ -0,0 +1,383 @@
+/*
+ * Copyright (C) 2020 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.data;
+
+import android.annotation.ElapsedRealtimeLong;
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.SuppressLint;
+import android.annotation.SystemApi;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.os.SystemClock;
+import android.telephony.AccessNetworkConstants;
+import android.telephony.Annotation;
+
+import java.util.Objects;
+
+/**
+ * Status information regarding the throttle status of an APN type.
+ *
+ * @hide
+ */
+@SystemApi
+public final class ApnThrottleStatus implements Parcelable {
+ /**
+ * The APN type is not throttled.
+ */
+ public static final int THROTTLE_TYPE_NONE = 1;
+
+ /**
+ * The APN type is throttled until {@link android.os.SystemClock#elapsedRealtime()}
+ * has reached {@link ApnThrottleStatus#getThrottleExpiryTimeMillis}
+ */
+ public static final int THROTTLE_TYPE_ELAPSED_TIME = 2;
+
+ /** {@hide} */
+ @IntDef(flag = true, prefix = {"THROTTLE_TYPE_"}, value = {
+ ApnThrottleStatus.THROTTLE_TYPE_NONE,
+ ApnThrottleStatus.THROTTLE_TYPE_ELAPSED_TIME,
+ })
+ public @interface ThrottleType {
+ }
+
+ /**
+ * The framework will not retry the APN type.
+ */
+ public static final int RETRY_TYPE_NONE = 1;
+
+ /**
+ * The next time the framework retries, it will attempt to establish a new connection.
+ */
+ public static final int RETRY_TYPE_NEW_CONNECTION = 2;
+
+ /**
+ * The next time the framework retires, it will retry to handover.
+ */
+ public static final int RETRY_TYPE_HANDOVER = 3;
+
+ /** {@hide} */
+ @IntDef(flag = true, prefix = {"RETRY_TYPE_"}, value = {
+ ApnThrottleStatus.RETRY_TYPE_NONE,
+ ApnThrottleStatus.RETRY_TYPE_NEW_CONNECTION,
+ ApnThrottleStatus.RETRY_TYPE_HANDOVER,
+ })
+ public @interface RetryType {
+ }
+
+ private final int mSlotIndex;
+ private final @AccessNetworkConstants.TransportType int mTransportType;
+ private final @Annotation.ApnType int mApnType;
+ private final long mThrottleExpiryTimeMillis;
+ private final @RetryType int mRetryType;
+ private final @ThrottleType int mThrottleType;
+
+ /**
+ * The slot index that the status applies to.
+ *
+ * @return the slot index
+ */
+ public int getSlotIndex() {
+ return mSlotIndex;
+ }
+
+ /**
+ * The type of transport that the status applies to.
+ *
+ * @return the transport type
+ */
+ @AccessNetworkConstants.TransportType
+ public int getTransportType() {
+ return mTransportType;
+ }
+
+ /**
+ * The APN type that the status applies to.
+ *
+ * @return the apn type
+ */
+ @Annotation.ApnType
+ public int getApnType() {
+ return mApnType;
+ }
+
+ /**
+ * The type of throttle applied to the APN type.
+ *
+ * @return the throttle type
+ */
+ @ThrottleType
+ public int getThrottleType() {
+ return mThrottleType;
+ }
+
+ /**
+ * Indicates the type of request that the framework will make the next time it retries
+ * to call {@link IDataService#setupDataCall}.
+ *
+ * @return the retry type
+ */
+ @RetryType
+ public int getRetryType() {
+ return mRetryType;
+ }
+
+ /**
+ * Gets the time at which the throttle expires. The value is based off of
+ * {@link SystemClock#elapsedRealtime}.
+ *
+ * This value only applies when the throttle type is set to
+ * {@link ApnThrottleStatus#THROTTLE_TYPE_ELAPSED_TIME}.
+ *
+ * A value of {@link Long#MAX_VALUE} implies that the APN type is throttled indefinitely.
+ *
+ * @return the time at which the throttle expires
+ */
+ @ElapsedRealtimeLong
+ public long getThrottleExpiryTimeMillis() {
+ return mThrottleExpiryTimeMillis;
+ }
+
+ private ApnThrottleStatus(int slotIndex,
+ @AccessNetworkConstants.TransportType int transportType,
+ @Annotation.ApnType int apnTypes,
+ @ThrottleType int throttleType,
+ long throttleExpiryTimeMillis,
+ @RetryType int retryType) {
+ mSlotIndex = slotIndex;
+ mTransportType = transportType;
+ mApnType = apnTypes;
+ mThrottleType = throttleType;
+ mThrottleExpiryTimeMillis = throttleExpiryTimeMillis;
+ mRetryType = retryType;
+ }
+
+ private ApnThrottleStatus(@NonNull Parcel source) {
+ mSlotIndex = source.readInt();
+ mTransportType = source.readInt();
+ mApnType = source.readInt();
+ mThrottleExpiryTimeMillis = source.readLong();
+ mRetryType = source.readInt();
+ mThrottleType = source.readInt();
+ }
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeInt(mSlotIndex);
+ dest.writeInt(mTransportType);
+ dest.writeInt(mApnType);
+ dest.writeLong(mThrottleExpiryTimeMillis);
+ dest.writeInt(mRetryType);
+ dest.writeInt(mThrottleType);
+ }
+
+ public static final @NonNull Parcelable.Creator<ApnThrottleStatus> CREATOR =
+ new Parcelable.Creator<ApnThrottleStatus>() {
+ @Override
+ public ApnThrottleStatus createFromParcel(@NonNull Parcel source) {
+ return new ApnThrottleStatus(source);
+ }
+
+ @Override
+ public ApnThrottleStatus[] newArray(int size) {
+ return new ApnThrottleStatus[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mSlotIndex, mApnType, mRetryType, mThrottleType,
+ mThrottleExpiryTimeMillis, mTransportType);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (obj instanceof ApnThrottleStatus) {
+ ApnThrottleStatus other = (ApnThrottleStatus) obj;
+ return this.mSlotIndex == other.mSlotIndex
+ && this.mApnType == other.mApnType
+ && this.mRetryType == other.mRetryType
+ && this.mThrottleType == other.mThrottleType
+ && this.mThrottleExpiryTimeMillis == other.mThrottleExpiryTimeMillis
+ && this.mTransportType == other.mTransportType;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "ApnThrottleStatus{"
+ + "mSlotIndex=" + mSlotIndex
+ + ", mTransportType=" + mTransportType
+ + ", mApnType=" + ApnSetting.getApnTypeString(mApnType)
+ + ", mThrottleExpiryTimeMillis=" + mThrottleExpiryTimeMillis
+ + ", mRetryType=" + mRetryType
+ + ", mThrottleType=" + mThrottleType
+ + '}';
+ }
+
+ /**
+ * Provides a convenient way to set the fields of an {@link ApnThrottleStatus} when creating a
+ * new instance.
+ *
+ * <p>The example below shows how you might create a new {@code ApnThrottleStatus}:
+ *
+ * <pre><code>
+ *
+ * DataCallResponseApnThrottleStatus = new ApnThrottleStatus.Builder()
+ * .setSlotIndex(1)
+ * .setApnType({@link ApnSetting#TYPE_EMERGENCY})
+ * .setNoThrottle()
+ * .setRetryType({@link ApnThrottleStatus#RETRY_TYPE_NEW_CONNECTION})
+ * .build();
+ * </code></pre>
+ */
+ public static final class Builder {
+ private int mSlotIndex;
+ private @AccessNetworkConstants.TransportType int mTransportType;
+ private @Annotation.ApnType int mApnType;
+ private long mThrottleExpiryTimeMillis;
+ private @RetryType int mRetryType;
+ private @ThrottleType int mThrottleType;
+ public static final long NO_THROTTLE_EXPIRY_TIME =
+ DataCallResponse.RETRY_DURATION_UNDEFINED;
+
+ /**
+ * Default constructor for the Builder.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Set the slot index.
+ *
+ * @param slotIndex the slot index.
+ * @return The same instance of the builder.
+ */
+ @NonNull
+ public Builder setSlotIndex(int slotIndex) {
+ this.mSlotIndex = slotIndex;
+ return this;
+ }
+
+ /**
+ * Set the transport type.
+ *
+ * @param transportType the transport type.
+ * @return The same instance of the builder.
+ */
+ @NonNull
+ public Builder setTransportType(@AccessNetworkConstants.TransportType
+ int transportType) {
+ this.mTransportType = transportType;
+ return this;
+ }
+
+ /**
+ * Set the APN type.
+ *
+ * @param apnType the APN type.
+ * @return The same instance of the builder.
+ */
+ @NonNull
+ public Builder setApnType(@Annotation.ApnType int apnType) {
+ this.mApnType = apnType;
+ return this;
+ }
+
+ /**
+ * Sets the time at which the throttle will expire. The value is based off of
+ * {@link SystemClock#elapsedRealtime}.
+ *
+ * When setting this value, the throttle type is set to
+ * {@link ApnThrottleStatus#THROTTLE_TYPE_ELAPSED_TIME}.
+ *
+ * A value of {@link Long#MAX_VALUE} implies that the APN type is throttled indefinitely.
+ *
+ * @param throttleExpiryTimeMillis The elapsed time at which the throttle expires.
+ * Throws {@link IllegalArgumentException} for values less
+ * than 0.
+ * @return The same instance of the builder.
+ */
+ @NonNull
+ public Builder setThrottleExpiryTimeMillis(
+ @ElapsedRealtimeLong long throttleExpiryTimeMillis) {
+ if (throttleExpiryTimeMillis >= 0) {
+ this.mThrottleExpiryTimeMillis = throttleExpiryTimeMillis;
+ this.mThrottleType = THROTTLE_TYPE_ELAPSED_TIME;
+ } else {
+ throw new IllegalArgumentException("throttleExpiryTimeMillis must be greater than "
+ + "or equal to 0");
+ }
+ return this;
+ }
+
+ /**
+ * Sets the status of the APN type as not being throttled.
+ *
+ * When setting this value, the throttle type is set to
+ * {@link ApnThrottleStatus#THROTTLE_TYPE_NONE} and the expiry time is set to
+ * {@link Builder#NO_THROTTLE_EXPIRY_TIME}.
+ *
+ * @return The same instance of the builder.
+ */
+ @SuppressLint("MissingGetterMatchingBuilder")
+ @NonNull
+ public Builder setNoThrottle() {
+ mThrottleType = THROTTLE_TYPE_NONE;
+ mThrottleExpiryTimeMillis = NO_THROTTLE_EXPIRY_TIME;
+ return this;
+ }
+
+ /**
+ * Set the type of request that the framework will make the next time it retries
+ * to call {@link IDataService#setupDataCall}.
+ *
+ * @param retryType the type of request
+ * @return The same instance of the builder.
+ */
+ @NonNull
+ public Builder setRetryType(@RetryType int retryType) {
+ this.mRetryType = retryType;
+ return this;
+ }
+
+ /**
+ * Build the {@link ApnThrottleStatus}
+ *
+ * @return the {@link ApnThrottleStatus} object
+ */
+ @NonNull
+ public ApnThrottleStatus build() {
+ return new ApnThrottleStatus(
+ mSlotIndex,
+ mTransportType,
+ mApnType,
+ mThrottleType,
+ mThrottleExpiryTimeMillis,
+ mRetryType);
+ }
+ }
+}
diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java
index 77685971c138..2ec965101930 100644
--- a/telephony/java/android/telephony/data/DataService.java
+++ b/telephony/java/android/telephony/data/DataService.java
@@ -107,6 +107,9 @@ public abstract class DataService extends Service {
private static final int DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED = 11;
private static final int DATA_SERVICE_REQUEST_START_HANDOVER = 12;
private static final int DATA_SERVICE_REQUEST_CANCEL_HANDOVER = 13;
+ private static final int DATA_SERVICE_REQUEST_REGISTER_APN_UNTHROTTLED = 14;
+ private static final int DATA_SERVICE_REQUEST_UNREGISTER_APN_UNTHROTTLED = 15;
+ private static final int DATA_SERVICE_INDICATION_APN_UNTHROTTLED = 16;
private final HandlerThread mHandlerThread;
@@ -129,6 +132,8 @@ public abstract class DataService extends Service {
private final List<IDataServiceCallback> mDataCallListChangedCallbacks = new ArrayList<>();
+ private final List<IDataServiceCallback> mApnUnthrottledCallbacks = new ArrayList<>();
+
/**
* Constructor
* @param slotIndex SIM slot index the data service provider associated with.
@@ -326,6 +331,19 @@ public abstract class DataService extends Service {
}
}
+ private void registerForApnUnthrottled(IDataServiceCallback callback) {
+ synchronized (mApnUnthrottledCallbacks) {
+ mApnUnthrottledCallbacks.add(callback);
+ }
+ }
+
+ private void unregisterForApnUnthrottled(IDataServiceCallback callback) {
+ synchronized (mApnUnthrottledCallbacks) {
+ mApnUnthrottledCallbacks.remove(callback);
+ }
+ }
+
+
/**
* Notify the system that current data call list changed. Data service must invoke this
* method whenever there is any data call status changed.
@@ -343,6 +361,21 @@ public abstract class DataService extends Service {
}
/**
+ * Notify the system that a given APN was unthrottled.
+ *
+ * @param apn Access Point Name defined by the carrier.
+ */
+ public final void notifyApnUnthrottled(@NonNull String apn) {
+ synchronized (mApnUnthrottledCallbacks) {
+ for (IDataServiceCallback callback : mApnUnthrottledCallbacks) {
+ mHandler.obtainMessage(DATA_SERVICE_INDICATION_APN_UNTHROTTLED,
+ mSlotIndex, 0, new ApnUnthrottledIndication(apn,
+ callback)).sendToTarget();
+ }
+ }
+ }
+
+ /**
* Called when the instance of data service is destroyed (e.g. got unbind or binder died)
* or when the data service provider is removed. The extended class should implement this
* method to perform cleanup works.
@@ -429,6 +462,16 @@ public abstract class DataService extends Service {
}
}
+ private static final class ApnUnthrottledIndication {
+ public final String apn;
+ public final IDataServiceCallback callback;
+ ApnUnthrottledIndication(String apn,
+ IDataServiceCallback callback) {
+ this.apn = apn;
+ this.callback = callback;
+ }
+ }
+
private class DataServiceHandler extends Handler {
DataServiceHandler(Looper looper) {
@@ -544,6 +587,26 @@ public abstract class DataService extends Service {
(cReq.callback != null)
? new DataServiceCallback(cReq.callback) : null);
break;
+ case DATA_SERVICE_REQUEST_REGISTER_APN_UNTHROTTLED:
+ if (serviceProvider == null) break;
+ serviceProvider.registerForApnUnthrottled((IDataServiceCallback) message.obj);
+ break;
+ case DATA_SERVICE_REQUEST_UNREGISTER_APN_UNTHROTTLED:
+ if (serviceProvider == null) break;
+ callback = (IDataServiceCallback) message.obj;
+ serviceProvider.unregisterForApnUnthrottled(callback);
+ break;
+ case DATA_SERVICE_INDICATION_APN_UNTHROTTLED:
+ if (serviceProvider == null) break;
+ ApnUnthrottledIndication apnUnthrottledIndication =
+ (ApnUnthrottledIndication) message.obj;
+ try {
+ apnUnthrottledIndication.callback
+ .onApnUnthrottled(apnUnthrottledIndication.apn);
+ } catch (RemoteException e) {
+ loge("Failed to call onApnUnthrottled. " + e);
+ }
+ break;
}
}
}
@@ -695,6 +758,26 @@ public abstract class DataService extends Service {
mHandler.obtainMessage(DATA_SERVICE_REQUEST_CANCEL_HANDOVER,
slotIndex, 0, req).sendToTarget();
}
+
+ @Override
+ public void registerForUnthrottleApn(int slotIndex, IDataServiceCallback callback) {
+ if (callback == null) {
+ loge("registerForUnthrottleApn: callback is null");
+ return;
+ }
+ mHandler.obtainMessage(DATA_SERVICE_REQUEST_REGISTER_APN_UNTHROTTLED, slotIndex,
+ 0, callback).sendToTarget();
+ }
+
+ @Override
+ public void unregisterForUnthrottleApn(int slotIndex, IDataServiceCallback callback) {
+ if (callback == null) {
+ loge("uregisterForUnthrottleApn: callback is null");
+ return;
+ }
+ mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_APN_UNTHROTTLED,
+ slotIndex, 0, callback).sendToTarget();
+ }
}
private void log(String s) {
diff --git a/telephony/java/android/telephony/data/DataServiceCallback.java b/telephony/java/android/telephony/data/DataServiceCallback.java
index eef0e017f998..52bf15fd16c3 100644
--- a/telephony/java/android/telephony/data/DataServiceCallback.java
+++ b/telephony/java/android/telephony/data/DataServiceCallback.java
@@ -233,7 +233,7 @@ public class DataServiceCallback {
*/
@NonNull
public static String resultCodeToString(@DataServiceCallback.ResultCode int resultCode) {
- switch(resultCode) {
+ switch (resultCode) {
case RESULT_SUCCESS:
return "RESULT_SUCCESS";
case RESULT_ERROR_UNSUPPORTED:
@@ -248,4 +248,22 @@ public class DataServiceCallback {
return "Missing case for result code=" + resultCode;
}
}
+
+ /**
+ * Indicates that the specified APN is no longer throttled.
+ *
+ * @param apn Access Point Name defined by the carrier.
+ */
+ public void onApnUnthrottled(@NonNull String apn) {
+ if (mCallback != null) {
+ try {
+ if (DBG) Rlog.d(TAG, "onApnUnthrottled");
+ mCallback.onApnUnthrottled(apn);
+ } catch (RemoteException e) {
+ Rlog.e(TAG, "onApnUnthrottled: remote exception", e);
+ }
+ } else {
+ Rlog.e(TAG, "onApnUnthrottled: callback is null!");
+ }
+ }
}
diff --git a/telephony/java/android/telephony/data/IDataService.aidl b/telephony/java/android/telephony/data/IDataService.aidl
index 33226feb0e35..3f1f033d6f11 100644
--- a/telephony/java/android/telephony/data/IDataService.aidl
+++ b/telephony/java/android/telephony/data/IDataService.aidl
@@ -40,4 +40,6 @@ oneway interface IDataService
void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback);
void startHandover(int slotId, int cid, IDataServiceCallback callback);
void cancelHandover(int slotId, int cid, IDataServiceCallback callback);
+ void registerForUnthrottleApn(int slotIndex, IDataServiceCallback callback);
+ void unregisterForUnthrottleApn(int slotIndex, IDataServiceCallback callback);
}
diff --git a/telephony/java/android/telephony/data/IDataServiceCallback.aidl b/telephony/java/android/telephony/data/IDataServiceCallback.aidl
index d296e7b19be8..9cc2feac331a 100644
--- a/telephony/java/android/telephony/data/IDataServiceCallback.aidl
+++ b/telephony/java/android/telephony/data/IDataServiceCallback.aidl
@@ -32,4 +32,5 @@ oneway interface IDataServiceCallback
void onDataCallListChanged(in List<DataCallResponse> dataCallList);
void onHandoverStarted(int result);
void onHandoverCancelled(int result);
+ void onApnUnthrottled(in String apn);
}
diff --git a/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl b/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl
index 3bf09bc19788..2904082616e7 100644
--- a/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl
+++ b/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl
@@ -17,6 +17,7 @@
package android.telephony.data;
import android.telephony.data.IQualifiedNetworksServiceCallback;
+import android.telephony.data.ApnThrottleStatus;
/**
* {@hide}
@@ -25,4 +26,5 @@ interface IQualifiedNetworksService
{
oneway void createNetworkAvailabilityProvider(int slotId, IQualifiedNetworksServiceCallback callback);
oneway void removeNetworkAvailabilityProvider(int slotId);
+ oneway void reportApnThrottleStatusChanged(int slotId, in List<ApnThrottleStatus> statuses);
}
diff --git a/telephony/java/android/telephony/data/QualifiedNetworksService.java b/telephony/java/android/telephony/data/QualifiedNetworksService.java
index 05971c4d2e70..4af63b4cf981 100644
--- a/telephony/java/android/telephony/data/QualifiedNetworksService.java
+++ b/telephony/java/android/telephony/data/QualifiedNetworksService.java
@@ -28,6 +28,7 @@ import android.os.Message;
import android.os.RemoteException;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.Annotation.ApnType;
+import android.util.Log;
import android.util.SparseArray;
import com.android.internal.annotations.VisibleForTesting;
@@ -65,6 +66,7 @@ public abstract class QualifiedNetworksService extends Service {
private static final int QNS_REMOVE_NETWORK_AVAILABILITY_PROVIDER = 2;
private static final int QNS_REMOVE_ALL_NETWORK_AVAILABILITY_PROVIDERS = 3;
private static final int QNS_UPDATE_QUALIFIED_NETWORKS = 4;
+ private static final int QNS_APN_THROTTLE_STATUS_CHANGED = 5;
private final HandlerThread mHandlerThread;
@@ -160,6 +162,17 @@ public abstract class QualifiedNetworksService extends Service {
}
/**
+ * The framework calls this method when the throttle status of an APN changes.
+ *
+ * This method is meant to be overridden.
+ *
+ * @param statuses the statuses that have changed
+ */
+ public void reportApnThrottleStatusChanged(@NonNull List<ApnThrottleStatus> statuses) {
+ Log.d(TAG, "reportApnThrottleStatusChanged: statuses size=" + statuses.size());
+ }
+
+ /**
* Called when the qualified networks provider is removed. The extended class should
* implement this method to perform cleanup works.
*/
@@ -197,6 +210,12 @@ public abstract class QualifiedNetworksService extends Service {
+ slotIndex);
}
break;
+ case QNS_APN_THROTTLE_STATUS_CHANGED:
+ if (provider != null) {
+ List<ApnThrottleStatus> statuses = (List<ApnThrottleStatus>) message.obj;
+ provider.reportApnThrottleStatusChanged(statuses);
+ }
+ break;
case QNS_REMOVE_NETWORK_AVAILABILITY_PROVIDER:
if (provider != null) {
@@ -286,6 +305,13 @@ public abstract class QualifiedNetworksService extends Service {
mHandler.obtainMessage(QNS_REMOVE_NETWORK_AVAILABILITY_PROVIDER, slotIndex, 0)
.sendToTarget();
}
+
+ @Override
+ public void reportApnThrottleStatusChanged(int slotIndex,
+ List<ApnThrottleStatus> statuses) {
+ mHandler.obtainMessage(QNS_APN_THROTTLE_STATUS_CHANGED, slotIndex, 0, statuses)
+ .sendToTarget();
+ }
}
private void log(String s) {
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index 76fc4f7d0519..6fbde503c3a0 100644
--- a/telephony/java/com/android/internal/telephony/DctConstants.java
+++ b/telephony/java/com/android/internal/telephony/DctConstants.java
@@ -113,6 +113,7 @@ public class DctConstants {
public static final int EVENT_NR_TIMER_WATCHDOG = BASE + 53;
public static final int EVENT_CARRIER_CONFIG_CHANGED = BASE + 54;
public static final int EVENT_SIM_STATE_UPDATED = BASE + 55;
+ public static final int EVENT_APN_UNTHROTTLED = BASE + 56;
/***** Constants *****/