Merge "Update unthrottleApn calls to take in DataProfile" am: fa2dc0b7e4

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1934667

Change-Id: Ib72ac511f9919fc212d7e6958328c55d3760f24f
This commit is contained in:
Sarah Chin
2022-01-04 17:37:01 +00:00
committed by Automerger Merge Worker
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 int getSlotIndex();
method public final void notifyApnUnthrottled(@NonNull String); method public final void notifyApnUnthrottled(@NonNull String);
method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>); 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 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 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); 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 { public class DataServiceCallback {
method public void onApnUnthrottled(@NonNull String); method public void onApnUnthrottled(@NonNull String);
method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>); 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 onDeactivateDataCallComplete(int);
method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>); method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>);
method public void onSetDataProfileComplete(int); 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) * 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 * 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 { private static final class ApnUnthrottledIndication {
public final DataProfile dataProfile;
public final String apn; public final String apn;
public final IDataServiceCallback callback; public final IDataServiceCallback callback;
ApnUnthrottledIndication(String apn, ApnUnthrottledIndication(String apn,
IDataServiceCallback callback) { IDataServiceCallback callback) {
this.dataProfile = null;
this.apn = apn; this.apn = apn;
this.callback = callback; this.callback = callback;
} }
ApnUnthrottledIndication(DataProfile dataProfile, IDataServiceCallback callback) {
this.dataProfile = dataProfile;
this.apn = null;
this.callback = callback;
}
} }
private class DataServiceHandler extends Handler { private class DataServiceHandler extends Handler {
@@ -636,8 +658,13 @@ public abstract class DataService extends Service {
ApnUnthrottledIndication apnUnthrottledIndication = ApnUnthrottledIndication apnUnthrottledIndication =
(ApnUnthrottledIndication) message.obj; (ApnUnthrottledIndication) message.obj;
try { try {
apnUnthrottledIndication.callback if (apnUnthrottledIndication.dataProfile != null) {
.onApnUnthrottled(apnUnthrottledIndication.apn); apnUnthrottledIndication.callback
.onDataProfileUnthrottled(apnUnthrottledIndication.dataProfile);
} else {
apnUnthrottledIndication.callback
.onApnUnthrottled(apnUnthrottledIndication.apn);
}
} catch (RemoteException e) { } catch (RemoteException e) {
loge("Failed to call onApnUnthrottled. " + 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. * Unthrottles the APN on the current transport. There is no matching "APN throttle" method.
* Instead, the APN is throttled for the time specified in * Instead, the APN is throttled when {@link IDataService#setupDataCall} fails within
* {@link DataCallResponse#getRetryDurationMillis}. * the time specified by {@link DataCallResponse#getRetryDurationMillis}.
* <p/> * <p/>
* see: {@link DataCallResponse#getRetryDurationMillis} * see: {@link DataCallResponse#getRetryDurationMillis}
* *
@@ -279,4 +279,27 @@ public class DataServiceCallback {
Rlog.e(TAG, "onApnUnthrottled: callback is null!"); 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; package android.telephony.data;
import android.telephony.data.DataCallResponse; import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;
/** /**
* The call back interface * The call back interface
@@ -33,4 +34,5 @@ oneway interface IDataServiceCallback
void onHandoverStarted(int result); void onHandoverStarted(int result);
void onHandoverCancelled(int result); void onHandoverCancelled(int result);
void onApnUnthrottled(in String apn); void onApnUnthrottled(in String apn);
void onDataProfileUnthrottled(in DataProfile dp);
} }