Added global retry support
The retry timer suggested by the network will persist
accross network requests. Also changed the retry timer
to a 64-bit value to be consistent with types used in
Android time APIs.
Test: FrameworksTelephonytests
Fix: 159672248
Change-Id: I632d4dc07fb545fa04eb3aefb0ff3270ee8f6ff8
diff --git a/api/system-current.txt b/api/system-current.txt
index c932718..5b27cf6ac 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -12030,7 +12030,8 @@
method public int getMtuV6();
method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses();
method public int getProtocolType();
- method public int getSuggestedRetryTime();
+ method public long getRetryIntervalMillis();
+ method @Deprecated public int getSuggestedRetryTime();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
field public static final int HANDOVER_FAILURE_MODE_DO_FALLBACK = 1; // 0x1
@@ -12042,6 +12043,7 @@
field public static final int LINK_STATUS_DORMANT = 1; // 0x1
field public static final int LINK_STATUS_INACTIVE = 0; // 0x0
field public static final int LINK_STATUS_UNKNOWN = -1; // 0xffffffff
+ field public static final int RETRY_INTERVAL_UNDEFINED = -1; // 0xffffffff
}
public static final class DataCallResponse.Builder {
@@ -12060,7 +12062,8 @@
method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV6(int);
method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>);
method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int);
- method @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setRetryIntervalMillis(long);
+ method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
}
public final class DataProfile implements android.os.Parcelable {
diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt
index b2d13f9..d65bd5b 100644
--- a/non-updatable-api/system-current.txt
+++ b/non-updatable-api/system-current.txt
@@ -10885,7 +10885,8 @@
method public int getMtuV6();
method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses();
method public int getProtocolType();
- method public int getSuggestedRetryTime();
+ method public long getRetryIntervalMillis();
+ method @Deprecated public int getSuggestedRetryTime();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
field public static final int HANDOVER_FAILURE_MODE_DO_FALLBACK = 1; // 0x1
@@ -10897,6 +10898,7 @@
field public static final int LINK_STATUS_DORMANT = 1; // 0x1
field public static final int LINK_STATUS_INACTIVE = 0; // 0x0
field public static final int LINK_STATUS_UNKNOWN = -1; // 0xffffffff
+ field public static final int RETRY_INTERVAL_UNDEFINED = -1; // 0xffffffff
}
public static final class DataCallResponse.Builder {
@@ -10915,7 +10917,8 @@
method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV6(int);
method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>);
method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int);
- method @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setRetryIntervalMillis(long);
+ method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
}
public final class DataProfile implements android.os.Parcelable {
diff --git a/telephony/java/android/telephony/data/DataCallResponse.java b/telephony/java/android/telephony/data/DataCallResponse.java
index 41381c5..3e2a6ee 100644
--- a/telephony/java/android/telephony/data/DataCallResponse.java
+++ b/telephony/java/android/telephony/data/DataCallResponse.java
@@ -109,8 +109,14 @@
*/
public static final int HANDOVER_FAILURE_MODE_NO_FALLBACK_RETRY_SETUP_NORMAL = 3;
+ /**
+ * Indicates that data retry interval is not specified. Platform can determine when to
+ * perform data setup appropriately.
+ */
+ public static final int RETRY_INTERVAL_UNDEFINED = -1;
+
private final @DataFailureCause int mCause;
- private final int mSuggestedRetryTime;
+ private final long mSuggestedRetryTime;
private final int mId;
private final @LinkStatus int mLinkStatus;
private final @ProtocolType int mProtocolType;
@@ -172,7 +178,7 @@
mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY;
}
- private DataCallResponse(@DataFailureCause int cause, int suggestedRetryTime, int id,
+ private DataCallResponse(@DataFailureCause int cause, long suggestedRetryTime, int id,
@LinkStatus int linkStatus, @ProtocolType int protocolType,
@Nullable String interfaceName, @Nullable List<LinkAddress> addresses,
@Nullable List<InetAddress> dnsAddresses, @Nullable List<InetAddress> gatewayAddresses,
@@ -202,7 +208,7 @@
@VisibleForTesting
public DataCallResponse(Parcel source) {
mCause = source.readInt();
- mSuggestedRetryTime = source.readInt();
+ mSuggestedRetryTime = source.readLong();
mId = source.readInt();
mLinkStatus = source.readInt();
mProtocolType = source.readInt();
@@ -229,8 +235,22 @@
/**
* @return The suggested data retry time in milliseconds.
+ *
+ * @deprecated Use {@link #getRetryIntervalMillis()} instead.
*/
- public int getSuggestedRetryTime() { return mSuggestedRetryTime; }
+ @Deprecated
+ public int getSuggestedRetryTime() {
+ return (int) mSuggestedRetryTime;
+ }
+
+ /**
+ * @return The network suggested data retry interval in milliseconds. {@code Long.MAX_VALUE}
+ * indicates data retry should not occur. {@link #RETRY_INTERVAL_UNDEFINED} indicates network
+ * did not suggest any retry interval.
+ */
+ public long getRetryIntervalMillis() {
+ return mSuggestedRetryTime;
+ }
/**
* @return The unique id of the data connection.
@@ -382,7 +402,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mCause);
- dest.writeInt(mSuggestedRetryTime);
+ dest.writeLong(mSuggestedRetryTime);
dest.writeInt(mId);
dest.writeInt(mLinkStatus);
dest.writeInt(mProtocolType);
@@ -446,7 +466,7 @@
public static final class Builder {
private @DataFailureCause int mCause;
- private int mSuggestedRetryTime;
+ private long mSuggestedRetryTime = RETRY_INTERVAL_UNDEFINED;
private int mId;
@@ -494,9 +514,23 @@
*
* @param suggestedRetryTime The suggested data retry time in milliseconds.
* @return The same instance of the builder.
+ *
+ * @deprecated Use {@link #setRetryIntervalMillis(long)} instead.
*/
+ @Deprecated
public @NonNull Builder setSuggestedRetryTime(int suggestedRetryTime) {
- mSuggestedRetryTime = suggestedRetryTime;
+ mSuggestedRetryTime = (long) suggestedRetryTime;
+ return this;
+ }
+
+ /**
+ * Set the network suggested data retry interval.
+ *
+ * @param retryIntervalMillis The suggested data retry interval in milliseconds.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setRetryIntervalMillis(long retryIntervalMillis) {
+ mSuggestedRetryTime = retryIntervalMillis;
return this;
}