Introduce EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING

In some situations it would be useful if the application can give a
hint that the user is not likely to want the IME to update
personalized data such as typing history and personalized language
model based on what the user typed the input area.

Typical use cases are:
 * When the application is in a special mode, where user's activities
   are expected to be not recorded in the application's history.
   Some web browsers and chat applications may have this kind of
   modes.
 * When storing typing history does not make much sense. Specifying
   this flag in typing games may help to avoid typing history from
   being filled up with words that the user is less likely to type
   in their daily life. Another example is that when the application
   already knows that the expected input is not a valid word (e.g.
   a promotion code that is not a valid word in any natural language).

Applications need to be aware that the flag is not a guarantee, and
some IMEs may not respect it.

Since this is basically about the general behavior that can be
combined with any of type of input types, this CL uses
EditorInfo.imeOptions instead of EditorInfo.inputType.

Also so far it look OK to do nothing in EditorInfo#makeCompatible()
regarding this flag because 1) this bit (0x1000000) has never been
used and 2) it is less likely that just passing that bit to an IME
that do not know about this bit causes any issue.

Bug: 28157942
Test: compile only as this is just a hint and OS does nothing
Change-Id: Ibf5ac3d2b8f39542baf2635c0cadbe242b059f81
diff --git a/api/current.txt b/api/current.txt
index dda8ce3..b8e8dcd 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -32080,10 +32080,10 @@
     field public static final java.lang.String EXTRA_ERROR = "error";
     field public static final java.lang.String EXTRA_EXCLUDE_SELF = "android.provider.extra.EXCLUDE_SELF";
     field public static final java.lang.String EXTRA_INFO = "info";
+    field public static final java.lang.String EXTRA_INITIAL_URI = "android.provider.extra.INITIAL_URI";
     field public static final java.lang.String EXTRA_LOADING = "loading";
     field public static final java.lang.String EXTRA_ORIENTATION = "android.provider.extra.ORIENTATION";
     field public static final java.lang.String EXTRA_PROMPT = "android.provider.extra.PROMPT";
-    field public static final java.lang.String EXTRA_INITIAL_URI = "android.provider.extra.INITIAL_URI";
     field public static final java.lang.String PROVIDER_INTERFACE = "android.content.action.DOCUMENTS_PROVIDER";
   }
 
@@ -45049,6 +45049,7 @@
     field public static final int IME_FLAG_NO_ENTER_ACTION = 1073741824; // 0x40000000
     field public static final int IME_FLAG_NO_EXTRACT_UI = 268435456; // 0x10000000
     field public static final int IME_FLAG_NO_FULLSCREEN = 33554432; // 0x2000000
+    field public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 16777216; // 0x1000000
     field public static final int IME_MASK_ACTION = 255; // 0xff
     field public static final int IME_NULL = 0; // 0x0
     field public int actionId;
diff --git a/api/system-current.txt b/api/system-current.txt
index 42aa329..fa88050 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -34768,10 +34768,10 @@
     field public static final java.lang.String EXTRA_ERROR = "error";
     field public static final java.lang.String EXTRA_EXCLUDE_SELF = "android.provider.extra.EXCLUDE_SELF";
     field public static final java.lang.String EXTRA_INFO = "info";
+    field public static final java.lang.String EXTRA_INITIAL_URI = "android.provider.extra.INITIAL_URI";
     field public static final java.lang.String EXTRA_LOADING = "loading";
     field public static final java.lang.String EXTRA_ORIENTATION = "android.provider.extra.ORIENTATION";
     field public static final java.lang.String EXTRA_PROMPT = "android.provider.extra.PROMPT";
-    field public static final java.lang.String EXTRA_INITIAL_URI = "android.provider.extra.INITIAL_URI";
     field public static final java.lang.String PROVIDER_INTERFACE = "android.content.action.DOCUMENTS_PROVIDER";
   }
 
