summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Furtado <afurtado@google.com>2016-09-12 16:47:56 -0700
committerAndre Furtado <afurtado@google.com>2016-09-13 09:17:18 -0700
commitd0c5b20403b3924cee67e0e72d745b10b0691eac (patch)
treed1e53da429ea6575ecafffd8e19b58b658287d41
parent44108eca8b4528a7ab68fe83e2a03c549ef57bb1 (diff)
downloadMms-android-7.1.1_r40.tar.gz
Bump up MMS network request timeout and don't retryandroid-cts_7.1_r1android-cts-7.1_r9android-cts-7.1_r8android-cts-7.1_r7android-cts-7.1_r6android-cts-7.1_r5android-cts-7.1_r4android-cts-7.1_r3android-cts-7.1_r29android-cts-7.1_r28android-cts-7.1_r27android-cts-7.1_r26android-cts-7.1_r25android-cts-7.1_r24android-cts-7.1_r23android-cts-7.1_r22android-cts-7.1_r21android-cts-7.1_r20android-cts-7.1_r2android-cts-7.1_r19android-cts-7.1_r18android-cts-7.1_r17android-cts-7.1_r16android-cts-7.1_r15android-cts-7.1_r14android-cts-7.1_r13android-cts-7.1_r12android-cts-7.1_r11android-cts-7.1_r10android-cts-7.1_r1android-7.1.1_r9android-7.1.1_r8android-7.1.1_r7android-7.1.1_r61android-7.1.1_r60android-7.1.1_r6android-7.1.1_r59android-7.1.1_r58android-7.1.1_r57android-7.1.1_r56android-7.1.1_r55android-7.1.1_r54android-7.1.1_r53android-7.1.1_r52android-7.1.1_r51android-7.1.1_r50android-7.1.1_r49android-7.1.1_r48android-7.1.1_r47android-7.1.1_r46android-7.1.1_r45android-7.1.1_r44android-7.1.1_r43android-7.1.1_r42android-7.1.1_r41android-7.1.1_r40android-7.1.1_r4android-7.1.1_r39android-7.1.1_r38android-7.1.1_r35android-7.1.1_r33android-7.1.1_r32android-7.1.1_r31android-7.1.1_r3android-7.1.1_r28android-7.1.1_r27android-7.1.1_r26android-7.1.1_r25android-7.1.1_r24android-7.1.1_r23android-7.1.1_r22android-7.1.1_r21android-7.1.1_r20android-7.1.1_r2android-7.1.1_r17android-7.1.1_r16android-7.1.1_r15android-7.1.1_r14android-7.1.1_r13android-7.1.1_r12android-7.1.1_r11android-7.1.1_r10android-7.1.1_r1nougat-mr1.8-releasenougat-mr1.7-releasenougat-mr1.6-releasenougat-mr1.5-releasenougat-mr1.4-releasenougat-mr1.3-releasenougat-mr1.2-releasenougat-mr1.1-releasenougat-mr1-volantis-releasenougat-mr1-security-releasenougat-mr1-releasenougat-mr1-flounder-releasenougat-mr1-devnougat-mr1-cts-release
Moving forward, the MMS service will rely on the retry logic of the lower level Telephony layer, and retire it's own retry logic. Also, we increase the timeout for network requests, to ensure we give enough time for the Telephony retries to be attempted. Test: did a manual test in which I turned airplane mode off, observed that prior to the change, we tried 3 times, and after the change, only once. Also observed that when connection is successful, it works Ok the first time around (i.e. no regression). Bug: 31383107 Change-Id: If4d67ec0731767e0ac55476f592b0bd9f6657955
-rw-r--r--src/com/android/mms/service/MmsNetworkManager.java3
-rw-r--r--src/com/android/mms/service/MmsRequest.java4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/mms/service/MmsNetworkManager.java b/src/com/android/mms/service/MmsNetworkManager.java
index 67b0af6..c2e2f6a 100644
--- a/src/com/android/mms/service/MmsNetworkManager.java
+++ b/src/com/android/mms/service/MmsNetworkManager.java
@@ -31,7 +31,8 @@ import com.android.mms.service.exception.MmsNetworkException;
*/
public class MmsNetworkManager {
// Timeout used to call ConnectivityManager.requestNetwork
- private static final int NETWORK_REQUEST_TIMEOUT_MILLIS = 60 * 1000;
+ // Given that the telephony layer will retry on failures, this timeout should be high enough.
+ private static final int NETWORK_REQUEST_TIMEOUT_MILLIS = 30 * 60 * 1000;
// Wait timeout for this class, a little bit longer than the above timeout
// to make sure we don't bail prematurely
private static final int NETWORK_ACQUIRE_TIMEOUT_MILLIS =
diff --git a/src/com/android/mms/service/MmsRequest.java b/src/com/android/mms/service/MmsRequest.java
index e4ebdc4..4eeac08 100644
--- a/src/com/android/mms/service/MmsRequest.java
+++ b/src/com/android/mms/service/MmsRequest.java
@@ -147,7 +147,7 @@ public abstract class MmsRequest {
result = SmsManager.MMS_ERROR_IO_ERROR;
} else { // Execute
long retryDelaySecs = 2;
- // Try multiple times of MMS HTTP request
+ // Try multiple times of MMS HTTP request, depending on the error.
for (int i = 0; i < RETRY_TIMES; i++) {
try {
networkManager.acquireNetwork(requestId);
@@ -182,7 +182,7 @@ public abstract class MmsRequest {
} catch (MmsNetworkException e) {
LogUtil.e(requestId, "MMS network acquiring failure", e);
result = SmsManager.MMS_ERROR_UNABLE_CONNECT_MMS;
- // Retry
+ break;
} catch (MmsHttpException e) {
LogUtil.e(requestId, "HTTP or network I/O failure", e);
result = SmsManager.MMS_ERROR_HTTP_FAILURE;