Merge "Update unthrottleApn calls to take in DataProfile"

This commit is contained in:
Sarah Chin 2022-01-04 17:27:41 +00:00 committed by Gerrit Code Review
commit fa2dc0b7e4
4 changed files with 58 additions and 4 deletions

View File

@ -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);

View File

@ -401,6 +401,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
@ -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);
}

View File

@ -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!");
}
}
}

View File

@ -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);
}