Add more logging around EAS SmartSend to debug potential issues.

Bug: 17720266
Change-Id: I90f09dd0eb21f1d180efc9d64f70384873c49536
diff --git a/src/com/android/exchange/eas/EasOutboxSync.java b/src/com/android/exchange/eas/EasOutboxSync.java
index 6f85f77..60ffc51 100644
--- a/src/com/android/exchange/eas/EasOutboxSync.java
+++ b/src/com/android/exchange/eas/EasOutboxSync.java
@@ -191,30 +191,30 @@
                 // The parser holds the status
                 final int status = p.getStatus();
                 if (CommandStatus.isNeedsProvisioning(status)) {
-                    LogUtils.w(LOG_TAG, "Needs provisioning sending mail");
+                    LogUtils.w(LOG_TAG, "Needs provisioning before sending message: %d",
+                            mMessage.mId);
                     return RESULT_PROVISIONING_ERROR;
-                } else if (status == CommandStatus.ITEM_NOT_FOUND &&
-                        mSmartSendInfo != null) {
+                } else if (status == CommandStatus.ITEM_NOT_FOUND && mSmartSendInfo != null) {
                     // Let's retry without "smart" commands.
-                    LogUtils.w(LOG_TAG, "Needs provisioning sending mail");
+                    LogUtils.w(LOG_TAG, "ITEM_NOT_FOUND smart sending message: %d", mMessage.mId);
                     return RESULT_ITEM_NOT_FOUND;
                 }
-
                 // TODO: Set syncServerId = SEND_FAILED in DB?
-                LogUtils.d(LOG_TAG, "General failure sending mail");
+                LogUtils.w(LOG_TAG, "General failure sending message: %d", mMessage.mId);
                 return RESULT_SEND_FAILED;
             } catch (final EmptyStreamException e) {
                 // This is actually fine; an empty stream means SendMail succeeded
-                LogUtils.d(LOG_TAG, "empty response sending mail");
+                LogUtils.d(LOG_TAG, "Empty response sending message: %d", mMessage.mId);
                 // Don't return here, fall through so that we'll delete the sent message.
             } catch (final IOException e) {
                 // Parsing failed in some other way.
-                LogUtils.w(LOG_TAG, "IOException sending mail");
+                LogUtils.e(LOG_TAG, e, "IOException sending message: %d", mMessage.mId);
                 return RESULT_IO_ERROR;
             }
         } else {
             // FLAG: Do we need to parse results for earlier versions?
         }
+        LogUtils.d(LOG_TAG, "Returning RESULT_OK after sending: %d", mMessage.mId);
         mContext.getContentResolver().delete(
             ContentUris.withAppendedId(Message.CONTENT_URI, mMessage.mId), null, null);
         return RESULT_OK;
@@ -363,6 +363,7 @@
             // First, we need to get the id of the reply/forward message, 0 is the default value
             // so we are looking for something greater than 0.
             final long refId = Body.restoreBodySourceKey(context, message.mId);
+            LogUtils.d(LOG_TAG, "getSmartSendInfo - found refId: %d for %d", refId, message.mId);
             if (refId > 0) {
                 // Then, we need the serverId and mailboxKey of the message
                 final String[] colsMailboxKey = Utility.getRowColumns(context, Message.CONTENT_URI,
@@ -406,6 +407,10 @@
                     requiredAtts = null;
                 }
                 return new SmartSendInfo(itemId, collectionId, reply, requiredAtts);
+            } else {
+                LogUtils.w(LOG_TAG,
+                        "getSmartSendInfo - Skipping SmartSend, could not find IDs for: %d",
+                        message.mId);
             }
             return null;
         }