Merge "Remove Dict dependency on WordComposer and ProximityInfo"

main
Jean Chalard 2014-10-31 07:59:11 +00:00 committed by Android (Google) Code Review
commit 5840a7c6e7
12 changed files with 114 additions and 80 deletions

View File

@ -0,0 +1,61 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.latin.common;
/**
* An immutable class that encapsulates a snapshot of word composition data.
*/
public class ComposedData {
public final InputPointers mInputPointers;
public final boolean mIsBatchMode;
public final String mTypedWord;
public ComposedData(final InputPointers inputPointers, final boolean isBatchMode,
final String typedWord) {
mInputPointers = inputPointers;
mIsBatchMode = isBatchMode;
mTypedWord = typedWord;
}
/**
* Copy the code points in the typed word to a destination array of ints.
*
* If the array is too small to hold the code points in the typed word, nothing is copied and
* -1 is returned.
*
* @param destination the array of ints.
* @return the number of copied code points.
*/
public int copyCodePointsExceptTrailingSingleQuotesAndReturnCodePointCount(
final int[] destination) {
// lastIndex is exclusive
final int lastIndex = mTypedWord.length()
- StringUtils.getTrailingSingleQuotesCount(mTypedWord);
if (lastIndex <= 0) {
// The string is empty or contains only single quotes.
return 0;
}
// The following function counts the number of code points in the text range which begins
// at index 0 and extends to the character at lastIndex.
final int codePointSize = Character.codePointCount(mTypedWord, 0, lastIndex);
if (codePointSize > destination.length) {
return -1;
}
return StringUtils.copyCodePointsAndReturnCodePointCount(destination, mTypedWord, 0,
lastIndex, true /* downCase */);
}
}

View File

