Merge "MimeUtils' list of MIME types should be in order of popularity."
diff --git a/luni/src/main/java/libcore/net/MimeUtils.java b/luni/src/main/java/libcore/net/MimeUtils.java
index 6ea0baf..6e8c168 100644
--- a/luni/src/main/java/libcore/net/MimeUtils.java
+++ b/luni/src/main/java/libcore/net/MimeUtils.java
@@ -43,6 +43,10 @@
//
// and "active" MIME types (due to potential security issues).
+ // Note that this list is _not_ in alphabetical order and must not be sorted.
+ // The "most popular" extension must come first, so that it's the one returned
+ // by guessExtensionFromMimeType.
+
add("application/andrew-inset", "ez");
add("application/dsptype", "tsp");
add("application/futuresplash", "spl");
@@ -139,8 +143,8 @@
add("application/x-gnumeric", "gnumeric");
add("application/x-go-sgf", "sgf");
add("application/x-graphing-calculator", "gcf");
- add("application/x-gtar", "gtar");
add("application/x-gtar", "tgz");
+ add("application/x-gtar", "gtar");
add("application/x-gtar", "taz");
add("application/x-hdf", "hdf");
add("application/x-ica", "ica");
@@ -212,10 +216,11 @@
add("audio/midi", "kar");
add("audio/midi", "xmf");
add("audio/mobile-xmf", "mxmf");
+ // add ".mp3" first so it will be the default for guessExtensionFromMimeType
+ add("audio/mpeg", "mp3");
add("audio/mpeg", "mpga");
add("audio/mpeg", "mpega");
add("audio/mpeg", "mp2");
- add("audio/mpeg", "mp3");
add("audio/mpeg", "m4a");
add("audio/mpegurl", "m3u");
add("audio/prs.sid", "sid");
@@ -282,7 +287,7 @@
add("text/h323", "323");
add("text/iuls", "uls");
add("text/mathml", "mml");
- // add ".txt" first so it will be the default for ExtensionFromMimeType
+ // add ".txt" first so it will be the default for guessExtensionFromMimeType
add("text/plain", "txt");
add("text/plain", "asc");
add("text/plain", "text");
@@ -296,12 +301,13 @@
add("text/xml", "xml");
add("text/x-bibtex", "bib");
add("text/x-boo", "boo");
- add("text/x-c++hdr", "h++");
add("text/x-c++hdr", "hpp");
+ add("text/x-c++hdr", "h++");
add("text/x-c++hdr", "hxx");
add("text/x-c++hdr", "hh");
- add("text/x-c++src", "c++");
add("text/x-c++src", "cpp");
+ add("text/x-c++src", "c++");
+ add("text/x-c++src", "cc");
add("text/x-c++src", "cxx");
add("text/x-chdr", "h");
add("text/x-component", "htc");