Added data retry support

1. Support multiple retry interval.
2. Completed data retry manager.
3. Used Google Truth for data unit tests.

Test: Manual & atest DataRetryManagerTest
Bug: 196597630
Merged-In: I04cadac100040054d449892df50e30dc77954082
Change-Id: I04cadac100040054d449892df50e30dc77954082
This commit is contained in:
Jack Yu
2021-11-20 13:15:59 -08:00
parent 8cf8788c03
commit 5169d5c222
2 changed files with 52 additions and 18 deletions

View File

@@ -5465,13 +5465,11 @@ public class CarrierConfigManager {
public static final String KEY_APN_PRIORITY_STRING_ARRAY = "apn_priority_string_array"; public static final String KEY_APN_PRIORITY_STRING_ARRAY = "apn_priority_string_array";
/** /**
* Network capability priority for determine the satisfy order in telephony. This is used when * Network capability priority for determine the satisfy order in telephony. The priority is
* the network only allows single PDN. The priority is from the lowest 0 to the highest 100. * from the lowest 0 to the highest 100. The long-lived network shall have the lowest priority.
* The long-lived network request usually has the lowest priority. This allows other short-lived * This allows other short-lived requests like MMS requests to be established. Emergency request
* requests like MMS requests to be established. Emergency request always has the highest * always has the highest priority.
* priority.
* *
* // TODO: Remove KEY_APN_PRIORITY_STRING_ARRAY
* @hide * @hide
*/ */
public static final String KEY_TELEPHONY_NETWORK_CAPABILITY_PRIORITIES_STRING_ARRAY = public static final String KEY_TELEPHONY_NETWORK_CAPABILITY_PRIORITIES_STRING_ARRAY =
@@ -5481,17 +5479,17 @@ public class CarrierConfigManager {
* Defines the rules for data retry. * Defines the rules for data retry.
* *
* The syntax of the retry rule: * The syntax of the retry rule:
* 1. Retry based on {@link NetworkCapabilities} * 1. Retry based on {@link NetworkCapabilities}. Note that only APN-type network capabilities
* "capabilities=[netCaps1|netCaps2|...], [retry_interval=x], [backoff=[true|false]], * are supported.
* [maximum_retries=y]" * "capabilities=[netCaps1|netCaps2|...], [retry_interval=n1|n2|n3|n4...], [maximum_retries=n]"
* *
* 2. Retry based on {@link DataFailCause} * 2. Retry based on {@link DataFailCause}
* "fail_causes=[cause1|cause2|cause3|...], [retry_interval=x], [backoff=[true|false]], * "fail_causes=[cause1|cause2|cause3|..], [retry_interval=n1|n2|n3|n4...], [maximum_retries=n]"
* [maximum_retries=y]"
* *
* 3. Retry based on {@link NetworkCapabilities} and {@link DataFailCause} * 3. Retry based on {@link NetworkCapabilities} and {@link DataFailCause}. Note that only
* APN-type network capabilities are supported.
* "capabilities=[netCaps1|netCaps2|...], fail_causes=[cause1|cause2|cause3|...], * "capabilities=[netCaps1|netCaps2|...], fail_causes=[cause1|cause2|cause3|...],
* [retry_interval=x], [backoff=[true|false]], [maximum_retries=y]" * [retry_interval=n1|n2|n3|n4...], [maximum_retries=n]"
* *
* For example, * For example,
* "capabilities=eims, retry_interval=1000, maximum_retries=20" means if the attached * "capabilities=eims, retry_interval=1000, maximum_retries=20" means if the attached
@@ -5500,7 +5498,12 @@ public class CarrierConfigManager {
* *
* "fail_causes=8|27|28|29|30|32|33|35|50|51|111|-5|-6|65537|65538|-3|2253|2254 * "fail_causes=8|27|28|29|30|32|33|35|50|51|111|-5|-6|65537|65538|-3|2253|2254
* , maximum_retries=0" means for those fail causes, never retry with timers. Note that * , maximum_retries=0" means for those fail causes, never retry with timers. Note that
* when environment changes, retry can still happens. * when environment changes, retry can still happen.
*
* "capabilities=internet|enterprise|dun|ims|fota, retry_interval=2500|3000|"
* "5000|10000|15000|20000|40000|60000|120000|240000|600000|1200000|1800000"
* "1800000, maximum_retries=20" means for those capabilities, retry happens in 2.5s, 3s, 5s,
* 10s, 15s, 20s, 40s, 1m, 2m, 4m, 10m, 20m, 30m, 30m, 30m, until reaching 20 retries.
* *
* // TODO: remove KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS * // TODO: remove KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS
* @hide * @hide
@@ -6276,6 +6279,9 @@ public class CarrierConfigManager {
"enterprise:0", "default:1", "mms:2", "supl:2", "dun:2", "hipri:3", "fota:2", "enterprise:0", "default:1", "mms:2", "supl:2", "dun:2", "hipri:3", "fota:2",
"ims:2", "cbs:2", "ia:2", "emergency:2", "mcx:3", "xcap:3" "ims:2", "cbs:2", "ia:2", "emergency:2", "mcx:3", "xcap:3"
}); });
// Do not modify the priority unless you know what you are doing. This will have significant
// impacts on the order of data network setup.
sDefaults.putStringArray( sDefaults.putStringArray(
KEY_TELEPHONY_NETWORK_CAPABILITY_PRIORITIES_STRING_ARRAY, new String[] { KEY_TELEPHONY_NETWORK_CAPABILITY_PRIORITIES_STRING_ARRAY, new String[] {
"eims:90", "supl:80", "mms:70", "xcap:70", "cbs:50", "mcx:50", "fota:50", "eims:90", "supl:80", "mms:70", "xcap:70", "cbs:50", "mcx:50", "fota:50",
@@ -6287,8 +6293,9 @@ public class CarrierConfigManager {
"fail_causes=8|27|28|29|30|32|33|35|50|51|111|-5|-6|65537|65538|-3|2253|" "fail_causes=8|27|28|29|30|32|33|35|50|51|111|-5|-6|65537|65538|-3|2253|"
+ "2254, maximum_retries=0", // No retry for those causes + "2254, maximum_retries=0", // No retry for those causes
"capabilities=mms|supl|cbs, retry_interval=2000", "capabilities=mms|supl|cbs, retry_interval=2000",
"capabilities=internet|enterprise|dun|ims|fota, retry_interval=2000, " "capabilities=internet|enterprise|dun|ims|fota, retry_interval=2500|3000|"
+ "backoff=true, maximum_retries=13", + "5000|10000|15000|20000|40000|60000|120000|240000|"
+ "600000|1200000|1800000, maximum_retries=20"
}); });
sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_PATTERN_STRING_ARRAY, new String[0]); sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_PATTERN_STRING_ARRAY, new String[0]);
sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false); sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false);

