From c09fd175c3123034885b5be7f8c7890ae902713b Mon Sep 17 00:00:00 2001
From: Keisuke Kuroyanagi <ksk@google.com>
Date: Tue, 7 Jan 2014 16:24:29 +0900
Subject: [PATCH] Prepare using dictionaryFacilitator for amanatto updates.

Bug: 11736529
Change-Id: I0d9d9b1c1108b11064163df7c2089f53e92cd7ad
---
 java/src/com/android/inputmethod/latin/LatinIME.java      | 8 ++++++--
 .../PersonalizationDictionarySessionRegistrar.java        | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 8ea868d51a..971b68ee97 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -524,7 +524,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         }
         if (currentSettingsValues.mUsePersonalizedDicts) {
             if (mSubtypeSwitcher.isSystemLocaleSameAsLocaleOfAllEnabledSubtypes()) {
-                PersonalizationDictionarySessionRegistrar.init(this);
+                PersonalizationDictionarySessionRegistrar.init(this,
+                        mInputLogic.mSuggest.mDictionaryFacilitator);
             } else {
                 PersonalizationDictionarySessionRegistrar.close(this);
             }
@@ -568,6 +569,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
                 new DictionaryFacilitatorForSuggest(this /* context */, subtypeLocale,
                         settingsValues, this /* DictionaryInitializationListener */,
                         oldDictionaryFacilitator);
+        PersonalizationDictionarySessionRegistrar.onConfigurationChanged(
+                this, getResources().getConfiguration(), dictionaryFacilitator);
         final Suggest newSuggest = new Suggest(subtypeLocale, dictionaryFacilitator);
         if (settingsValues.mCorrectionEnabled) {
             newSuggest.setAutoCorrectionThreshold(settingsValues.mAutoCorrectionThreshold);
@@ -619,7 +622,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
                 mOptionsDialog.dismiss();
             }
         }
-        PersonalizationDictionarySessionRegistrar.onConfigurationChanged(this, conf);
+        PersonalizationDictionarySessionRegistrar.onConfigurationChanged(this, conf,
+                mInputLogic.mSuggest.mDictionaryFacilitator);
         super.onConfigurationChanged(conf);
     }
 
diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionarySessionRegistrar.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionarySessionRegistrar.java
index 9a897a5828..d6c0dc0dce 100644
--- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionarySessionRegistrar.java
+++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionarySessionRegistrar.java
@@ -19,11 +19,15 @@ package com.android.inputmethod.latin.personalization;
 import android.content.Context;
 import android.content.res.Configuration;
 
+import com.android.inputmethod.latin.DictionaryFacilitatorForSuggest;
+
 public class PersonalizationDictionarySessionRegistrar {
-    public static void init(final Context context) {
+    public static void init(final Context context,
+            final DictionaryFacilitatorForSuggest dictionaryFacilitator) {
     }
 
-    public static void onConfigurationChanged(final Context context, final Configuration conf) {
+    public static void onConfigurationChanged(final Context context, final Configuration conf,
+            final DictionaryFacilitatorForSuggest dictionaryFacilitator) {
     }
 
     public static void onUpdateData(final Context context, final String type) {
-- 
GitLab