Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Introduce EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING
Browse files Browse the repository at this point in the history
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 5959af1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
3 changes: 2 additions & 1 deletion api/current.txt
Expand Up @@ -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";
}

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion api/system-current.txt
Expand Up @@ -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";
}

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion api/test-current.txt
Expand Up @@ -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";
}

Expand Down Expand Up @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions core/java/android/view/inputmethod/EditorInfo.java
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5959af1

Please sign in to comment.