diff options
author | Jack Yu <jackyu@google.com> | 2021-11-20 13:15:59 -0800 |
---|---|---|
committer | Sarah Chin <sarahchin@google.com> | 2022-03-03 22:22:54 +0000 |
commit | 613ed789de91820318f397bdf4ff1785022724cd (patch) | |
tree | 52e993b5bab80d331a9b28f86c6ec1ce8ee9f28a | |
parent | 6eb9d8ab656522b2368bfb6ac98b98866417548e (diff) | |
download | base-613ed789de91820318f397bdf4ff1785022724cd.tar.gz |
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
-rw-r--r-- | telephony/java/android/telephony/CarrierConfigManager.java | 39 | ||||
-rw-r--r-- | telephony/java/android/telephony/data/DataProfile.java | 31 |
2 files changed, 52 insertions, 18 deletions
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index a81cae13b0fe..98115ddbe137 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -5465,13 +5465,11 @@ public class CarrierConfigManager { 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 - * the network only allows single PDN. The priority is from the lowest 0 to the highest 100. - * The long-lived network request usually has the lowest priority. This allows other short-lived - * requests like MMS requests to be established. Emergency request always has the highest - * priority. + * Network capability priority for determine the satisfy order in telephony. The priority is + * from the lowest 0 to the highest 100. The long-lived network shall have the lowest priority. + * This allows other short-lived requests like MMS requests to be established. Emergency request + * always has the highest priority. * - * // TODO: Remove KEY_APN_PRIORITY_STRING_ARRAY * @hide */ public static final String KEY_TELEPHONY_NETWORK_CAPABILITY_PRIORITIES_STRING_ARRAY = @@ -5481,17 +5479,17 @@ public class CarrierConfigManager { * Defines the rules for data retry. * * The syntax of the retry rule: - * 1. Retry based on {@link NetworkCapabilities} - * "capabilities=[netCaps1|netCaps2|...], [retry_interval=x], [backoff=[true|false]], - * [maximum_retries=y]" + * 1. Retry based on {@link NetworkCapabilities}. Note that only APN-type network capabilities + * are supported. + * "capabilities=[netCaps1|netCaps2|...], [retry_interval=n1|n2|n3|n4...], [maximum_retries=n]" * * 2. Retry based on {@link DataFailCause} - * "fail_causes=[cause1|cause2|cause3|...], [retry_interval=x], [backoff=[true|false]], - * [maximum_retries=y]" + * "fail_causes=[cause1|cause2|cause3|..], [retry_interval=n1|n2|n3|n4...], [maximum_retries=n]" * - * 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|...], - * [retry_interval=x], [backoff=[true|false]], [maximum_retries=y]" + * [retry_interval=n1|n2|n3|n4...], [maximum_retries=n]" * * For example, * "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 * , 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 * @hide @@ -6276,6 +6279,9 @@ public class CarrierConfigManager { "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" }); + + // 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( KEY_TELEPHONY_NETWORK_CAPABILITY_PRIORITIES_STRING_ARRAY, new String[] { "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|" + "2254, maximum_retries=0", // No retry for those causes "capabilities=mms|supl|cbs, retry_interval=2000", - "capabilities=internet|enterprise|dun|ims|fota, retry_interval=2000, " - + "backoff=true, maximum_retries=13", + "capabilities=internet|enterprise|dun|ims|fota, retry_interval=2500|3000|" + + "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.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false); diff --git a/telephony/java/android/telephony/data/DataProfile.java b/telephony/java/android/telephony/data/DataProfile.java index 43ad982f2e1e..c1d16a9aaea7 100644 --- a/telephony/java/android/telephony/data/DataProfile.java +++ b/telephony/java/android/telephony/data/DataProfile.java @@ -18,6 +18,7 @@ package android.telephony.data; import static android.telephony.data.ApnSetting.ProtocolType; +import android.annotation.ElapsedRealtimeLong; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -70,6 +71,12 @@ public final class DataProfile implements Parcelable { 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) { mApnSetting = builder.mApnSetting; mTrafficDescriptor = builder.mTrafficDescriptor; @@ -101,6 +108,7 @@ public final class DataProfile implements Parcelable { mApnSetting = source.readParcelable(ApnSetting.class.getClassLoader()); mTrafficDescriptor = source.readParcelable(TrafficDescriptor.class.getClassLoader()); 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 public int describeContents() { return 0; @@ -405,8 +431,8 @@ public final class DataProfile implements Parcelable { @NonNull @Override public String toString() { - return "DataProfile=" + mApnSetting + ", " + mTrafficDescriptor + ", preferred=" - + mPreferred; + return "[DataProfile=" + mApnSetting + ", " + mTrafficDescriptor + ", preferred=" + + mPreferred + "]"; } @Override @@ -415,6 +441,7 @@ public final class DataProfile implements Parcelable { dest.writeParcelable(mApnSetting, flags); dest.writeParcelable(mTrafficDescriptor, flags); dest.writeBoolean(mPreferred); + dest.writeLong(mSetupTimestamp); } public static final @android.annotation.NonNull Parcelable.Creator<DataProfile> CREATOR = |