From 9cbf814cb5decbbb87d7152fcf5e9cffb959e6fb Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Mon, 25 Aug 2014 15:19:48 +0900 Subject: [PATCH] Get dynamic dict stats via DictionaryFacilitator Bug: 16553957 Change-Id: Ida08ceaf34708daed52d61b3d5adfbdb48e42c71 --- .../inputmethod/latin/DictionaryFacilitator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java index 36a02669d..60d6bc3e5 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java @@ -19,6 +19,7 @@ package com.android.inputmethod.latin; import android.content.Context; import android.text.TextUtils; import android.util.Log; +import android.util.Pair; import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.annotations.UsedForTesting; @@ -656,4 +657,15 @@ public class DictionaryFacilitator { } dictToDump.dumpAllWordsForDebug(); } + + public ArrayList> getStatsOfEnabledSubDicts() { + final ArrayList> statsOfEnabledSubDicts = new ArrayList<>(); + final Dictionaries dictionaries = mDictionaries; + for (final String dictType : SUB_DICT_TYPES) { + final ExpandableBinaryDictionary dictionary = dictionaries.getSubDict(dictType); + if (dictionary == null) continue; + statsOfEnabledSubDicts.add(new Pair<>(dictType, dictionary.getDictionaryStats())); + } + return statsOfEnabledSubDicts; + } }