diff options
author | 2015-02-02 17:10:38 -0800 | |
---|---|---|
committer | 2015-02-02 17:10:38 -0800 | |
commit | 15acbdc9050a04f3c5d8724bb3902a57084c96db (patch) | |
tree | 223de661e1cd04dabd8a87cc46bc343b2c3f60f3 /java/src/com/android/inputmethod/latin/personalization | |
parent | 174da5c39541dab78a9d82904f90c28a4c4be436 (diff) | |
download | latinime-15acbdc9050a04f3c5d8724bb3902a57084c96db.tar.gz latinime-15acbdc9050a04f3c5d8724bb3902a57084c96db.tar.xz latinime-15acbdc9050a04f3c5d8724bb3902a57084c96db.zip |
Nuke Amanatto
Change-Id: Ieff2cd37f869dca69abf53ac32a576c2e45cc1e3
Diffstat (limited to 'java/src/com/android/inputmethod/latin/personalization')
5 files changed, 1 insertions, 179 deletions
diff --git a/java/src/com/android/inputmethod/latin/personalization/ContextualDictionary.java b/java/src/com/android/inputmethod/latin/personalization/ContextualDictionary.java deleted file mode 100644 index f663fe96a..000000000 --- a/java/src/com/android/inputmethod/latin/personalization/ContextualDictionary.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.personalization; - -import android.content.Context; - -import com.android.inputmethod.annotations.ExternallyReferenced; -import com.android.inputmethod.latin.Dictionary; -import com.android.inputmethod.latin.ExpandableBinaryDictionary; - -import java.io.File; -import java.util.Locale; - -import javax.annotation.Nullable; - -public class ContextualDictionary extends ExpandableBinaryDictionary { - /* package */ static final String NAME = ContextualDictionary.class.getSimpleName(); - - private ContextualDictionary(final Context context, final Locale locale, - final File dictFile) { - super(context, getDictName(NAME, locale, dictFile), locale, Dictionary.TYPE_CONTEXTUAL, - dictFile); - // Always reset the contents. - clear(); - } - - // Note: This method is called by {@link DictionaryFacilitator} using Java reflection. - @SuppressWarnings("unused") - @ExternallyReferenced - public static ContextualDictionary getDictionary(final Context context, final Locale locale, - final File dictFile, final String dictNamePrefix, @Nullable final String account) { - return new ContextualDictionary(context, locale, dictFile); - } - - @Override - public boolean isValidWord(final String word) { - // Strings out of this dictionary should not be considered existing words. - return false; - } - - @Override - protected void loadInitialContentsLocked() { - } -} diff --git a/java/src/com/android/inputmethod/latin/personalization/DictionaryDecayBroadcastReciever.java b/java/src/com/android/inputmethod/latin/personalization/DictionaryDecayBroadcastReciever.java index e974f3320..0c5e5d010 100644 --- a/java/src/com/android/inputmethod/latin/personalization/DictionaryDecayBroadcastReciever.java +++ b/java/src/com/android/inputmethod/latin/personalization/DictionaryDecayBroadcastReciever.java @@ -84,7 +84,6 @@ public class DictionaryDecayBroadcastReciever extends BroadcastReceiver { final String action = intent.getAction(); if (action.equals(DICTIONARY_DECAY_INTENT_ACTION)) { PersonalizationHelper.runGCOnAllOpenedUserHistoryDictionaries(); - PersonalizationHelper.runGCOnAllOpenedPersonalizationDictionaries(); } } } diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDataChunk.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDataChunk.java deleted file mode 100644 index 734ed5583..000000000 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDataChunk.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.personalization; - -import java.util.Collections; -import java.util.List; - -public class PersonalizationDataChunk { - public static final String LANGUAGE_UNKNOWN = ""; - - public final boolean mInputByUser; - public final List<String> mTokens; - public final int mTimestampInSeconds; - public final String mPackageName; - public final String mDetectedLanguage; - - public PersonalizationDataChunk(boolean inputByUser, final List<String> tokens, - final int timestampInSeconds, final String packageName, final String detectedLanguage) { - mInputByUser = inputByUser; - mTokens = Collections.unmodifiableList(tokens); - mTimestampInSeconds = timestampInSeconds; - mPackageName = packageName; - mDetectedLanguage = detectedLanguage; - } -} diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionary.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionary.java deleted file mode 100644 index 76451cc6b..000000000 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionary.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2013 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.personalization; - -import android.content.Context; - -import com.android.inputmethod.annotations.ExternallyReferenced; -import com.android.inputmethod.latin.Dictionary; - -import java.io.File; -import java.util.Locale; - -import javax.annotation.Nullable; - -public class PersonalizationDictionary extends DecayingExpandableBinaryDictionaryBase { - /* package */ static final String NAME = PersonalizationDictionary.class.getSimpleName(); - - // TODO: Make this constructor private - /* package */ PersonalizationDictionary(final Context context, final Locale locale) { - super(context, getDictName(NAME, locale, null /* dictFile */), locale, - Dictionary.TYPE_PERSONALIZATION, null /* dictFile */); - } - - // Note: This method is called by {@link DictionaryFacilitator} using Java reflection. - @SuppressWarnings("unused") - @ExternallyReferenced - public static PersonalizationDictionary getDictionary(final Context context, - final Locale locale, final File dictFile, final String dictNamePrefix, - @Nullable final String account) { - return PersonalizationHelper.getPersonalizationDictionary(context, locale); - } -} diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationHelper.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationHelper.java index 4231450c1..1c1cb4f95 100644 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationHelper.java +++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationHelper.java @@ -32,8 +32,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; /** - * Helps handle and manage personalized dictionaries such as {@link UserHistoryDictionary} and - * {@link PersonalizationDictionary}. + * Helps handle and manage personalized dictionaries such as {@link UserHistoryDictionary}. */ public class PersonalizationHelper { private static final String TAG = PersonalizationHelper.class.getSimpleName(); @@ -41,8 +40,6 @@ public class PersonalizationHelper { private static final ConcurrentHashMap<String, SoftReference<UserHistoryDictionary>> sLangUserHistoryDictCache = new ConcurrentHashMap<>(); - private static final ConcurrentHashMap<String, SoftReference<PersonalizationDictionary>> - sLangPersonalizationDictCache = new ConcurrentHashMap<>(); @Nonnull public static UserHistoryDictionary getUserHistoryDictionary( @@ -77,7 +74,6 @@ public class PersonalizationHelper { DictionaryDecayBroadcastReciever.DICTIONARY_DECAY_INTERVAL_IN_MILLIS) < currentTimestamp - sCurrentTimestampForTesting) { runGCOnAllOpenedUserHistoryDictionaries(); - runGCOnAllOpenedPersonalizationDictionaries(); } } @@ -85,10 +81,6 @@ public class PersonalizationHelper { runGCOnAllDictionariesIfRequired(sLangUserHistoryDictCache); } - public static void runGCOnAllOpenedPersonalizationDictionaries() { - runGCOnAllDictionariesIfRequired(sLangPersonalizationDictCache); - } - private static <T extends DecayingExpandableBinaryDictionaryBase> void runGCOnAllDictionariesIfRequired( final ConcurrentHashMap<String, SoftReference<T>> dictionaryMap) { @@ -103,32 +95,6 @@ public class PersonalizationHelper { } } - public static PersonalizationDictionary getPersonalizationDictionary( - final Context context, final Locale locale) { - final String localeStr = locale.toString(); - synchronized (sLangPersonalizationDictCache) { - if (sLangPersonalizationDictCache.containsKey(localeStr)) { - final SoftReference<PersonalizationDictionary> ref = - sLangPersonalizationDictCache.get(localeStr); - final PersonalizationDictionary dict = ref == null ? null : ref.get(); - if (dict != null) { - if (DEBUG) { - Log.w(TAG, "Use cached PersonalizationDictionary for " + locale); - } - return dict; - } - } - final PersonalizationDictionary dict = new PersonalizationDictionary(context, locale); - sLangPersonalizationDictCache.put(localeStr, new SoftReference<>(dict)); - return dict; - } - } - - public static void removeAllPersonalizationDictionaries(final Context context) { - removeAllDictionaries(context, sLangPersonalizationDictCache, - PersonalizationDictionary.NAME); - } - public static void removeAllUserHistoryDictionaries(final Context context) { removeAllDictionaries(context, sLangUserHistoryDictCache, UserHistoryDictionary.NAME); |