View File

@@ -18,6 +18,7 @@ package android.telephony.data;
import static android.telephony.data.ApnSetting.ProtocolType; import static android.telephony.data.ApnSetting.ProtocolType;
import android.annotation.ElapsedRealtimeLong;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
@@ -70,6 +71,12 @@ public final class DataProfile implements Parcelable {
private boolean mPreferred; private boolean mPreferred;
/**
* The last timestamp of this data profile being used for data network setup. Never add this
* to {@link #equals(Object)} and {@link #hashCode()}.
*/
private @ElapsedRealtimeLong long mSetupTimestamp;
private DataProfile(@NonNull Builder builder) { private DataProfile(@NonNull Builder builder) {
mApnSetting = builder.mApnSetting; mApnSetting = builder.mApnSetting;
mTrafficDescriptor = builder.mTrafficDescriptor; mTrafficDescriptor = builder.mTrafficDescriptor;
@@ -101,6 +108,7 @@ public final class DataProfile implements Parcelable {
mApnSetting = source.readParcelable(ApnSetting.class.getClassLoader()); mApnSetting = source.readParcelable(ApnSetting.class.getClassLoader());
mTrafficDescriptor = source.readParcelable(TrafficDescriptor.class.getClassLoader()); mTrafficDescriptor = source.readParcelable(TrafficDescriptor.class.getClassLoader());
mPreferred = source.readBoolean(); mPreferred = source.readBoolean();
mSetupTimestamp = source.readLong();
} }
/** /**
@@ -397,6 +405,24 @@ public final class DataProfile implements Parcelable {
} }
} }
/**
* Set the timestamp of this data profile being used for data network setup.
*
* @hide
*/
public void setLastSetupTimestamp(@ElapsedRealtimeLong long timestamp) {
mSetupTimestamp = timestamp;
}
/**
* @return the timestamp of this data profile being used for data network setup.
*
* @hide
*/
public @ElapsedRealtimeLong long getLastSetupTimestamp() {
return mSetupTimestamp;
}
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
@@ -405,8 +431,8 @@ public final class DataProfile implements Parcelable {
@NonNull @NonNull
@Override @Override
public String toString() { public String toString() {
return "DataProfile=" + mApnSetting + ", " + mTrafficDescriptor + ", preferred=" return "[DataProfile=" + mApnSetting + ", " + mTrafficDescriptor + ", preferred="
+ mPreferred; + mPreferred + "]";
} }
@Override @Override
@@ -415,6 +441,7 @@ public final class DataProfile implements Parcelable {
dest.writeParcelable(mApnSetting, flags); dest.writeParcelable(mApnSetting, flags);
dest.writeParcelable(mTrafficDescriptor, flags); dest.writeParcelable(mTrafficDescriptor, flags);
dest.writeBoolean(mPreferred); dest.writeBoolean(mPreferred);
dest.writeLong(mSetupTimestamp);
} }
public static final @android.annotation.NonNull Parcelable.Creator<DataProfile> CREATOR = public static final @android.annotation.NonNull Parcelable.Creator<DataProfile> CREATOR =