Skip to content
Permalink
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
  • Loading branch information...
yukawa committed Nov 11, 2016
1 parent d0bbe21 commit 5959af13d069e77ff2b2ac729225e7d248b83a79
Showing with 27 additions and 3 deletions.
  1. +2 −1 api/current.txt
  2. +2 −1 api/system-current.txt
  3. +2 −1 api/test-current.txt
  4. +21 −0 core/java/android/view/inputmethod/EditorInfo.java
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";
}

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;
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";
}

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;
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";
}

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;
@@ -154,6 +154,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.
@@ -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

0 comments on commit 5959af1

Please sign in to comment.
You can’t perform that action at this time.