Merge "Avoid returning an object that's still used internally"

main
Jean Chalard 2011-09-15 00:28:19 -07:00 committed by Android (Google) Code Review
commit 39fe5bfc3c
2 changed files with 4 additions and 6 deletions

View File

@ -306,12 +306,10 @@ public class Suggest implements Dictionary.WordCallback {
Arrays.fill(mScores, 0); Arrays.fill(mScores, 0);
// Save a lowercase version of the original word // Save a lowercase version of the original word
CharSequence typedWord = wordComposer.getTypedWord(); String typedWord = wordComposer.getTypedWord();
if (typedWord != null) { if (typedWord != null) {
final String typedWordString = typedWord.toString();
typedWord = typedWordString;
// Treating USER_TYPED as UNIGRAM suggestion for logging now. // Treating USER_TYPED as UNIGRAM suggestion for logging now.
LatinImeLogger.onAddSuggestedWord(typedWordString, Suggest.DIC_USER_TYPED, LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED,
Dictionary.DataType.UNIGRAM); Dictionary.DataType.UNIGRAM);
} }
mTypedWord = typedWord; mTypedWord = typedWord;

View File

@ -164,11 +164,11 @@ public class WordComposer {
* Returns the word as it was typed, without any correction applied. * Returns the word as it was typed, without any correction applied.
* @return the word that was typed so far * @return the word that was typed so far
*/ */
public CharSequence getTypedWord() { public String getTypedWord() {
if (size() == 0) { if (size() == 0) {
return null; return null;
} }
return mTypedWord; return mTypedWord.toString();
} }
/** /**