Add language to PersonalizationDataChunk.

Bug: 16547557
Change-Id: I11b82667631cbd5263cc08ccb304fc97bf692050
Keisuke Kuroyanagi 2014-08-19 18:27:34 +09:00
parent 1f6e52ef02
commit e66d59e6d8
2 changed files with 5 additions and 4 deletions

View File

@ -18,20 +18,20 @@ package com.android.inputmethod.latin.personalization;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
public class PersonalizationDataChunk { public class PersonalizationDataChunk {
public final boolean mInputByUser; public final boolean mInputByUser;
public final List<String> mTokens; public final List<String> mTokens;
public final int mTimestampInSeconds; public final int mTimestampInSeconds;
public final String mPackageName; public final String mPackageName;
public final Locale mlocale = null; public final String mDetectedLanguage;
public PersonalizationDataChunk(boolean inputByUser, final List<String> tokens, public PersonalizationDataChunk(boolean inputByUser, final List<String> tokens,
final int timestampInSeconds, final String packageName) { final int timestampInSeconds, final String packageName, final String detectedLanguage) {
mInputByUser = inputByUser; mInputByUser = inputByUser;
mTokens = Collections.unmodifiableList(tokens); mTokens = Collections.unmodifiableList(tokens);
mTimestampInSeconds = timestampInSeconds; mTimestampInSeconds = timestampInSeconds;
mPackageName = packageName; mPackageName = packageName;
mDetectedLanguage = detectedLanguage;
} }
} }

View File

@ -78,7 +78,8 @@ public class PersonalizationDictionaryTests extends AndroidTestCase {
tokens.add(CodePointUtils.generateWord(random, codePointSet)); tokens.add(CodePointUtils.generateWord(random, codePointSet));
} }
final PersonalizationDataChunk personalizationDataChunk = new PersonalizationDataChunk( final PersonalizationDataChunk personalizationDataChunk = new PersonalizationDataChunk(
true /* inputByUser */, tokens, timeStampInSeconds, DUMMY_PACKAGE_NAME); true /* inputByUser */, tokens, timeStampInSeconds, DUMMY_PACKAGE_NAME,
LOCALE_EN_US.getLanguage());
final CountDownLatch countDownLatch = new CountDownLatch(1); final CountDownLatch countDownLatch = new CountDownLatch(1);
final AddMultipleDictionaryEntriesCallback callback = final AddMultipleDictionaryEntriesCallback callback =
new AddMultipleDictionaryEntriesCallback() { new AddMultipleDictionaryEntriesCallback() {