@ -21,8 +21,8 @@ import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.common.ComposedData;
import com.android.inputmethod.latin.common.Constants; import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.common.InputPointers; import com.android.inputmethod.latin.common.InputPointers;
import com.android.inputmethod.latin.common.StringUtils; import com.android.inputmethod.latin.common.StringUtils;
@ -262,8 +262,8 @@ public final class BinaryDictionary extends Dictionary {
} }
@Override @Override
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, public ArrayList<SuggestedWordInfo> getSuggestions(final ComposedData composedData,
final NgramContext ngramContext, final ProximityInfo proximityInfo, final NgramContext ngramContext, final long proximityInfoHandle,
final SettingsValuesForSuggestion settingsValuesForSuggestion, final SettingsValuesForSuggestion settingsValuesForSuggestion,
final int sessionId, final float weightForLocale, final int sessionId, final float weightForLocale,
final float[] inOutWeightOfLangModelVsSpatialModel) { final float[] inOutWeightOfLangModelVsSpatialModel) {
@ -274,12 +274,13 @@ public final class BinaryDictionary extends Dictionary {
Arrays.fill(session.mInputCodePoints, Constants.NOT_A_CODE); Arrays.fill(session.mInputCodePoints, Constants.NOT_A_CODE);
ngramContext.outputToArray(session.mPrevWordCodePointArrays, ngramContext.outputToArray(session.mPrevWordCodePointArrays,
session.mIsBeginningOfSentenceArray); session.mIsBeginningOfSentenceArray);
final InputPointers inputPointers = composer.getInputPointers(); final InputPointers inputPointers = composedData.mInputPointers;
final boolean isGesture = composer.isBatchMode(); final boolean isGesture = composedData.mIsBatchMode;
final int inputSize; final int inputSize;
if (!isGesture) { if (!isGesture) {
inputSize = composer.copyCodePointsExceptTrailingSingleQuotesAndReturnCodePointCount( inputSize =
session.mInputCodePoints); composedData.copyCodePointsExceptTrailingSingleQuotesAndReturnCodePointCount(
session.mInputCodePoints);
if (inputSize < 0) { if (inputSize < 0) {
return null; return null;
} }
@ -303,7 +304,7 @@ public final class BinaryDictionary extends Dictionary {
Dictionary.NOT_A_WEIGHT_OF_LANG_MODEL_VS_SPATIAL_MODEL; Dictionary.NOT_A_WEIGHT_OF_LANG_MODEL_VS_SPATIAL_MODEL;
} }
// TOOD: Pass multiple previous words information for n-gram. // TOOD: Pass multiple previous words information for n-gram.
getSuggestionsNative(mNativeDict, proximityInfo.getNativeProximityInfo(), getSuggestionsNative(mNativeDict, proximityInfoHandle,
getTraverseSession(sessionId).getSession(), inputPointers.getXCoordinates(), getTraverseSession(sessionId).getSession(), inputPointers.getXCoordinates(),
inputPointers.getYCoordinates(), inputPointers.getTimes(), inputPointers.getYCoordinates(), inputPointers.getTimes(),
inputPointers.getPointerIds(), session.mInputCodePoints, inputSize, inputPointers.getPointerIds(), session.mInputCodePoints, inputSize,

View File

@ -17,8 +17,8 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.common.ComposedData;
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion; import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
import java.util.ArrayList; import java.util.ArrayList;
@ -87,9 +87,9 @@ public abstract class Dictionary {
/** /**
* Searches for suggestions for a given context. * Searches for suggestions for a given context.
* @param composer the key sequence to match with coordinate info, as a WordComposer * @param composedData the key sequence to match with coordinate info
* @param ngramContext the context for n-gram. * @param ngramContext the context for n-gram.
* @param proximityInfo the object for key proximity. May be ignored by some implementations. * @param proximityInfoHandle the handle for key proximity. Is ignored by some implementations.
* @param settingsValuesForSuggestion the settings values used for the suggestion. * @param settingsValuesForSuggestion the settings values used for the suggestion.
* @param sessionId the session id. * @param sessionId the session id.
* @param weightForLocale the weight given to this locale, to multiply the output scores for * @param weightForLocale the weight given to this locale, to multiply the output scores for
@ -99,8 +99,8 @@ public abstract class Dictionary {
* a float array that has only one element. This can be updated when a different value is used. * a float array that has only one element. This can be updated when a different value is used.
* @return the list of suggestions (possibly null if none) * @return the list of suggestions (possibly null if none)
*/ */
abstract public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, abstract public ArrayList<SuggestedWordInfo> getSuggestions(final ComposedData composedData,
final NgramContext ngramContext, final ProximityInfo proximityInfo, final NgramContext ngramContext, final long proximityInfoHandle,
final SettingsValuesForSuggestion settingsValuesForSuggestion, final SettingsValuesForSuggestion settingsValuesForSuggestion,
final int sessionId, final float weightForLocale, final int sessionId, final float weightForLocale,
final float[] inOutWeightOfLangModelVsSpatialModel); final float[] inOutWeightOfLangModelVsSpatialModel);
@ -203,8 +203,8 @@ public abstract class Dictionary {
} }
@Override @Override
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, public ArrayList<SuggestedWordInfo> getSuggestions(final ComposedData composedData,
final NgramContext ngramContext, final ProximityInfo proximityInfo, final NgramContext ngramContext, final long proximityInfoHandle,
final SettingsValuesForSuggestion settingsValuesForSuggestion, final SettingsValuesForSuggestion settingsValuesForSuggestion,
final int sessionId, final float weightForLocale, final int sessionId, final float weightForLocale,
final float[] inOutWeightOfLangModelVsSpatialModel) { final float[] inOutWeightOfLangModelVsSpatialModel) {

View File

@ -18,8 +18,8 @@ package com.android.inputmethod.latin;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.common.ComposedData;
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion; import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
import java.util.ArrayList; import java.util.ArrayList;
@ -59,8 +59,8 @@ public final class DictionaryCollection extends Dictionary {
} }
@Override @Override
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, public ArrayList<SuggestedWordInfo> getSuggestions(final ComposedData composedData,
final NgramContext ngramContext, final ProximityInfo proximityInfo, final NgramContext ngramContext, final long proximityInfoHandle,
final SettingsValuesForSuggestion settingsValuesForSuggestion, final SettingsValuesForSuggestion settingsValuesForSuggestion,
final int sessionId, final float weightForLocale, final int sessionId, final float weightForLocale,
final float[] inOutWeightOfLangModelVsSpatialModel) { final float[] inOutWeightOfLangModelVsSpatialModel) {
@ -68,15 +68,15 @@ public final class DictionaryCollection extends Dictionary {
if (dictionaries.isEmpty()) return null; if (dictionaries.isEmpty()) return null;
// To avoid creating unnecessary objects, we get the list out of the first // To avoid creating unnecessary objects, we get the list out of the first
// dictionary and add the rest to it if not null, hence the get(0) // dictionary and add the rest to it if not null, hence the get(0)
ArrayList<SuggestedWordInfo> suggestions = dictionaries.get(0).getSuggestions(composer, ArrayList<SuggestedWordInfo> suggestions = dictionaries.get(0).getSuggestions(composedData,
ngramContext, proximityInfo, settingsValuesForSuggestion, sessionId, ngramContext, proximityInfoHandle, settingsValuesForSuggestion, sessionId,
weightForLocale, inOutWeightOfLangModelVsSpatialModel); weightForLocale, inOutWeightOfLangModelVsSpatialModel);
if (null == suggestions) suggestions = new ArrayList<>(); if (null == suggestions) suggestions = new ArrayList<>();
final int length = dictionaries.size(); final int length = dictionaries.size();
for (int i = 1; i < length; ++ i) { for (int i = 1; i < length; ++ i) {
final ArrayList<SuggestedWordInfo> sugg = dictionaries.get(i).getSuggestions(composer, final ArrayList<SuggestedWordInfo> sugg = dictionaries.get(i).getSuggestions(
ngramContext, proximityInfo, settingsValuesForSuggestion, sessionId, composedData, ngramContext, proximityInfoHandle, settingsValuesForSuggestion,
weightForLocale, inOutWeightOfLangModelVsSpatialModel); sessionId, weightForLocale, inOutWeightOfLangModelVsSpatialModel);
if (null != sugg) suggestions.addAll(sugg); if (null != sugg) suggestions.addAll(sugg);
} }
return suggestions; return suggestions;

View File

@ -23,7 +23,6 @@ import android.util.Pair;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.ExpandableBinaryDictionary.UpdateEntriesForInputEventsCallback; import com.android.inputmethod.latin.ExpandableBinaryDictionary.UpdateEntriesForInputEventsCallback;
import com.android.inputmethod.latin.NgramContext.WordInfo; import com.android.inputmethod.latin.NgramContext.WordInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
@ -683,7 +682,7 @@ public class DictionaryFacilitator {
// TODO: Revise the way to fusion suggestion results. // TODO: Revise the way to fusion suggestion results.
public SuggestionResults getSuggestionResults(final WordComposer composer, public SuggestionResults getSuggestionResults(final WordComposer composer,
final NgramContext ngramContext, final ProximityInfo proximityInfo, final NgramContext ngramContext, final long proximityInfoHandle,
final SettingsValuesForSuggestion settingsValuesForSuggestion, final int sessionId) { final SettingsValuesForSuggestion settingsValuesForSuggestion, final int sessionId) {
final DictionaryGroup[] dictionaryGroups = mDictionaryGroups; final DictionaryGroup[] dictionaryGroups = mDictionaryGroups;
final SuggestionResults suggestionResults = new SuggestionResults( final SuggestionResults suggestionResults = new SuggestionResults(
@ -698,8 +697,8 @@ public class DictionaryFacilitator {
? dictionaryGroup.mWeightForGesturingInLocale ? dictionaryGroup.mWeightForGesturingInLocale
: dictionaryGroup.mWeightForTypingInLocale; : dictionaryGroup.mWeightForTypingInLocale;
final ArrayList<SuggestedWordInfo> dictionarySuggestions = final ArrayList<SuggestedWordInfo> dictionarySuggestions =
dictionary.getSuggestions(composer, ngramContext, proximityInfo, dictionary.getSuggestions(composer.getComposedDataSnapshot(), ngramContext,
settingsValuesForSuggestion, sessionId, proximityInfoHandle, settingsValuesForSuggestion, sessionId,
weightForLocale, weightOfLangModelVsSpatialModel); weightForLocale, weightOfLangModelVsSpatialModel);
if (null == dictionarySuggestions) continue; if (null == dictionarySuggestions) continue;
suggestionResults.addAll(dictionarySuggestions); suggestionResults.addAll(dictionarySuggestions);

View File

@ -20,8 +20,8 @@ import android.content.Context;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.common.ComposedData;
import com.android.inputmethod.latin.common.Constants; import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.makedict.DictionaryHeader; import com.android.inputmethod.latin.makedict.DictionaryHeader;
import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FormatSpec;
@ -480,8 +480,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
} }
@Override @Override
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, public ArrayList<SuggestedWordInfo> getSuggestions(final ComposedData composedData,
final NgramContext ngramContext, final ProximityInfo proximityInfo, final NgramContext ngramContext, final long proximityInfoHandle,
final SettingsValuesForSuggestion settingsValuesForSuggestion, final int sessionId, final SettingsValuesForSuggestion settingsValuesForSuggestion, final int sessionId,
final float weightForLocale, final float[] inOutWeightOfLangModelVsSpatialModel) { final float weightForLocale, final float[] inOutWeightOfLangModelVsSpatialModel) {
reloadDictionaryIfRequired(); reloadDictionaryIfRequired();
@ -494,9 +494,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
return null; return null;
} }
final ArrayList<SuggestedWordInfo> suggestions = final ArrayList<SuggestedWordInfo> suggestions =
mBinaryDictionary.getSuggestions(composer, ngramContext, proximityInfo, mBinaryDictionary.getSuggestions(composedData, ngramContext,
settingsValuesForSuggestion, sessionId, weightForLocale, proximityInfoHandle, settingsValuesForSuggestion, sessionId,
inOutWeightOfLangModelVsSpatialModel); weightForLocale, inOutWeightOfLangModelVsSpatialModel);
if (mBinaryDictionary.isCorrupted()) { if (mBinaryDictionary.isCorrupted()) {
Log.i(TAG, "Dictionary (" + mDictName +") is corrupted. " Log.i(TAG, "Dictionary (" + mDictName +") is corrupted. "
+ "Remove and regenerate it."); + "Remove and regenerate it.");

View File

@ -16,8 +16,8 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.common.ComposedData;
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion; import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,16 +50,16 @@ public final class ReadOnlyBinaryDictionary extends Dictionary {
} }
@Override @Override
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, public ArrayList<SuggestedWordInfo> getSuggestions(final ComposedData composedData,
final NgramContext ngramContext, final ProximityInfo proximityInfo, final NgramContext ngramContext, final long proximityInfoHandle,
final SettingsValuesForSuggestion settingsValuesForSuggestion, final SettingsValuesForSuggestion settingsValuesForSuggestion,
final int sessionId, final float weightForLocale, final int sessionId, final float weightForLocale,
final float[] inOutWeightOfLangModelVsSpatialModel) { final float[] inOutWeightOfLangModelVsSpatialModel) {
if (mLock.readLock().tryLock()) { if (mLock.readLock().tryLock()) {
try { try {
return mBinaryDictionary.getSuggestions(composer, ngramContext, proximityInfo, return mBinaryDictionary.getSuggestions(composedData, ngramContext,
settingsValuesForSuggestion, sessionId, weightForLocale, proximityInfoHandle, settingsValuesForSuggestion, sessionId,
inOutWeightOfLangModelVsSpatialModel); weightForLocale, inOutWeightOfLangModelVsSpatialModel);
} finally { } finally {
mLock.readLock().unlock(); mLock.readLock().unlock();
} }

View File

@ -140,8 +140,8 @@ public final class Suggest {
: typedWord; : typedWord;
final SuggestionResults suggestionResults = mDictionaryFacilitator.getSuggestionResults( final SuggestionResults suggestionResults = mDictionaryFacilitator.getSuggestionResults(
wordComposer, ngramContext, proximityInfo, settingsValuesForSuggestion, wordComposer, ngramContext, proximityInfo.getNativeProximityInfo(),
SESSION_ID_TYPING); settingsValuesForSuggestion, SESSION_ID_TYPING);
final ArrayList<SuggestedWordInfo> suggestionsContainer = final ArrayList<SuggestedWordInfo> suggestionsContainer =
getTransformedSuggestedWordInfoList(wordComposer, suggestionResults, getTransformedSuggestedWordInfoList(wordComposer, suggestionResults,
trailingSingleQuotesCount, trailingSingleQuotesCount,
@ -247,8 +247,8 @@ public final class Suggest {
final int inputStyle, final int sequenceNumber, final int inputStyle, final int sequenceNumber,
final OnGetSuggestedWordsCallback callback) { final OnGetSuggestedWordsCallback callback) {
final SuggestionResults suggestionResults = mDictionaryFacilitator.getSuggestionResults( final SuggestionResults suggestionResults = mDictionaryFacilitator.getSuggestionResults(
wordComposer, ngramContext, proximityInfo, settingsValuesForSuggestion, wordComposer, ngramContext, proximityInfo.getNativeProximityInfo(),
SESSION_ID_GESTURE); settingsValuesForSuggestion, SESSION_ID_GESTURE);
// For transforming words that don't come from a dictionary, because it's our best bet // For transforming words that don't come from a dictionary, because it's our best bet
final Locale defaultLocale = mDictionaryFacilitator.getMostProbableLocale(); final Locale defaultLocale = mDictionaryFacilitator.getMostProbableLocale();
final ArrayList<SuggestedWordInfo> suggestionsContainer = final ArrayList<SuggestedWordInfo> suggestionsContainer =

View File

@ -19,6 +19,7 @@ package com.android.inputmethod.latin;
import com.android.inputmethod.event.CombinerChain; import com.android.inputmethod.event.CombinerChain;
import com.android.inputmethod.event.Event; import com.android.inputmethod.event.Event;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.common.ComposedData;
import com.android.inputmethod.latin.common.Constants; import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.common.InputPointers; import com.android.inputmethod.latin.common.InputPointers;
import com.android.inputmethod.latin.common.StringUtils; import com.android.inputmethod.latin.common.StringUtils;
@ -90,6 +91,10 @@ public final class WordComposer {
refreshTypedWordCache(); refreshTypedWordCache();
} }
public ComposedData getComposedDataSnapshot() {
return new ComposedData(getInputPointers(), isBatchMode(), mTypedWordCache.toString());
}
/** /**
* Restart the combiners, possibly with a new spec. * Restart the combiners, possibly with a new spec.
* @param combiningSpec The spec string for combining. This is found in the extra value. * @param combiningSpec The spec string for combining. This is found in the extra value.
@ -134,38 +139,6 @@ public final class WordComposer {
return mCodePointSize; return mCodePointSize;
} }
/**
* Copy the code points in the typed word to a destination array of ints.
*
* If the array is too small to hold the code points in the typed word, nothing is copied and
* -1 is returned.
*
* @param destination the array of ints.
* @return the number of copied code points.
*/
public int copyCodePointsExceptTrailingSingleQuotesAndReturnCodePointCount(
final int[] destination) {
// This method can be called on a separate thread and mTypedWordCache can change while we
// are executing this method.
final String typedWord = mTypedWordCache.toString();
// lastIndex is exclusive
final int lastIndex = typedWord.length()
- StringUtils.getTrailingSingleQuotesCount(typedWord);
if (lastIndex <= 0) {
// The string is empty or contains only single quotes.
return 0;
}
// The following function counts the number of code points in the text range which begins
// at index 0 and extends to the character at lastIndex.
final int codePointSize = Character.codePointCount(typedWord, 0, lastIndex);
if (codePointSize > destination.length) {
return -1;
}
return StringUtils.copyCodePointsAndReturnCodePointCount(destination, typedWord, 0,
lastIndex, true /* downCase */);
}
public boolean isSingleLetter() { public boolean isSingleLetter() {
return size() == 1; return size() == 1;
} }

View File

@ -168,7 +168,8 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
DictionaryFacilitator dictionaryFacilitatorForLocale = DictionaryFacilitator dictionaryFacilitatorForLocale =
mDictionaryFacilitatorCache.get(locale); mDictionaryFacilitatorCache.get(locale);
return dictionaryFacilitatorForLocale.getSuggestionResults(composer, ngramContext, return dictionaryFacilitatorForLocale.getSuggestionResults(composer, ngramContext,
proximityInfo, mSettingsValuesForSuggestion, sessionId); proximityInfo.getNativeProximityInfo(), mSettingsValuesForSuggestion,
sessionId);
} finally { } finally {
if (sessionId != null) { if (sessionId != null) {
mSessionIdPool.add(sessionId); mSessionIdPool.add(sessionId);

View File

@ -250,8 +250,9 @@ public class DistracterFilterCheckingExactMatchesAndSuggestions implements Distr
composer.setComposingWord(codePoints, coordinates); composer.setComposingWord(codePoints, coordinates);
final SuggestionResults suggestionResults; final SuggestionResults suggestionResults;
synchronized (mLock) { synchronized (mLock) {
suggestionResults = dictionaryFacilitator.getSuggestionResults( suggestionResults = dictionaryFacilitator.getSuggestionResults(composer,
composer, NgramContext.EMPTY_PREV_WORDS_INFO, keyboard.getProximityInfo(), NgramContext.EMPTY_PREV_WORDS_INFO,
keyboard.getProximityInfo().getNativeProximityInfo(),
settingsValuesForSuggestion, 0 /* sessionId */); settingsValuesForSuggestion, 0 /* sessionId */);
} }
if (suggestionResults.isEmpty()) { if (suggestionResults.isEmpty()) {

View File

@ -47,10 +47,8 @@ LATINIME_SRC_FILES_FOR_DICTTOOL := \
latin/BinaryDictionary.java \ latin/BinaryDictionary.java \
latin/DicTraverseSession.java \ latin/DicTraverseSession.java \
latin/Dictionary.java \ latin/Dictionary.java \
latin/LastComposedWord.java \
latin/NgramContext.java \ latin/NgramContext.java \
latin/SuggestedWords.java \ latin/SuggestedWords.java \
latin/WordComposer.java \
latin/settings/NativeSuggestOptions.java \ latin/settings/NativeSuggestOptions.java \
latin/settings/SettingsValuesForSuggestion.java \ latin/settings/SettingsValuesForSuggestion.java \
latin/utils/BinaryDictionaryUtils.java \ latin/utils/BinaryDictionaryUtils.java \