Merge "Show http status log when an http failure only" am: fea4458567

Original change: https://android-review.googlesource.com/c/platform/packages/services/Mms/+/1425568

Change-Id: I9f75b29fd49579e280c3ed349e3fe4f0f60c04b8
diff --git a/src/com/android/mms/service/MmsRequest.java b/src/com/android/mms/service/MmsRequest.java
index baf9292..0d12bf8 100644
--- a/src/com/android/mms/service/MmsRequest.java
+++ b/src/com/android/mms/service/MmsRequest.java
@@ -152,6 +152,7 @@
             long retryDelaySecs = 2;
             // Try multiple times of MMS HTTP request, depending on the error.
             for (int i = 0; i < RETRY_TIMES; i++) {
+                httpStatusCode = 0; // Clear for retry.
                 try {
                     networkManager.acquireNetwork(requestId);
                     final String apnName = networkManager.getApnName();
@@ -219,10 +220,10 @@
         final String requestId = this.getRequestId();
         // As noted in the @param comment above, the httpStatusCode is only set when there's
         // an http failure. On success, such as an http code of 200, the value here will be 0.
-        // It's disconcerting in the log to see httpStatusCode: 0 when the mms succeeded. That
-        // is why an httpStatusCode of zero is now reported in the log as "success".
-        LogUtil.i(requestId, "processResult: " + result + ", httpStatusCode: "
-                + (httpStatusCode != 0 ? httpStatusCode : "success (0)"));
+        // "httpStatusCode: xxx" is now reported for an http failure only.
+        LogUtil.i(requestId, "processResult: "
+                + (result == Activity.RESULT_OK ? "success" : "failure(" + result + ")")
+                + (httpStatusCode != 0 ? ", httpStatusCode: " + httpStatusCode : ""));
 
         // Return MMS HTTP request result via PendingIntent
         final PendingIntent pendingIntent = getPendingIntent();