am a3d1e94e: Merge "Fix bug where constructing message attachment uri with null/empty partId will remove the trailing backslash, causing the uri to not match the expected pattern." into jb-ub-mail-ur9
* commit 'a3d1e94ebc4d5a1bab1d9f6ac7de962f8eeebd1b':
Fix bug where constructing message attachment uri with null/empty partId will remove the trailing backslash, causing the uri to not match the expected pattern.
diff --git a/src/com/android/mail/providers/Attachment.java b/src/com/android/mail/providers/Attachment.java
index d826314..0542998 100644
--- a/src/com/android/mail/providers/Attachment.java
+++ b/src/com/android/mail/providers/Attachment.java
@@ -43,6 +43,11 @@
public class Attachment implements Parcelable {
public static final String LOG_TAG = LogTag.getLogTag();
+ /**
+ * Workaround for b/8070022 so that appending a null partId to the end of a
+ * uri wouldn't remove the trailing backslash
+ */
+ public static final String EMPTY_PART_ID = "empty";
/**
* Part id of the attachment.
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index c624e10..86ab8aa 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -1818,12 +1818,15 @@
*/
public static final int BEST = 1;
+ private static final String SIMPLE_STRING = "SIMPLE";
+ private static final String BEST_STRING = "BEST";
+
public static int parseRendition(String rendition) {
- return rendition.equalsIgnoreCase("BEST") ? BEST : SIMPLE;
+ return TextUtils.equals(rendition, SIMPLE_STRING) ? SIMPLE : BEST;
}
public static String toString(int rendition) {
- return rendition == BEST ? "BEST" : "SIMPLE";
+ return rendition == BEST ? BEST_STRING : SIMPLE_STRING;
}
}