Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5959af13 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent d0bbe217
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -32080,10 +32080,10 @@ package android.provider {
    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 @@ package android.view.inputmethod {
    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;
+2 −1
Original line number Diff line number Diff line
@@ -34768,10 +34768,10 @@ package android.provider {
    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 @@ package android.view.inputmethod {
    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;
+2 −1
Original line number Diff line number Diff line
@@ -32166,10 +32166,10 @@ package android.provider {
    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 @@ package android.view.inputmethod {
    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;
+21 −0
Original line number Diff line number Diff line
@@ -154,6 +154,26 @@ public class EditorInfo implements InputType, Parcelable {
     */
    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.
@@ -270,6 +290,7 @@ public class EditorInfo implements InputType, Parcelable {
     *                               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