AI 146011: am: CL 145859 am: CL 145561 Fix issue #1710534 (documentation doesn't mention that activity resolver (and others) handle MIME types as case-sensitive).
Original author: hackbod
Merged from: //branches/cupcake/...
Original author: android-build
Automated import of CL 146011
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 2b6cded..99cf34c 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2059,6 +2059,12 @@
* android.intent.action.VIEW; an application's custom action would be
* something like com.google.app.myapp.CUSTOM_ACTION.
*
+ * <p><em>Note: scheme and host name matching in the Android framework is
+ * case-sensitive, unlike the formal RFC. As a result,
+ * you should always ensure that you write your Uri with these elements
+ * using lower case letters, and normalize any Uris you receive from
+ * outside of Android to ensure the scheme and host is lower case.</em></p>
+ *
* @param action The Intent action, such as ACTION_VIEW.
* @param uri The Intent data URI.
*/
@@ -2093,6 +2099,12 @@
* construct the Intent and then calling {@link #setClass} to set its
* class.
*
+ * <p><em>Note: scheme and host name matching in the Android framework is
+ * case-sensitive, unlike the formal RFC. As a result,
+ * you should always ensure that you write your Uri with these elements
+ * using lower case letters, and normalize any Uris you receive from
+ * outside of Android to ensure the scheme and host is lower case.</em></p>
+ *
* @param action The Intent action, such as ACTION_VIEW.
* @param uri The Intent data URI.
* @param packageContext A Context of the application package implementing
@@ -3142,6 +3154,12 @@
* Set the data this intent is operating on. This method automatically
* clears any type that was previously set by {@link #setType}.
*
+ * <p><em>Note: scheme and host name matching in the Android framework is
+ * case-sensitive, unlike the formal RFC. As a result,
+ * you should always ensure that you write your Uri with these elements
+ * using lower case letters, and normalize any Uris you receive from
+ * outside of Android to ensure the scheme and host is lower case.</em></p>
+ *
* @param data The URI of the data this intent is now targeting.
*
* @return Returns the same Intent object, for chaining multiple calls
@@ -3162,6 +3180,12 @@
* only specify a type and not data, for example to indicate the type of
* data to return. This method automatically clears any data that was
* previously set by {@link #setData}.
+ *
+ * <p><em>Note: MIME type matching in the Android framework is
+ * case-sensitive, unlike formal RFC MIME types. As a result,
+ * you should always write your MIME types with lower case letters,
+ * and any MIME types you receive from outside of Android should be
+ * converted to lower case before supplying them here.</em></p>
*
* @param type The MIME type of the data being handled by this intent.
*
@@ -3184,6 +3208,13 @@
* to override the MIME type that would ordinarily be inferred from the
* data with your own type given here.
*
+ * <p><em>Note: MIME type, Uri scheme, and host name matching in the
+ * Android framework is case-sensitive, unlike the formal RFC definitions.
+ * As a result, you should always write these elements with lower case letters,
+ * and normalize any MIME types or Uris you receive from
+ * outside of Android to ensure these elements are lower case before
+ * supplying them here.</em></p>
+ *
* @param data The URI of the data this intent is now targeting.
* @param type The MIME type of the data being handled by this intent.
*