Adds annotations to Intent, and enables ChooserActivity to rank apps
according to annotations.

Test: Unit tests and manul tests. More unit tests to be added.
Change-Id: I3cbfd0cc10007290585fa3e7e3c92e1731f1f7b8
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index b05ceaa..d8358f9 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -3843,6 +3843,52 @@
             = "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER";
 
     /**
+     * An {@code ArrayList} of {@code String} annotations describing content for
+     * {@link #ACTION_CHOOSER}.
+     *
+     * <p>If {@link #EXTRA_CONTENT_ANNOTATIONS} is present in an intent used to start a
+     * {@link #ACTION_CHOOSER} activity, the first three annotations will be used to rank apps.</p>
+     *
+     * <p>Annotations should describe the major components or topics of the content. It is up to
+     * apps initiating {@link #ACTION_CHOOSER} to learn and add annotations. Annotations should be
+     * learned in advance, e.g., when creating or saving content, to avoid increasing latency to
+     * start {@link #ACTION_CHOOSER}. Performance on customized annotations can suffer, if they are
+     * rarely used for {@link #ACTION_CHOOSER} in the past 14 days. Therefore, it is recommended to
+     * use the following annotations when applicable:</p>
+     * <ul>
+     *     <li>"product": represents that the topic of the content is mainly about products, e.g.,
+     *     health & beauty, and office supplies.</li>
+     *     <li>"emotion": represents that the topic of the content is mainly about emotions, e.g.,
+     *     happy, and sad.</li>
+     *     <li>"person": represents that the topic of the content is mainly about persons, e.g.,
+     *     face, finger, standing, and walking.</li>
+     *     <li>"child": represents that the topic of the content is mainly about children, e.g.,
+     *     child, and baby.</li>
+     *     <li>"selfie": represents that the topic of the content is mainly about selfies.</li>
+     *     <li>"crowd": represents that the topic of the content is mainly about crowds.</li>
+     *     <li>"party": represents that the topic of the content is mainly about parties.</li>
+     *     <li>"animal": represent that the topic of the content is mainly about animals.</li>
+     *     <li>"plant": represents that the topic of the content is mainly about plants, e.g.,
+     *     flowers.</li>
+     *     <li>"vacation": represents that the topic of the content is mainly about vacations.</li>
+     *     <li>"fashion": represents that the topic of the content is mainly about fashion, e.g.
+     *     sunglasses, jewelry, handbags and clothing.</li>
+     *     <li>"material": represents that the topic of the content is mainly about materials, e.g.,
+     *     paper, and silk.</li>
+     *     <li>"vehicle": represents that the topic of the content is mainly about vehicles, like
+     *     cars, and boats.</li>
+     *     <li>"document": represents that the topic of the content is mainly about documents, e.g.
+     *     posters.</li>
+     *     <li>"design": represents that the topic of the content is mainly about design, e.g. arts
+     *     and designs of houses.</li>
+     *     <li>"holiday": represents that the topic of the content is mainly about holidays, e.g.,
+     *     Christmas and Thanksgiving.</li>
+     * </ul>
+     */
+    public static final String EXTRA_CONTENT_ANNOTATIONS
+            = "android.intent.extra.CONTENT_ANNOTATIONS";
+
+    /**
      * A {@link ResultReceiver} used to return data back to the sender.
      *
      * <p>Used to complete an app-specific