diff options
4 files changed, 58 insertions, 4 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 6321aaa225b4..6cf1b7394580 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -12520,6 +12520,7 @@ package android.telephony.data { method public final int getSlotIndex(); method public final void notifyApnUnthrottled(@NonNull String); method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>); + method public final void notifyDataProfileUnthrottled(@NonNull android.telephony.data.DataProfile); method public void requestDataCallList(@NonNull android.telephony.data.DataServiceCallback); method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @NonNull android.telephony.data.DataServiceCallback); method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @NonNull android.telephony.data.DataServiceCallback); @@ -12530,6 +12531,7 @@ package android.telephony.data { public class DataServiceCallback { method public void onApnUnthrottled(@NonNull String); method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>); + method public void onDataProfileUnthrottled(@NonNull android.telephony.data.DataProfile); method public void onDeactivateDataCallComplete(int); method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>); method public void onSetDataProfileComplete(int); diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java index 2f034752ae5f..892eb2937491 100644 --- a/telephony/java/android/telephony/data/DataService.java +++ b/telephony/java/android/telephony/data/DataService.java @@ -402,6 +402,21 @@ public abstract class DataService extends Service { } /** + * Notify the system that a given DataProfile was unthrottled. + * + * @param dataProfile DataProfile associated with an APN returned from the modem + */ + public final void notifyDataProfileUnthrottled(@NonNull DataProfile dataProfile) { + synchronized (mApnUnthrottledCallbacks) { + for (IDataServiceCallback callback : mApnUnthrottledCallbacks) { + mHandler.obtainMessage(DATA_SERVICE_INDICATION_APN_UNTHROTTLED, + mSlotIndex, 0, new ApnUnthrottledIndication(dataProfile, + 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. @@ -496,13 +511,20 @@ public abstract class DataService extends Service { } private static final class ApnUnthrottledIndication { + public final DataProfile dataProfile; public final String apn; public final IDataServiceCallback callback; ApnUnthrottledIndication(String apn, IDataServiceCallback callback) { + this.dataProfile = null; this.apn = apn; this.callback = callback; } + ApnUnthrottledIndication(DataProfile dataProfile, IDataServiceCallback callback) { + this.dataProfile = dataProfile; + this.apn = null; + this.callback = callback; + } } private class DataServiceHandler extends Handler { @@ -636,8 +658,13 @@ public abstract class DataService extends Service { ApnUnthrottledIndication apnUnthrottledIndication = (ApnUnthrottledIndication) message.obj; try { - apnUnthrottledIndication.callback - .onApnUnthrottled(apnUnthrottledIndication.apn); + if (apnUnthrottledIndication.dataProfile != null) { + apnUnthrottledIndication.callback + .onDataProfileUnthrottled(apnUnthrottledIndication.dataProfile); + } else { + apnUnthrottledIndication.callback + .onApnUnthrottled(apnUnthrottledIndication.apn); + } } catch (RemoteException e) { loge("Failed to call onApnUnthrottled. " + e); } diff --git a/telephony/java/android/telephony/data/DataServiceCallback.java b/telephony/java/android/telephony/data/DataServiceCallback.java index d0827159b98d..051d6c5d5ec0 100644 --- a/telephony/java/android/telephony/data/DataServiceCallback.java +++ b/telephony/java/android/telephony/data/DataServiceCallback.java @@ -260,8 +260,8 @@ public class DataServiceCallback { /** * Unthrottles the APN on the current transport. There is no matching "APN throttle" method. - * Instead, the APN is throttled for the time specified in - * {@link DataCallResponse#getRetryDurationMillis}. + * Instead, the APN is throttled when {@link IDataService#setupDataCall} fails within + * the time specified by {@link DataCallResponse#getRetryDurationMillis}. * <p/> * see: {@link DataCallResponse#getRetryDurationMillis} * @@ -279,4 +279,27 @@ public class DataServiceCallback { Rlog.e(TAG, "onApnUnthrottled: callback is null!"); } } + + /** + * Unthrottles the DataProfile on the current transport. + * There is no matching "DataProfile throttle" method. + * Instead, the DataProfile is throttled when {@link IDataService#setupDataCall} fails within + * the time specified by {@link DataCallResponse#getRetryDurationMillis}. + * <p/> + * see: {@link DataCallResponse#getRetryDurationMillis} + * + * @param dataProfile DataProfile containing the APN to be throttled + */ + public void onDataProfileUnthrottled(final @NonNull DataProfile dataProfile) { + if (mCallback != null) { + try { + if (DBG) Rlog.d(TAG, "onDataProfileUnthrottled"); + mCallback.onDataProfileUnthrottled(dataProfile); + } catch (RemoteException e) { + Rlog.e(TAG, "onDataProfileUnthrottled: remote exception", e); + } + } else { + Rlog.e(TAG, "onDataProfileUnthrottled: callback is null!"); + } + } } diff --git a/telephony/java/android/telephony/data/IDataServiceCallback.aidl b/telephony/java/android/telephony/data/IDataServiceCallback.aidl index 9cc2feac331a..8205b5eb4d37 100644 --- a/telephony/java/android/telephony/data/IDataServiceCallback.aidl +++ b/telephony/java/android/telephony/data/IDataServiceCallback.aidl @@ -17,6 +17,7 @@ package android.telephony.data; import android.telephony.data.DataCallResponse; +import android.telephony.data.DataProfile; /** * The call back interface @@ -33,4 +34,5 @@ oneway interface IDataServiceCallback void onHandoverStarted(int result); void onHandoverCancelled(int result); void onApnUnthrottled(in String apn); + void onDataProfileUnthrottled(in DataProfile dp); } |