diff options
Diffstat (limited to 'java/src')
18 files changed, 168 insertions, 640 deletions
diff --git a/java/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java b/java/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java deleted file mode 100644 index 21535e421..000000000 --- a/java/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java +++ /dev/null @@ -1,29 +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.compat; - -import android.content.pm.PackageInfo; - -public class AppWorkaroundsHelper { - private AppWorkaroundsHelper() { - // This helper class is not publicly instantiable. - } - - public static boolean evaluateIsBrokenByRecorrection(final PackageInfo info) { - return false; - } -} diff --git a/java/src/com/android/inputmethod/compat/CompatUtils.java b/java/src/com/android/inputmethod/compat/CompatUtils.java index 4fd2a6936..6aa2736c1 100644 --- a/java/src/com/android/inputmethod/compat/CompatUtils.java +++ b/java/src/com/android/inputmethod/compat/CompatUtils.java @@ -127,4 +127,92 @@ public final class CompatUtils { Log.e(TAG, "Exception in setFieldValue", e); } } + + public static ClassWrapper getClassWrapper(final String className) { + return new ClassWrapper(getClass(className)); + } + + public static final class ClassWrapper { + private final Class<?> mClass; + public ClassWrapper(final Class<?> targetClass) { + mClass = targetClass; + } + + public boolean exists() { + return mClass != null; + } + + public <T> ToObjectMethodWrapper<T> getMethod(final String name, + final T defaultValue, final Class<?>... parameterTypes) { + return new ToObjectMethodWrapper<T>(CompatUtils.getMethod(mClass, name, parameterTypes), + defaultValue); + } + + public ToIntMethodWrapper getPrimitiveMethod(final String name, final int defaultValue, + final Class<?>... parameterTypes) { + return new ToIntMethodWrapper(CompatUtils.getMethod(mClass, name, parameterTypes), + defaultValue); + } + + public ToFloatMethodWrapper getPrimitiveMethod(final String name, final float defaultValue, + final Class<?>... parameterTypes) { + return new ToFloatMethodWrapper(CompatUtils.getMethod(mClass, name, parameterTypes), + defaultValue); + } + + public ToBooleanMethodWrapper getPrimitiveMethod(final String name, + final boolean defaultValue, final Class<?>... parameterTypes) { + return new ToBooleanMethodWrapper(CompatUtils.getMethod(mClass, name, parameterTypes), + defaultValue); + } + } + + public static final class ToObjectMethodWrapper<T> { + private final Method mMethod; + private final T mDefaultValue; + public ToObjectMethodWrapper(final Method method, final T defaultValue) { + mMethod = method; + mDefaultValue = defaultValue; + } + @SuppressWarnings("unchecked") + public T invoke(final Object receiver, final Object... args) { + return (T) CompatUtils.invoke(receiver, mDefaultValue, mMethod, args); + } + } + + public static final class ToIntMethodWrapper { + private final Method mMethod; + private final int mDefaultValue; + public ToIntMethodWrapper(final Method method, final int defaultValue) { + mMethod = method; + mDefaultValue = defaultValue; + } + public int invoke(final Object receiver, final Object... args) { + return (int) CompatUtils.invoke(receiver, mDefaultValue, mMethod, args); + } + } + + public static final class ToFloatMethodWrapper { + private final Method mMethod; + private final float mDefaultValue; + public ToFloatMethodWrapper(final Method method, final float defaultValue) { + mMethod = method; + mDefaultValue = defaultValue; + } + public float invoke(final Object receiver, final Object... args) { + return (float) CompatUtils.invoke(receiver, mDefaultValue, mMethod, args); + } + } + + public static final class ToBooleanMethodWrapper { + private final Method mMethod; + private final boolean mDefaultValue; + public ToBooleanMethodWrapper(final Method method, final boolean defaultValue) { + mMethod = method; + mDefaultValue = defaultValue; + } + public boolean invoke(final Object receiver, final Object... args) { + return (boolean) CompatUtils.invoke(receiver, mDefaultValue, mMethod, args); + } + } } diff --git a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java index 2cec14240..24eaec85c 100644 --- a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java +++ b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java @@ -21,39 +21,8 @@ import android.graphics.RectF; import com.android.inputmethod.annotations.UsedForTesting; -import java.lang.reflect.Method; - @UsedForTesting public final class CursorAnchorInfoCompatWrapper { - // Note that CursorAnchorInfo has been introduced in API level XX (Build.VERSION_CODE.LXX). - private static Class<?> getCursorAnchorInfoClass() { - try { - return Class.forName("android.view.inputmethod.CursorAnchorInfo"); - } catch (ClassNotFoundException e) { - return null; - } - } - private static final Class<?> CLASS; - private static final Method METHOD_GET_CHARACTER_RECT; - private static final Method METHOD_GET_CHARACTER_RECT_FLAGS; - private static final Method METHOD_GET_COMPOSING_TEXT; - private static final Method METHOD_GET_COMPOSING_TEXT_START; - private static final Method METHOD_GET_MATRIX; - static { - CLASS = getCursorAnchorInfoClass(); - METHOD_GET_CHARACTER_RECT = CompatUtils.getMethod(CLASS, "getCharacterRect", int.class); - METHOD_GET_CHARACTER_RECT_FLAGS = CompatUtils.getMethod(CLASS, "getCharacterRectFlags", - int.class); - METHOD_GET_COMPOSING_TEXT = CompatUtils.getMethod(CLASS, "getComposingText"); - METHOD_GET_COMPOSING_TEXT_START = CompatUtils.getMethod(CLASS, "getComposingTextStart"); - METHOD_GET_MATRIX = CompatUtils.getMethod(CLASS, "getMatrix"); - } - - @UsedForTesting - public static boolean isAvailable() { - return CLASS != null; - } - public static final int CHARACTER_RECT_TYPE_MASK = 0x0f; /** @@ -83,6 +52,49 @@ public final class CursorAnchorInfoCompatWrapper { */ public static final int CHARACTER_RECT_TYPE_NOT_FEASIBLE = 4; + // Note that CursorAnchorInfo has been introduced in API level XX (Build.VERSION_CODE.LXX). + private static final CompatUtils.ClassWrapper sCursorAnchorInfoClass; + private static final CompatUtils.ToObjectMethodWrapper<RectF> sGetCharacterRectMethod; + private static final CompatUtils.ToIntMethodWrapper sGetCharacterRectFlagsMethod; + private static final CompatUtils.ToObjectMethodWrapper<CharSequence> sGetComposingTextMethod; + private static final CompatUtils.ToIntMethodWrapper sGetComposingTextStartMethod; + private static final CompatUtils.ToFloatMethodWrapper sGetInsertionMarkerBaselineMethod; + private static final CompatUtils.ToFloatMethodWrapper sGetInsertionMarkerBottomMethod; + private static final CompatUtils.ToFloatMethodWrapper sGetInsertionMarkerHorizontalMethod; + private static final CompatUtils.ToFloatMethodWrapper sGetInsertionMarkerTopMethod; + private static final CompatUtils.ToObjectMethodWrapper<Matrix> sGetMatrixMethod; + private static final CompatUtils.ToBooleanMethodWrapper sIsInsertionMarkerClippedMethod; + + private static int COMPOSING_TEXT_START_DEFAULT = -1; + static { + sCursorAnchorInfoClass = CompatUtils.getClassWrapper( + "android.view.inputmethod.CursorAnchorInfo"); + sGetCharacterRectMethod = sCursorAnchorInfoClass.getMethod( + "getCharacterRect", (RectF)null, int.class); + sGetCharacterRectFlagsMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getCharacterRectFlags", CHARACTER_RECT_TYPE_UNSPECIFIED, int.class); + sGetComposingTextMethod = sCursorAnchorInfoClass.getMethod( + "getComposingText", (CharSequence)null); + sGetComposingTextStartMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getComposingTextStart", COMPOSING_TEXT_START_DEFAULT); + sGetInsertionMarkerBaselineMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getInsertionMarkerBaseline", 0.0f); + sGetInsertionMarkerBottomMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getInsertionMarkerBottom", 0.0f); + sGetInsertionMarkerHorizontalMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getInsertionMarkerHorizontal", 0.0f); + sGetInsertionMarkerTopMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getInsertionMarkerTop", 0.0f); + sGetMatrixMethod = sCursorAnchorInfoClass.getMethod("getMatrix", (Matrix)null); + sIsInsertionMarkerClippedMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "isInsertionMarkerClipped", false); + } + + @UsedForTesting + public static boolean isAvailable() { + return sCursorAnchorInfoClass.exists(); + } + private Object mInstance; private CursorAnchorInfoCompatWrapper(final Object instance) { @@ -107,29 +119,42 @@ public final class CursorAnchorInfoCompatWrapper { } public CharSequence getComposingText() { - return (CharSequence) CompatUtils.invoke(mInstance, null, METHOD_GET_COMPOSING_TEXT); + return sGetComposingTextMethod.invoke(mInstance); } - private static int COMPOSING_TEXT_START_DEFAULT = -1; public int getComposingTextStart() { - if (mInstance == null || METHOD_GET_COMPOSING_TEXT_START == null) { - return COMPOSING_TEXT_START_DEFAULT; - } - return (int) CompatUtils.invoke(mInstance, null, METHOD_GET_COMPOSING_TEXT_START); + return sGetComposingTextStartMethod.invoke(mInstance); } public Matrix getMatrix() { - return (Matrix) CompatUtils.invoke(mInstance, null, METHOD_GET_MATRIX); + return sGetMatrixMethod.invoke(mInstance); } public RectF getCharacterRect(final int index) { - return (RectF) CompatUtils.invoke(mInstance, null, METHOD_GET_CHARACTER_RECT, index); + return sGetCharacterRectMethod.invoke(mInstance, index); } public int getCharacterRectFlags(final int index) { - if (mInstance == null || METHOD_GET_CHARACTER_RECT_FLAGS == null) { - return CHARACTER_RECT_TYPE_UNSPECIFIED; - } - return (int) CompatUtils.invoke(mInstance, null, METHOD_GET_CHARACTER_RECT_FLAGS, index); + return sGetCharacterRectFlagsMethod.invoke(mInstance, index); + } + + public float getInsertionMarkerBaseline() { + return sGetInsertionMarkerBaselineMethod.invoke(mInstance); + } + + public float getInsertionMarkerBottom() { + return sGetInsertionMarkerBottomMethod.invoke(mInstance); + } + + public float getInsertionMarkerHorizontal() { + return sGetInsertionMarkerHorizontalMethod.invoke(mInstance); + } + + public float getInsertionMarkerTop() { + return sGetInsertionMarkerTopMethod.invoke(mInstance); + } + + public boolean isInsertionMarkerClipped() { + return sIsInsertionMarkerClippedMethod.invoke(mInstance); } } diff --git a/java/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java b/java/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java deleted file mode 100644 index df0e3f0e1..000000000 --- a/java/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java +++ /dev/null @@ -1,65 +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.dictionarypack; - -/** - * A class to group constants for dictionary pack usage. - * - * This class only defines constants. It should not make any references to outside code as far as - * possible, as it's used to separate cleanly the keyboard code from the dictionary pack code; this - * is needed in particular to cleanly compile regression tests. - */ -public class DictionaryPackConstants { - /** - * The root domain for the dictionary pack, upon which authorities and actions will append - * their own distinctive strings. - */ - private static final String DICTIONARY_DOMAIN = "com.android.inputmethod.dictionarypack.aosp"; - - /** - * Authority for the ContentProvider protocol. - */ - // TODO: find some way to factorize this string with the one in the resources - public static final String AUTHORITY = DICTIONARY_DOMAIN; - - /** - * The action of the intent for publishing that new dictionary data is available. - */ - // TODO: make this different across different packages. A suggested course of action is - // to use the package name inside this string. - // NOTE: The appended string should be uppercase like all other actions, but it's not for - // historical reasons. - public static final String NEW_DICTIONARY_INTENT_ACTION = DICTIONARY_DOMAIN + ".newdict"; - - /** - * The action of the intent sent by the dictionary pack to ask for a client to make - * itself known. This is used when the settings activity is brought up for a client the - * dictionary pack does not know about. - */ - public static final String UNKNOWN_DICTIONARY_PROVIDER_CLIENT = DICTIONARY_DOMAIN - + ".UNKNOWN_CLIENT"; - - // In the above intents, the name of the string extra that contains the name of the client - // we want information about. - public static final String DICTIONARY_PROVIDER_CLIENT_EXTRA = "client"; - - /** - * The action of the intent to tell the dictionary provider to update now. - */ - public static final String UPDATE_NOW_INTENT_ACTION = DICTIONARY_DOMAIN - + ".UPDATE_NOW"; -} diff --git a/java/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java b/java/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java deleted file mode 100644 index ed817658e..000000000 --- a/java/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java +++ /dev/null @@ -1,33 +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.dictionarypack; - -import android.content.Context; - -/** - * Helper to get the metadata URI from its base URI and the additional ID, if any. - */ -public class MetadataUriGetter { - private MetadataUriGetter() { - // This helper class is not instantiable. - } - - public static String getUri(final Context context, final String baseUri, - final String additionalId) { - return baseUri; - } -} diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 258f21f7c..eec08f2d3 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -420,18 +420,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (latinIme != null) { executePendingImsCallback(latinIme, editorInfo, restarting); latinIme.onStartInputInternal(editorInfo, restarting); - if (ProductionFlags.ENABLE_CURSOR_RECT_CALLBACK) { - InputConnectionCompatUtils.requestCursorRect( - latinIme.getCurrentInputConnection(), true /* enableMonitor */); - } - if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) { - // AcceptTypedWord feature relies on CursorAnchorInfo. - if (latinIme.mSettings.getCurrent().mShouldShowUiToAcceptTypedWord) { - InputConnectionCompatUtils.requestCursorAnchorInfo( - latinIme.getCurrentInputConnection(), true /* enableMonitor */, - true /* requestImmediateCallback */); - } - } } } } @@ -766,6 +754,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) { super.onStartInput(editorInfo, restarting); + if (ProductionFlags.ENABLE_CURSOR_RECT_CALLBACK) { + InputConnectionCompatUtils.requestCursorRect(getCurrentInputConnection(), + true /* enableMonitor */); + } + if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) { + // AcceptTypedWord feature relies on CursorAnchorInfo. + if (mSettings.getCurrent().mShouldShowUiToAcceptTypedWord) { + InputConnectionCompatUtils.requestCursorAnchorInfo( + getCurrentInputConnection(), true /* enableMonitor */, + true /* requestImmediateCallback */); + } + } } @SuppressWarnings("deprecation") diff --git a/java/src/com/android/inputmethod/latin/SpecialKeyDetector.java b/java/src/com/android/inputmethod/latin/SpecialKeyDetector.java deleted file mode 100644 index 27b2f5012..000000000 --- a/java/src/com/android/inputmethod/latin/SpecialKeyDetector.java +++ /dev/null @@ -1,43 +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; - -import android.content.Context; -import android.view.KeyEvent; - -final class SpecialKeyDetector { - /** - * Special physical key detector - * @param context a context of this detector. - */ - public SpecialKeyDetector(final Context context) { - } - - /** - * Record a down key event. - * @param keyEvent a down key event. - */ - public void onKeyDown(final KeyEvent keyEvent) { - } - - /** - * Record an up key event. - * @param keyEvent an up key event. - */ - public void onKeyUp(final KeyEvent keyEvent) { - } -} diff --git a/java/src/com/android/inputmethod/latin/about/AboutPreferences.java b/java/src/com/android/inputmethod/latin/about/AboutPreferences.java deleted file mode 100644 index f60b189f1..000000000 --- a/java/src/com/android/inputmethod/latin/about/AboutPreferences.java +++ /dev/null @@ -1,28 +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.about; - -import android.app.Fragment; - -/** - * Dummy class of AboutPreferences. Never use this. - */ -public final class AboutPreferences extends Fragment { - private AboutPreferences() { - // Prevents this from being instantiated - } -} diff --git a/java/src/com/android/inputmethod/latin/define/DebugFlags.java b/java/src/com/android/inputmethod/latin/define/DebugFlags.java deleted file mode 100644 index c509e8322..000000000 --- a/java/src/com/android/inputmethod/latin/define/DebugFlags.java +++ /dev/null @@ -1,31 +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.define; - -import android.content.SharedPreferences; - -public final class DebugFlags { - public static final boolean DEBUG_ENABLED = false; - - private DebugFlags() { - // This class is not publicly instantiable. - } - - @SuppressWarnings("unused") - public static void init(final SharedPreferences prefs) { - } -} diff --git a/java/src/com/android/inputmethod/latin/define/JniLibName.java b/java/src/com/android/inputmethod/latin/define/JniLibName.java deleted file mode 100644 index abfc36d39..000000000 --- a/java/src/com/android/inputmethod/latin/define/JniLibName.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2011 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.define; - -public final class JniLibName { - private JniLibName() { - // This class is not publicly instantiable. - } - - public static final String JNI_LIB_NAME = "jni_latinime"; -} diff --git a/java/src/com/android/inputmethod/latin/define/ProductionFlags.java b/java/src/com/android/inputmethod/latin/define/ProductionFlags.java deleted file mode 100644 index 461c226a1..000000000 --- a/java/src/com/android/inputmethod/latin/define/ProductionFlags.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2012 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.define; - -public final class ProductionFlags { - private ProductionFlags() { - // This class is not publicly instantiable. - } - - public static final boolean IS_HARDWARE_KEYBOARD_SUPPORTED = false; - - /** - * When true, enable {@link InputMethodService#onUpdateCursorAnchorInfo} callback via - * {@link InputConnection#requestCursorAnchorInfo}. This flag has no effect in API Level 20 - * and prior. In general, this callback provides more detailed positional information, - * even though an explicit support is required by the editor. - */ - public static final boolean ENABLE_CURSOR_ANCHOR_INFO_CALLBACK = true; - - /** - * When true, enable {@link InputMethodService#onUpdateCursor} callback via - * {@link InputConnection#requestCursorAnchorInfo}. Although this callback has been available - * since API Level 3, the callback has never been used until API Level 20. Thus it may or may - * not work well as expected. Should rely on {@link InputMethodService#onUpdateCursorAnchorInfo} - * whenever possible since it is supposed to be more reliable and accurate. - */ - public static final boolean ENABLE_CURSOR_RECT_CALLBACK = false; - - /** - * Include all suggestions from all dictionaries in {@link SuggestedWords#mRawSuggestions}. - */ - public static final boolean INCLUDE_RAW_SUGGESTIONS = false; - - /** - * When false, the metrics logging is not yet ready to be enabled. - */ - public static final boolean IS_METRICS_LOGGING_SUPPORTED = false; -} diff --git a/java/src/com/android/inputmethod/latin/personalization/ContextualDictionaryUpdater.java b/java/src/com/android/inputmethod/latin/personalization/ContextualDictionaryUpdater.java deleted file mode 100644 index 7dc120e06..000000000 --- a/java/src/com/android/inputmethod/latin/personalization/ContextualDictionaryUpdater.java +++ /dev/null @@ -1,37 +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.latin.DictionaryFacilitator; - -public class ContextualDictionaryUpdater { - public ContextualDictionaryUpdater(final Context context, - final DictionaryFacilitator dictionaryFacilitator, - final Runnable onUpdateRunnable) { - } - - public void onLoadSettings(final boolean usePersonalizedDicts) { - } - - public void onStartInputView(final String packageName) { - } - - public void onDestroy() { - } -} diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdater.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdater.java deleted file mode 100644 index c97a0d232..000000000 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdater.java +++ /dev/null @@ -1,52 +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.Locale; - -import android.content.Context; - -import com.android.inputmethod.latin.DictionaryFacilitator; - -public class PersonalizationDictionaryUpdater { - final Context mContext; - final DictionaryFacilitator mDictionaryFacilitator; - boolean mDictCleared = false; - - public PersonalizationDictionaryUpdater(final Context context, - final DictionaryFacilitator dictionaryFacilitator) { - mContext = context; - mDictionaryFacilitator = dictionaryFacilitator; - } - - public Locale getLocale() { - return null; - } - - public void onLoadSettings(final boolean usePersonalizedDicts, - final boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes) { - if (!mDictCleared) { - // Clear and never update the personalization dictionary. - PersonalizationHelper.removeAllPersonalizationDictionaries(mContext); - mDictionaryFacilitator.clearPersonalizationDictionary(); - mDictCleared = true; - } - } - - public void onDestroy() { - } -} diff --git a/java/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java b/java/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java deleted file mode 100644 index 6543003e8..000000000 --- a/java/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java +++ /dev/null @@ -1,43 +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.settings; - -import android.content.Context; -import android.content.SharedPreferences; - -import com.android.inputmethodcommon.InputMethodSettingsFragment; - -/** - * Utility class for managing additional features settings. - */ -public class AdditionalFeaturesSettingUtils { - public static final int ADDITIONAL_FEATURES_SETTINGS_SIZE = 0; - - private AdditionalFeaturesSettingUtils() { - // This utility class is not publicly instantiable. - } - - public static void addAdditionalFeaturesPreferences( - final Context context, final InputMethodSettingsFragment settingsFragment) { - // do nothing. - } - - public static void readAdditionalFeaturesPreferencesIntoArray( - final SharedPreferences prefs, final int[] additionalFeaturesPreferences) { - // do nothing. - } -} diff --git a/java/src/com/android/inputmethod/latin/utils/FeedbackUtils.java b/java/src/com/android/inputmethod/latin/utils/FeedbackUtils.java deleted file mode 100644 index 0aed41ee4..000000000 --- a/java/src/com/android/inputmethod/latin/utils/FeedbackUtils.java +++ /dev/null @@ -1,37 +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.utils; - -import android.content.Context; -import android.content.Intent; - -public class FeedbackUtils { - public static boolean isHelpAndFeedbackFormSupported() { - return false; - } - - public static void showHelpAndFeedbackForm(Context context) { - } - - public static int getAboutKeyboardTitleResId() { - return 0; - } - - public static Intent getAboutKeyboardIntent(Context context) { - return null; - } -} diff --git a/java/src/com/android/inputmethod/latin/utils/FileTransforms.java b/java/src/com/android/inputmethod/latin/utils/FileTransforms.java deleted file mode 100644 index 9f4584ec9..000000000 --- a/java/src/com/android/inputmethod/latin/utils/FileTransforms.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2011 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.utils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.GZIPInputStream; - -public final class FileTransforms { - public static OutputStream getCryptedStream(OutputStream out) { - // Crypt the stream. - return out; - } - - public static InputStream getDecryptedStream(InputStream in) { - // Decrypt the stream. - return in; - } - - public static InputStream getUncompressedStream(InputStream in) throws IOException { - return new GZIPInputStream(in); - } -} diff --git a/java/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java b/java/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java deleted file mode 100644 index 9ad319da6..000000000 --- a/java/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java +++ /dev/null @@ -1,38 +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.utils; - -import com.android.inputmethod.latin.R; - -import android.content.Context; - -/** - * Helper class to get the metadata URI and the additional ID. - */ -public class MetadataFileUriGetter { - private MetadataFileUriGetter() { - // This helper class is not instantiable. - } - - public static String getMetadataUri(final Context context) { - return context.getString(R.string.dictionary_pack_metadata_uri); - } - - public static String getMetadataAdditionalId(final Context context) { - return ""; - } -} diff --git a/java/src/com/android/inputmethod/latin/utils/StatsUtils.java b/java/src/com/android/inputmethod/latin/utils/StatsUtils.java deleted file mode 100644 index 79c19d077..000000000 --- a/java/src/com/android/inputmethod/latin/utils/StatsUtils.java +++ /dev/null @@ -1,34 +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.utils; - -import android.content.Context; -import com.android.inputmethod.latin.settings.SettingsValues; - -public final class StatsUtils { - public static void init(final Context context) { - } - - public static void onCreate(final SettingsValues settingsValues) { - } - - public static void onLoadSettings(final SettingsValues settingsValues) { - } - - public static void onDestroy() { - } -} |