aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java5
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java9
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/ProbabilityInfo.java2
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/WordProperty.java1
-rw-r--r--java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java6
-rw-r--r--java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java43
6 files changed, 35 insertions, 31 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 3590c486b..8246c924b 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -930,11 +930,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
return middleText;
}
- final String shortText = SubtypeLocaleUtils.getShortDisplayName(subtype);
- if (fitsTextIntoWidth(width, shortText, paint)) {
- return shortText;
- }
-
return "";
}
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index 7847738e0..3c1015926 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -269,6 +269,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
}
private void runGCAfterAllPrioritizedTasksIfRequiredLocked(final boolean mindsBlockByGC) {
+ if (mBinaryDictionary == null) {
+ return;
+ }
// needsToRunGC() have to be called with lock.
if (mBinaryDictionary.needsToRunGC(mindsBlockByGC)) {
if (setProcessingLargeTaskIfNot()) {
@@ -357,6 +360,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
public void run() {
final boolean locked = setProcessingLargeTaskIfNot();
try {
+ if (mBinaryDictionary == null) {
+ return;
+ }
mBinaryDictionary.addMultipleDictionaryEntries(
languageModelParams.toArray(
new LanguageModelParam[languageModelParams.size()]));
@@ -496,6 +502,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
}
private void flushDictionaryLocked() {
+ if (mBinaryDictionary == null) {
+ return;
+ }
if (mBinaryDictionary.needsToRunGC(false /* mindsBlockByGC */)) {
mBinaryDictionary.flushWithGC();
} else {
diff --git a/java/src/com/android/inputmethod/latin/makedict/ProbabilityInfo.java b/java/src/com/android/inputmethod/latin/makedict/ProbabilityInfo.java
index 9dcd63f0c..5fcbb6357 100644
--- a/java/src/com/android/inputmethod/latin/makedict/ProbabilityInfo.java
+++ b/java/src/com/android/inputmethod/latin/makedict/ProbabilityInfo.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.latin.makedict;
+import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.BinaryDictionary;
import com.android.inputmethod.latin.utils.CombinedFormatUtils;
@@ -30,6 +31,7 @@ public final class ProbabilityInfo {
public final int mLevel;
public final int mCount;
+ @UsedForTesting
public static ProbabilityInfo max(final ProbabilityInfo probabilityInfo1,
final ProbabilityInfo probabilityInfo2) {
if (probabilityInfo1 == null) {
diff --git a/java/src/com/android/inputmethod/latin/makedict/WordProperty.java b/java/src/com/android/inputmethod/latin/makedict/WordProperty.java
index d94cec424..853392200 100644
--- a/java/src/com/android/inputmethod/latin/makedict/WordProperty.java
+++ b/java/src/com/android/inputmethod/latin/makedict/WordProperty.java
@@ -42,6 +42,7 @@ public final class WordProperty implements Comparable<WordProperty> {
private int mHashCode = 0;
+ @UsedForTesting
public WordProperty(final String word, final ProbabilityInfo probabilityInfo,
final ArrayList<WeightedString> shortcutTargets,
final ArrayList<WeightedString> bigrams,
diff --git a/java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java b/java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java
index acd16a9e4..5ce977d5e 100644
--- a/java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java
+++ b/java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java
@@ -110,6 +110,9 @@ public final class LanguageModelParam {
final LanguageModelParam languageModelParam =
detectWhetherVaildWordOrNotAndGetLanguageModelParam(
prevWord, tempWord, timestamp, dictionaryFacilitator);
+ if (languageModelParam == null) {
+ continue;
+ }
languageModelParams.add(languageModelParam);
prevWord = languageModelParam.mTargetWord;
}
@@ -120,6 +123,9 @@ public final class LanguageModelParam {
final String prevWord, final String targetWord, final int timestamp,
final DictionaryFacilitatorForSuggest dictionaryFacilitator) {
final Locale locale = dictionaryFacilitator.getLocale();
+ if (locale == null) {
+ return null;
+ }
if (!dictionaryFacilitator.isValidWord(targetWord, true /* ignoreCase */)) {
// OOV word.
return createAndGetLanguageModelParamOfWord(prevWord, targetWord, timestamp,
diff --git a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
index b3871bfb4..4f556f972 100644
--- a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
@@ -201,11 +201,11 @@ public final class SubtypeLocaleUtils {
// fr_CH swiss F Français (Suisse)
// de qwertz F Deutsch
// de_CH swiss T Deutsch (Schweiz)
- // zz qwerty F No language (QWERTY) in system locale
+ // zz qwerty F Alphabet (QWERTY) in system locale
// fr qwertz T Français (QWERTZ)
// de qwerty T Deutsch (QWERTY)
// en_US azerty T English (US) (AZERTY) exception
- // zz azerty T No language (AZERTY) in system locale
+ // zz azerty T Alphabet (AZERTY) in system locale
private static String getReplacementString(final InputMethodSubtype subtype,
final Locale displayLocale) {
@@ -294,21 +294,21 @@ public final class SubtypeLocaleUtils {
// InputMethodSubtype's display name for spacebar text in its locale.
// isAdditionalSubtype (T=true, F=false)
- // locale layout | Short Middle Full
- // ------ ------- - ---- --------- ----------------------
- // en_US qwerty F En English English (US) exception
- // en_GB qwerty F En English English (UK) exception
- // es_US spanish F Es Español Español (EE.UU.) exception
- // fr azerty F Fr Français Français
- // fr_CA qwerty F Fr Français Français (Canada)
- // fr_CH swiss F Fr Français Français (Suisse)
- // de qwertz F De Deutsch Deutsch
- // de_CH swiss T De Deutsch Deutsch (Schweiz)
- // zz qwerty F QWERTY QWERTY
- // fr qwertz T Fr Français Français
- // de qwerty T De Deutsch Deutsch
- // en_US azerty T En English English (US)
- // zz azerty T AZERTY AZERTY
+ // locale layout | Middle Full
+ // ------ ------- - --------- ----------------------
+ // en_US qwerty F English English (US) exception
+ // en_GB qwerty F English English (UK) exception
+ // es_US spanish F Español Español (EE.UU.) exception
+ // fr azerty F Français Français
+ // fr_CA qwerty F Français Français (Canada)
+ // fr_CH swiss F Français Français (Suisse)
+ // de qwertz F Deutsch Deutsch
+ // de_CH swiss T Deutsch Deutsch (Schweiz)
+ // zz qwerty F QWERTY QWERTY
+ // fr qwertz T Français Français
+ // de qwerty T Deutsch Deutsch
+ // en_US azerty T English English (US)
+ // zz azerty T AZERTY AZERTY
// Get InputMethodSubtype's full display name in its locale.
public static String getFullDisplayName(final InputMethodSubtype subtype) {
@@ -327,15 +327,6 @@ public final class SubtypeLocaleUtils {
return getSubtypeLocaleDisplayName(locale.getLanguage());
}
- // Get InputMethodSubtype's short display name in its locale.
- public static String getShortDisplayName(final InputMethodSubtype subtype) {
- if (isNoLanguage(subtype)) {
- return "";
- }
- final Locale locale = getSubtypeLocale(subtype);
- return StringUtils.capitalizeFirstCodePoint(locale.getLanguage(), locale);
- }
-
// TODO: Get this information from the framework instead of maintaining here by ourselves.
// Sorted list of known Right-To-Left language codes.
private static final String[] SORTED_RTL_LANGUAGES = {