@@ -48219,6 +48219,7 @@
     field public static final int IME_FLAG_NO_ENTER_ACTION = 1073741824; // 0x40000000
     field public static final int IME_FLAG_NO_EXTRACT_UI = 268435456; // 0x10000000
     field public static final int IME_FLAG_NO_FULLSCREEN = 33554432; // 0x2000000
+    field public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 16777216; // 0x1000000
     field public static final int IME_MASK_ACTION = 255; // 0xff
     field public static final int IME_NULL = 0; // 0x0
     field public int actionId;
diff --git a/api/test-current.txt b/api/test-current.txt
index 13f3103..7599c54 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -32166,10 +32166,10 @@
     field public static final java.lang.String EXTRA_ERROR = "error";
     field public static final java.lang.String EXTRA_EXCLUDE_SELF = "android.provider.extra.EXCLUDE_SELF";
     field public static final java.lang.String EXTRA_INFO = "info";
+    field public static final java.lang.String EXTRA_INITIAL_URI = "android.provider.extra.INITIAL_URI";
     field public static final java.lang.String EXTRA_LOADING = "loading";
     field public static final java.lang.String EXTRA_ORIENTATION = "android.provider.extra.ORIENTATION";
     field public static final java.lang.String EXTRA_PROMPT = "android.provider.extra.PROMPT";
-    field public static final java.lang.String EXTRA_INITIAL_URI = "android.provider.extra.INITIAL_URI";
     field public static final java.lang.String PROVIDER_INTERFACE = "android.content.action.DOCUMENTS_PROVIDER";
   }
 
@@ -45296,6 +45296,7 @@
     field public static final int IME_FLAG_NO_ENTER_ACTION = 1073741824; // 0x40000000
     field public static final int IME_FLAG_NO_EXTRACT_UI = 268435456; // 0x10000000
     field public static final int IME_FLAG_NO_FULLSCREEN = 33554432; // 0x2000000
+    field public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 16777216; // 0x1000000
     field public static final int IME_MASK_ACTION = 255; // 0xff
     field public static final int IME_NULL = 0; // 0x0
     field public int actionId;
diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java
index ab8fbde..2f12e9b 100644
--- a/core/java/android/view/inputmethod/EditorInfo.java
+++ b/core/java/android/view/inputmethod/EditorInfo.java
@@ -155,6 +155,26 @@
     public static final int IME_ACTION_PREVIOUS = 0x00000007;
 
     /**
+     * Flag of {@link #imeOptions}: used to request that the IME does not update any personalized
+     * data such as typing history and personalized language model based on what the user typed on
+     * this text editing object.  Typical use cases are:
+     * <ul>
+     *     <li>When the application is in a special mode, where user's activities are expected to be
+     *     not recorded in the application's history.  Some web browsers and chat applications may
+     *     have this kind of modes.</li>
+     *     <li>When storing typing history does not make much sense.  Specifying this flag in typing
+     *     games may help to avoid typing history from being filled up with words that the user is
+     *     less likely to type in their daily life.  Another example is that when the application
+     *     already knows that the expected input is not a valid word (e.g. a promotion code that is
+     *     not a valid word in any natural language).</li>
+     * </ul>
+     *
+     * <p>Applications need to be aware that the flag is not a guarantee, and some IMEs may not
+     * respect it.</p>
+     */
+    public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 0x1000000;
+
+    /**
      * Flag of {@link #imeOptions}: used to request that the IME never go
      * into fullscreen mode.
      * By default, IMEs may go into full screen mode when they think
@@ -270,6 +290,7 @@
      *                               1 1 IME_ACTION_NEXT
      *                               11  IME_ACTION_DONE
      *                               111 IME_ACTION_PREVIOUS
+     *         1                         IME_FLAG_NO_PERSONALIZED_LEARNING
      *        1                          IME_FLAG_NO_FULLSCREEN
      *       1                           IME_FLAG_NAVIGATE_PREVIOUS
      *      1                            IME_FLAG_NAVIGATE_NEXT