[RCS UCE] Add the extra parameter retryAfterMillis in the callback method CapabilitiesCallback#onError

Add the parameter in the callback method CapabilitiesCallback#onError
When requester receive the callback CapabilitiesCallback#onError with the non-zero of the parameter retryAfterMillis, it should stop retrying until the the specified number of millisecond has passed.

Bug: 171965576
Test: atest -c CtsTelephonyTestCases:android.telephony.ims.cts.RcsUceAdapterTest
Change-Id: If59d143e56c304556aa3d8bcd5b37ffb771815b5
This commit is contained in:
James.cf Lin
2020-11-25 17:24:46 +08:00
parent e72a1eb1eb
commit 740c3bf107
2 changed files with 27 additions and 7 deletions

View File

@@ -76,39 +76,46 @@ public class RcsUceAdapter {
* @hide
*/
public static final int ERROR_GENERIC_FAILURE = 1;
/**
* The carrier network does not have UCE support enabled for this subscriber.
* @hide
*/
public static final int ERROR_NOT_ENABLED = 2;
/**
* The data network that the device is connected to does not support UCE currently (e.g. it is
* 1x only currently).
* @hide
*/
public static final int ERROR_NOT_AVAILABLE = 3;
/**
* The network has responded with SIP 403 error and a reason "User not registered."
* @hide
*/
public static final int ERROR_NOT_REGISTERED = 4;
/**
* The network has responded to this request with a SIP 403 error and reason "not authorized for
* presence" for this subscriber.
* @hide
*/
public static final int ERROR_NOT_AUTHORIZED = 5;
/**
* The network has responded to this request with a SIP 403 error and no reason.
* @hide
*/
public static final int ERROR_FORBIDDEN = 6;
/**
* The contact URI requested is not provisioned for VoLTE or it is not known as an IMS
* subscriber to the carrier network.
* @hide
*/
public static final int ERROR_NOT_FOUND = 7;
/**
* The capabilities request contained too many URIs for the carrier network to handle. Retry
* with a lower number of contact numbers. The number varies per carrier.
@@ -116,22 +123,32 @@ public class RcsUceAdapter {
*/
// TODO: Try to integrate this into the API so that the service will split based on carrier.
public static final int ERROR_REQUEST_TOO_LARGE = 8;
/**
* The network did not respond to the capabilities request before the request timed out.
* @hide
*/
public static final int ERROR_REQUEST_TIMEOUT = 10;
/**
* The request failed due to the service having insufficient memory.
* @hide
*/
public static final int ERROR_INSUFFICIENT_MEMORY = 11;
/**
* The network was lost while trying to complete the request.
* @hide
*/
public static final int ERROR_LOST_NETWORK = 12;
/**
* The network is temporarily unavailable or busy. Retries should only be done after the retry
* time returned in {@link CapabilitiesCallback#onError} has elapsed.
* @hide
*/
public static final int ERROR_SERVER_UNAVAILABLE = 13;
/**@hide*/
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = "ERROR_", value = {
@@ -145,7 +162,8 @@ public class RcsUceAdapter {
ERROR_REQUEST_TOO_LARGE,
ERROR_REQUEST_TIMEOUT,
ERROR_INSUFFICIENT_MEMORY,
ERROR_LOST_NETWORK
ERROR_LOST_NETWORK,
ERROR_SERVER_UNAVAILABLE
})
public @interface ErrorCode {}
@@ -369,8 +387,10 @@ public class RcsUceAdapter {
* The pending request has resulted in an error and may need to be retried, depending on the
* error code.
* @param errorCode The reason for the framework being unable to process the request.
* @param retryAfterMilliseconds The time in milliseconds the requesting application should
* wait before retrying, if non-zero.
*/
void onError(@ErrorCode int errorCode);
void onError(@ErrorCode int errorCode, long retryAfterMilliseconds);
}
private final Context mContext;
@@ -451,10 +471,10 @@ public class RcsUceAdapter {
}
}
@Override
public void onError(int errorCode) {
public void onError(int errorCode, long retryAfterMilliseconds) {
final long callingIdentity = Binder.clearCallingIdentity();
try {
executor.execute(() -> c.onError(errorCode));
executor.execute(() -> c.onError(errorCode, retryAfterMilliseconds));
} finally {
restoreCallingIdentity(callingIdentity);
}
@@ -535,10 +555,10 @@ public class RcsUceAdapter {
}
}
@Override
public void onError(int errorCode) {
public void onError(int errorCode, long retryAfterMilliseconds) {
final long callingIdentity = Binder.clearCallingIdentity();
try {
executor.execute(() -> c.onError(errorCode));
executor.execute(() -> c.onError(errorCode, retryAfterMilliseconds));
} finally {
restoreCallingIdentity(callingIdentity);
}

View File

@@ -26,5 +26,5 @@ import android.telephony.ims.RcsContactUceCapability;
oneway interface IRcsUceControllerCallback {
void onCapabilitiesReceived(in List<RcsContactUceCapability> contactCapabilities);
void onComplete();
void onError(int errorCode);
void onError(int errorCode, long retryAfterMilliseconds);
}