OSDN Git Service

Ensure EditorInfo#locales is set before return.
authorYohei Yukawa <yukawa@google.com>
Thu, 21 Jan 2016 05:09:33 +0000 (21:09 -0800)
committerYohei Yukawa <yukawa@google.com>
Thu, 21 Jan 2016 05:09:33 +0000 (21:09 -0800)
This is a follow up CL for the previous CL [1], which mistakenly put
the initialization code of EditorInfo#locales after return statement.

  [1]: I77db5b99a7cf745d800db75baf135bb60ad04820
       8d6eeb01df72891acd3aa75e64aa1595a41cc96e

With this CL, the IME starts receiving correctly initialized LocaleList
as expected.

Bug: 22859862
Change-Id: I738ffaaf07091d8b980f8bfc6e16227fcb85a96a

core/java/android/widget/TextView.java

index d46c6f9..81ebdb3 100644 (file)
@@ -6440,6 +6440,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                 outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_ENTER_ACTION;
             }
             outAttrs.hintText = mHint;
+            // LocaleList is designed to be immutable.  This is theoretically equivalent to copy
+            // the snapshot of the current text locales.
+            outAttrs.locales = getTextLocales();
             if (mText instanceof Editable) {
                 InputConnection ic = new EditableInputConnection(this);
                 outAttrs.initialSelStart = getSelectionStart();
@@ -6447,9 +6450,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                 outAttrs.initialCapsMode = ic.getCursorCapsMode(getInputType());
                 return ic;
             }
-            // LocaleList is designed to be immutable.  This is theoretically equivalent to copy
-            // the snapshot of the current text locales.
-            outAttrs.locales = getTextLocales();
         }
         return null;
     }