From eaa7efd136473c8f7aaf1b930c4c810316cf4595 Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Thu, 16 Oct 2014 18:14:30 +0900
Subject: [PATCH] [ML29] Reinitialize the subtype at input start

Bug: 11230254
Bug: 17994347
Change-Id: I3476909c4b371d6e94a0d4c35d91e109d639b8d5
---
 java/src/com/android/inputmethod/latin/LatinIME.java        | 1 +
 java/src/com/android/inputmethod/latin/SubtypeSwitcher.java | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index f968a6c52b..ec3d895836 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -857,6 +857,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         // also wouldn't be consuming gesture data.
         mGestureConsumer = GestureConsumer.NULL_GESTURE_CONSUMER;
         mRichImm.clearSubtypeCaches();
+        mSubtypeSwitcher.refreshSubtypeInfo();
         final KeyboardSwitcher switcher = mKeyboardSwitcher;
         switcher.updateKeyboardTheme();
         final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView();
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 13f79b49f6..6fc5495490 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -117,10 +117,14 @@ public final class SubtypeSwitcher {
         final NetworkInfo info = connectivityManager.getActiveNetworkInfo();
         mIsNetworkConnected = (info != null && info.isConnected());
 
-        onSubtypeChanged(mRichImm.getCurrentRawSubtype());
+        refreshSubtypeInfo();
         updateParametersOnStartInputView();
     }
 
+    public void refreshSubtypeInfo() {
+        onSubtypeChanged(mRichImm.getCurrentRawSubtype());
+    }
+
     /**
      * Update parameters which are changed outside LatinIME. This parameters affect UI so that they
      * should be updated every time onStartInputView is called.
-- 
GitLab