OSDN Git Service

Support flagNoPersonalizedLearning in layout XML
authorYohei Yukawa <yukawa@google.com>
Fri, 14 Apr 2017 20:46:37 +0000 (13:46 -0700)
committerYohei Yukawa <yukawa@google.com>
Fri, 14 Apr 2017 20:46:37 +0000 (13:46 -0700)
In my previous CL [1] a new flag IME_FLAG_NO_PERSONALIZED_LEARNING
was added for EditorInfo.imeOptions.  What was missed in the
previous CL is that new flag definition for layout XML and as a
result currently IME_FLAG_NO_PERSONALIZED_LEARNING is the only
IME option flag that cannot be specified in layout XML.

For instance, EditorInfo.IME_FLAG_FORCE_ASCII can be specified as
follows.

 <EditText
     android:id="@+id/edittext_force_ascii"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:imeOptions="actionSend|flagForceAscii" />

With this CL, application developers can specify
IME_FLAG_NO_PERSONALIZED_LEARNING as follows.

 <EditText
     android:id="@+id/edittext_no_personalized_learning"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:imeOptions="actionSend|flagNoPersonalizedLearning" />

 [1]: Ibf5ac3d2b8f39542baf2635c0cadbe242b059f81
      5959af13d069e77ff2b2ac729225e7d248b83a79

Bug: 28157942
Fixes: 37305520
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: Ifca0b13bf336cdc609af820aadcdb1b45ca1d5ba

core/java/android/view/inputmethod/EditorInfo.java
core/res/res/values/attrs.xml

index 2f12e9b..28d9fcf 100644 (file)
@@ -155,7 +155,7 @@ 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
+     * Flag of {@link #imeOptions}: used to request that the IME should 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>
index d26d952..709ec64 100644 (file)
              Corresponds to
              {@link android.view.inputmethod.EditorInfo#IME_ACTION_PREVIOUS}. -->
         <flag name="actionPrevious" value="0x00000007" />
+        <!-- Used to request that the IME should 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> -->
+        <flag name="flagNoPersonalizedLearning" value="0x1000000" />
         <!-- Used to request that the IME never go
              into fullscreen mode.  Applications need to be aware that the flag is not
              a guarantee, and not all IMEs will respect it.