Properly handle smart-forwarded attachments

Bug: 7115207
Change-Id: I2cd4fcb39e7711bb1a19032df1bce73e94395486
diff --git a/src/com/android/exchange/EasOutboxService.java b/src/com/android/exchange/EasOutboxService.java
index 59c4d06..6cbe3e6 100644
--- a/src/com/android/exchange/EasOutboxService.java
+++ b/src/com/android/exchange/EasOutboxService.java
@@ -310,11 +310,21 @@
         sendCallback(msgId, null, result);
     }
 
+    /**
+     * See if a given attachment is among an array of attachments; it is if the locations of both
+     * are the same (we're looking to see if they represent the same attachment on the server. Note
+     * that an attachment that isn't on the server (e.g. an outbound attachment picked from the
+     * gallery) won't have a location, so the result will always be false
+     *
+     * @param att the attachment to test
+     * @param atts the array of attachments to look in
+     * @return whether the test attachment is among the array of attachments
+     */
     private boolean amongAttachments(Attachment att, Attachment[] atts) {
-        String contentUri = att.getContentUri();
-        if (contentUri == null) return false;
+        String location = att.mLocation;
+        if (location == null) return false;
         for (Attachment a: atts) {
-            if (contentUri.equals(a.getContentUri())) {
+            if (location.equals(a.mLocation)) {
                 return true;
             }
         }