Bump up MMS network request timeout and don't retry

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
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 @@
  */
 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 @@
             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 @@
                 } 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;