From 7a2459ca13c42ae3f3e07d43b671e78d5c4939c7 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Sun, 6 May 2018 20:46:17 -0700 Subject: Merge java-overridable/ into java/ again This CL a logical revert of a previous CL [1], which separated Java files into common ones and overridable ones. Now that that overriding concept is no longer used, there is no need to keep having separate directory structure. [1]: Ic734bd4d20aa050c688a3158b1a382ae0ac18991 fb74ab15c1343084740d65ef8744cad33a678e82 Fix: 79323502 Test: make -j aosp_taimen-userdebug && make -j Test: tapas LatinIME && make -j Change-Id: I2090bc25d18e6d4f24e91c2cbfe832755cbb4e8f --- .../inputmethod/compat/AppWorkaroundsHelper.java | 30 ------ .../dictionarypack/DictionaryPackConstants.java | 72 -------------- .../dictionarypack/MetadataUriGetter.java | 29 ------ .../latin/DictionaryFacilitatorProvider.java | 26 ----- .../inputmethod/latin/about/AboutPreferences.java | 28 ------ .../accounts/AccountStateChangedListener.java | 75 -------------- .../latin/accounts/LoginAccountUtils.java | 47 --------- .../inputmethod/latin/define/DebugFlags.java | 31 ------ .../latin/define/DecoderSpecificConstants.java | 38 ------- .../inputmethod/latin/define/JniLibName.java | 25 ----- .../inputmethod/latin/define/ProductionFlags.java | 58 ----------- .../settings/AdditionalFeaturesSettingUtils.java | 57 ----------- .../latin/touchinputconsumer/GestureConsumer.java | 69 ------------- .../latin/utils/DictionaryHeaderUtils.java | 31 ------ .../inputmethod/latin/utils/FeedbackUtils.java | 38 ------- .../inputmethod/latin/utils/FileTransforms.java | 38 ------- .../latin/utils/ManagedProfileUtils.java | 43 -------- .../latin/utils/MetadataFileUriGetter.java | 39 -------- .../inputmethod/latin/utils/StatsUtils.java | 110 --------------------- .../inputmethod/latin/utils/StatsUtilsManager.java | 56 ----------- java/Android.mk | 2 +- .../inputmethod/compat/AppWorkaroundsHelper.java | 30 ++++++ .../dictionarypack/DictionaryPackConstants.java | 72 ++++++++++++++ .../dictionarypack/MetadataUriGetter.java | 29 ++++++ .../latin/DictionaryFacilitatorProvider.java | 26 +++++ .../inputmethod/latin/about/AboutPreferences.java | 28 ++++++ .../accounts/AccountStateChangedListener.java | 75 ++++++++++++++ .../latin/accounts/LoginAccountUtils.java | 47 +++++++++ .../inputmethod/latin/define/DebugFlags.java | 31 ++++++ .../latin/define/DecoderSpecificConstants.java | 38 +++++++ .../inputmethod/latin/define/JniLibName.java | 25 +++++ .../inputmethod/latin/define/ProductionFlags.java | 58 +++++++++++ .../settings/AdditionalFeaturesSettingUtils.java | 57 +++++++++++ .../latin/touchinputconsumer/GestureConsumer.java | 69 +++++++++++++ .../latin/utils/DictionaryHeaderUtils.java | 31 ++++++ .../inputmethod/latin/utils/FeedbackUtils.java | 38 +++++++ .../inputmethod/latin/utils/FileTransforms.java | 38 +++++++ .../latin/utils/ManagedProfileUtils.java | 43 ++++++++ .../latin/utils/MetadataFileUriGetter.java | 39 ++++++++ .../inputmethod/latin/utils/StatsUtils.java | 110 +++++++++++++++++++++ .../inputmethod/latin/utils/StatsUtilsManager.java | 56 +++++++++++ 41 files changed, 941 insertions(+), 941 deletions(-) delete mode 100644 java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java delete mode 100644 java-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java delete mode 100644 java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/about/AboutPreferences.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/define/DebugFlags.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/define/JniLibName.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/utils/FileTransforms.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java delete mode 100644 java-overridable/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java create mode 100644 java/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java create mode 100644 java/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java create mode 100644 java/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java create mode 100644 java/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java create mode 100644 java/src/com/android/inputmethod/latin/about/AboutPreferences.java create mode 100644 java/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java create mode 100644 java/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java create mode 100644 java/src/com/android/inputmethod/latin/define/DebugFlags.java create mode 100644 java/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java create mode 100644 java/src/com/android/inputmethod/latin/define/JniLibName.java create mode 100644 java/src/com/android/inputmethod/latin/define/ProductionFlags.java create mode 100644 java/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java create mode 100644 java/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java create mode 100644 java/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java create mode 100644 java/src/com/android/inputmethod/latin/utils/FeedbackUtils.java create mode 100644 java/src/com/android/inputmethod/latin/utils/FileTransforms.java create mode 100644 java/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java create mode 100644 java/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java create mode 100644 java/src/com/android/inputmethod/latin/utils/StatsUtils.java create mode 100644 java/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java diff --git a/java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java b/java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java deleted file mode 100644 index f5e56eb4b..000000000 --- a/java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java +++ /dev/null @@ -1,30 +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; - -@SuppressWarnings("unused") -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-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java b/java-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java deleted file mode 100644 index 13caea403..000000000 --- a/java-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java +++ /dev/null @@ -1,72 +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"; - - /** - * The intent action to inform the dictionary provider to initialize the db - * and update now. - */ - public static final String INIT_AND_UPDATE_NOW_INTENT_ACTION = DICTIONARY_DOMAIN - + ".INIT_AND_UPDATE_NOW"; -} diff --git a/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java b/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java deleted file mode 100644 index 512d426aa..000000000 --- a/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.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.dictionarypack; - -import android.content.Context; - -/** - * Helper to get the metadata URI from its base URI. - */ -@SuppressWarnings("unused") -public class MetadataUriGetter { - public static String getUri(final Context context, final String baseUri) { - return baseUri; - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java b/java-overridable/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java deleted file mode 100644 index a48b41fa7..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java +++ /dev/null @@ -1,26 +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; - -/** - * Factory for instantiating DictionaryFacilitator objects. - */ -public class DictionaryFacilitatorProvider { - public static DictionaryFacilitator getDictionaryFacilitator(boolean isNeededForSpellChecking) { - return new DictionaryFacilitatorImpl(); - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/about/AboutPreferences.java b/java-overridable/src/com/android/inputmethod/latin/about/AboutPreferences.java deleted file mode 100644 index f60b189f1..000000000 --- a/java-overridable/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-overridable/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java b/java-overridable/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java deleted file mode 100644 index 60d420fc3..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java +++ /dev/null @@ -1,75 +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.accounts; - -import android.support.annotation.NonNull; - -import javax.annotation.Nullable; - -/** - * Handles changes to account used to sign in to the keyboard. - * e.g. account switching/sign-in/sign-out from the keyboard - * user toggling the sync preference. - */ -public class AccountStateChangedListener { - - /** - * Called when the current account being used in keyboard is signed out. - * - * @param oldAccount the account that was signed out of. - */ - public static void onAccountSignedOut(@NonNull String oldAccount) { - } - - /** - * Called when the user signs-in to the keyboard. - * This may be called when the user switches accounts to sign in with a different account. - * - * @param oldAccount the previous account that was being used for sign-in. - * May be null for a fresh sign-in. - * @param newAccount the account being used for sign-in. - */ - public static void onAccountSignedIn(@Nullable String oldAccount, @NonNull String newAccount) { - } - - /** - * Called when the user toggles the sync preference. - * - * @param account the account being used for sync. - * @param syncEnabled indicates whether sync has been enabled or not. - */ - public static void onSyncPreferenceChanged(@Nullable String account, boolean syncEnabled) { - } - - /** - * Forces an immediate sync to happen. - * This should only be used for debugging purposes. - * - * @param account the account to use for sync. - */ - public static void forceSync(@Nullable String account) { - } - - /** - * Forces an immediate deletion of user's data. - * This should only be used for debugging purposes. - * - * @param account the account to use for sync. - */ - public static void forceDelete(@Nullable String account) { - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java b/java-overridable/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java deleted file mode 100644 index dcc64a223..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java +++ /dev/null @@ -1,47 +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.accounts; - -import android.content.Context; - -import javax.annotation.Nonnull; - -/** - * Utility class for retrieving accounts that may be used for login. - */ -public class LoginAccountUtils { - /** - * This defines the type of account this class deals with. - * This account type is used when listing the accounts available on the device for login. - */ - public static final String ACCOUNT_TYPE = ""; - - private LoginAccountUtils() { - // This utility class is not publicly instantiable. - } - - /** - * Get the accounts available for login. - * - * @return an array of accounts. Empty (never null) if no accounts are available for login. - */ - @Nonnull - @SuppressWarnings("unused") - public static String[] getAccountsForLogin(final Context context) { - return new String[0]; - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/define/DebugFlags.java b/java-overridable/src/com/android/inputmethod/latin/define/DebugFlags.java deleted file mode 100644 index c509e8322..000000000 --- a/java-overridable/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-overridable/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java b/java-overridable/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java deleted file mode 100644 index 7f57ce858..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015 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; - -/** - * Decoder specific constants for LatinIme. - */ -public class DecoderSpecificConstants { - - // Must be equal to MAX_WORD_LENGTH in native/jni/src/defines.h - public static final int DICTIONARY_MAX_WORD_LENGTH = 48; - - // (MAX_PREV_WORD_COUNT_FOR_N_GRAM + 1)-gram is supported in Java side. Needs to modify - // MAX_PREV_WORD_COUNT_FOR_N_GRAM in native/jni/src/defines.h for suggestions. - public static final int MAX_PREV_WORD_COUNT_FOR_N_GRAM = 3; - - public static final String DECODER_DICT_SUFFIX = ""; - - public static final boolean SHOULD_VERIFY_MAGIC_NUMBER = true; - public static final boolean SHOULD_VERIFY_CHECKSUM = true; - public static final boolean SHOULD_USE_DICT_VERSION = true; - public static final boolean SHOULD_AUTO_CORRECT_USING_NON_WHITE_LISTED_SUGGESTION = false; - public static final boolean SHOULD_REMOVE_PREVIOUSLY_REJECTED_SUGGESTION = true; -} diff --git a/java-overridable/src/com/android/inputmethod/latin/define/JniLibName.java b/java-overridable/src/com/android/inputmethod/latin/define/JniLibName.java deleted file mode 100644 index abfc36d39..000000000 --- a/java-overridable/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-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java b/java-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java deleted file mode 100644 index f31c20822..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java +++ /dev/null @@ -1,58 +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; - - /** - * Include all suggestions from all dictionaries in - * {@link com.android.inputmethod.latin.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; - - /** - * When {@code false}, the split keyboard is not yet ready to be enabled. - */ - public static final boolean IS_SPLIT_KEYBOARD_SUPPORTED = true; - - /** - * When {@code false}, account sign-in in keyboard is not yet ready to be enabled. - */ - public static final boolean ENABLE_ACCOUNT_SIGN_IN = false; - - /** - * When {@code true}, user history dictionary sync feature is ready to be enabled. - */ - public static final boolean ENABLE_USER_HISTORY_DICTIONARY_SYNC = - ENABLE_ACCOUNT_SIGN_IN && false; - - /** - * When {@code true}, the IME maintains per account {@link UserHistoryDictionary}. - */ - public static final boolean ENABLE_PER_ACCOUNT_USER_HISTORY_DICTIONARY = - ENABLE_ACCOUNT_SIGN_IN && false; -} diff --git a/java-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java b/java-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java deleted file mode 100644 index 4e8a10b1f..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java +++ /dev/null @@ -1,57 +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 android.preference.PreferenceFragment; -import android.view.inputmethod.InputMethodSubtype; - -import com.android.inputmethod.latin.RichInputMethodSubtype; -import com.android.inputmethod.latin.RichInputMethodManager; - -import javax.annotation.Nonnull; - -/** - * Utility class for managing additional features settings. - */ -@SuppressWarnings("unused") -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 PreferenceFragment settingsFragment) { - // do nothing. - } - - public static void readAdditionalFeaturesPreferencesIntoArray(final Context context, - final SharedPreferences prefs, final int[] additionalFeaturesPreferences) { - // do nothing. - } - - @Nonnull - public static RichInputMethodSubtype createRichInputMethodSubtype( - @Nonnull final RichInputMethodManager imm, - @Nonnull final InputMethodSubtype subtype, - final Context context) { - return new RichInputMethodSubtype(subtype); - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java b/java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java deleted file mode 100644 index 8291b4f72..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java +++ /dev/null @@ -1,69 +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.touchinputconsumer; - -import android.view.inputmethod.EditorInfo; - -import com.android.inputmethod.keyboard.Keyboard; -import com.android.inputmethod.latin.DictionaryFacilitator; -import com.android.inputmethod.latin.SuggestedWords; -import com.android.inputmethod.latin.common.InputPointers; -import com.android.inputmethod.latin.inputlogic.PrivateCommandPerformer; - -import java.util.Locale; - -/** - * Stub for GestureConsumer. - *
- * The methods of this class should only be called from a single thread, e.g., - * the UI Thread. - */ -@SuppressWarnings("unused") -public class GestureConsumer { - public static final GestureConsumer NULL_GESTURE_CONSUMER = - new GestureConsumer(); - - public static GestureConsumer newInstance( - final EditorInfo editorInfo, final PrivateCommandPerformer commandPerformer, - final Locale locale, final Keyboard keyboard) { - return GestureConsumer.NULL_GESTURE_CONSUMER; - } - - private GestureConsumer() { - } - - public boolean willConsume() { - return false; - } - - public void onInit(final Locale locale, final Keyboard keyboard) { - } - - public void onGestureStarted(final Locale locale, final Keyboard keyboard) { - } - - public void onGestureCanceled() { - } - - public void onGestureCompleted(final InputPointers inputPointers) { - } - - public void onImeSuggestionsProcessed(final SuggestedWords suggestedWords, - final int composingStart, final int composingLength, - final DictionaryFacilitator dictionaryFacilitator) { - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java deleted file mode 100644 index 5eb613c9b..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2015 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.AssetFileAddress; -import com.android.inputmethod.latin.makedict.DictionaryHeader; - -import java.io.File; - -public class DictionaryHeaderUtils { - - public static int getContentVersion(AssetFileAddress fileAddress) { - final DictionaryHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull( - new File(fileAddress.mFilename), fileAddress.mOffset, fileAddress.mLength); - return Integer.parseInt(header.mVersionString); - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.java deleted file mode 100644 index 67de8ba32..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.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 android.content.Context; -import android.content.Intent; - -@SuppressWarnings("unused") -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-overridable/src/com/android/inputmethod/latin/utils/FileTransforms.java b/java-overridable/src/com/android/inputmethod/latin/utils/FileTransforms.java deleted file mode 100644 index 9f4584ec9..000000000 --- a/java-overridable/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-overridable/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java deleted file mode 100644 index ef1872bf4..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.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.utils; - -import android.content.Context; - -import com.android.inputmethod.annotations.UsedForTesting; - -public class ManagedProfileUtils { - private static ManagedProfileUtils INSTANCE = new ManagedProfileUtils(); - private static ManagedProfileUtils sTestInstance; - - private ManagedProfileUtils() { - // This utility class is not publicly instantiable. - } - - @UsedForTesting - public static void setTestInstance(final ManagedProfileUtils testInstance) { - sTestInstance = testInstance; - } - - public static ManagedProfileUtils getInstance() { - return sTestInstance == null ? INSTANCE : sTestInstance; - } - - public boolean hasWorkProfile(final Context context) { - return false; - } -} \ No newline at end of file diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java b/java-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java deleted file mode 100644 index 97fb17de3..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java +++ /dev/null @@ -1,39 +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. - */ -@SuppressWarnings("unused") -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-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java deleted file mode 100644 index 03e58478b..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java +++ /dev/null @@ -1,110 +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.view.inputmethod.InputMethodSubtype; - -import com.android.inputmethod.latin.DictionaryFacilitator; -import com.android.inputmethod.latin.RichInputMethodManager; -import com.android.inputmethod.latin.SuggestedWords; -import com.android.inputmethod.latin.settings.SettingsValues; - -import javax.annotation.Nullable; - -@SuppressWarnings("unused") -public final class StatsUtils { - - private StatsUtils() { - // Intentional empty constructor. - } - - public static void onCreate(final SettingsValues settingsValues, - RichInputMethodManager richImm) { - } - - public static void onPickSuggestionManually(final SuggestedWords suggestedWords, - final SuggestedWords.SuggestedWordInfo suggestionInfo, - final DictionaryFacilitator dictionaryFacilitator) { - } - - public static void onBackspaceWordDelete(int wordLength) { - } - - public static void onBackspacePressed(int lengthToDelete) { - } - - public static void onBackspaceSelectedText(int selectedTextLength) { - } - - public static void onDeleteMultiCharInput(int multiCharLength) { - } - - public static void onRevertAutoCorrect() { - } - - public static void onRevertDoubleSpacePeriod() { - } - - public static void onRevertSwapPunctuation() { - } - - public static void onFinishInputView() { - } - - public static void onCreateInputView() { - } - - public static void onStartInputView(int inputType, int displayOrientation, boolean restarting) { - } - - public static void onAutoCorrection(final String typedWord, final String autoCorrectionWord, - final boolean isBatchInput, final DictionaryFacilitator dictionaryFacilitator, - final String prevWordsContext) { - } - - public static void onWordCommitUserTyped(final String commitWord, final boolean isBatchMode) { - } - - public static void onWordCommitAutoCorrect(final String commitWord, final boolean isBatchMode) { - } - - public static void onWordCommitSuggestionPickedManually( - final String commitWord, final boolean isBatchMode) { - } - - public static void onDoubleSpacePeriod() { - } - - public static void onLoadSettings(SettingsValues settingsValues) { - } - - public static void onInvalidWordIdentification(final String invalidWord) { - } - - public static void onSubtypeChanged(final InputMethodSubtype oldSubtype, - final InputMethodSubtype newSubtype) { - } - - public static void onSettingsActivity(final String entryPoint) { - } - - public static void onInputConnectionLaggy(final int operation, final long duration) { - } - - public static void onDecoderLaggy(final int operation, final long duration) { - } -} diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java deleted file mode 100644 index cd42f50c7..000000000 --- a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java +++ /dev/null @@ -1,56 +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.DictionaryFacilitator; -import com.android.inputmethod.latin.settings.SettingsValues; - -@SuppressWarnings("unused") -public class StatsUtilsManager { - - private static final StatsUtilsManager sInstance = new StatsUtilsManager(); - private static StatsUtilsManager sTestInstance = null; - - /** - * @return the singleton instance of {@link StatsUtilsManager}. - */ - public static StatsUtilsManager getInstance() { - return sTestInstance != null ? sTestInstance : sInstance; - } - - public static void setTestInstance(final StatsUtilsManager testInstance) { - sTestInstance = testInstance; - } - - public void onCreate(final Context context, final DictionaryFacilitator dictionaryFacilitator) { - } - - public void onLoadSettings(final Context context, final SettingsValues settingsValues) { - } - - public void onStartInputView() { - } - - public void onFinishInputView() { - } - - public void onDestroy(final Context context) { - } -} diff --git a/java/Android.mk b/java/Android.mk index 154f3a20c..837b2d9e3 100644 --- a/java/Android.mk +++ b/java/Android.mk @@ -17,7 +17,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional -LOCAL_SRC_FILES := $(call all-java-files-under, src ../java-overridable/src) +LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_PACKAGE_NAME := LatinIME diff --git a/java/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java b/java/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java new file mode 100644 index 000000000..f5e56eb4b --- /dev/null +++ b/java/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java @@ -0,0 +1,30 @@ +/* + * 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; + +@SuppressWarnings("unused") +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/dictionarypack/DictionaryPackConstants.java b/java/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java new file mode 100644 index 000000000..13caea403 --- /dev/null +++ b/java/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java @@ -0,0 +1,72 @@ +/* + * 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"; + + /** + * The intent action to inform the dictionary provider to initialize the db + * and update now. + */ + public static final String INIT_AND_UPDATE_NOW_INTENT_ACTION = DICTIONARY_DOMAIN + + ".INIT_AND_UPDATE_NOW"; +} diff --git a/java/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java b/java/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java new file mode 100644 index 000000000..512d426aa --- /dev/null +++ b/java/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java @@ -0,0 +1,29 @@ +/* + * 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. + */ +@SuppressWarnings("unused") +public class MetadataUriGetter { + public static String getUri(final Context context, final String baseUri) { + return baseUri; + } +} diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java new file mode 100644 index 000000000..a48b41fa7 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java @@ -0,0 +1,26 @@ +/* + * 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; + +/** + * Factory for instantiating DictionaryFacilitator objects. + */ +public class DictionaryFacilitatorProvider { + public static DictionaryFacilitator getDictionaryFacilitator(boolean isNeededForSpellChecking) { + return new DictionaryFacilitatorImpl(); + } +} diff --git a/java/src/com/android/inputmethod/latin/about/AboutPreferences.java b/java/src/com/android/inputmethod/latin/about/AboutPreferences.java new file mode 100644 index 000000000..f60b189f1 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/about/AboutPreferences.java @@ -0,0 +1,28 @@ +/* + * 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/accounts/AccountStateChangedListener.java b/java/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java new file mode 100644 index 000000000..60d420fc3 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java @@ -0,0 +1,75 @@ +/* + * 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.accounts; + +import android.support.annotation.NonNull; + +import javax.annotation.Nullable; + +/** + * Handles changes to account used to sign in to the keyboard. + * e.g. account switching/sign-in/sign-out from the keyboard + * user toggling the sync preference. + */ +public class AccountStateChangedListener { + + /** + * Called when the current account being used in keyboard is signed out. + * + * @param oldAccount the account that was signed out of. + */ + public static void onAccountSignedOut(@NonNull String oldAccount) { + } + + /** + * Called when the user signs-in to the keyboard. + * This may be called when the user switches accounts to sign in with a different account. + * + * @param oldAccount the previous account that was being used for sign-in. + * May be null for a fresh sign-in. + * @param newAccount the account being used for sign-in. + */ + public static void onAccountSignedIn(@Nullable String oldAccount, @NonNull String newAccount) { + } + + /** + * Called when the user toggles the sync preference. + * + * @param account the account being used for sync. + * @param syncEnabled indicates whether sync has been enabled or not. + */ + public static void onSyncPreferenceChanged(@Nullable String account, boolean syncEnabled) { + } + + /** + * Forces an immediate sync to happen. + * This should only be used for debugging purposes. + * + * @param account the account to use for sync. + */ + public static void forceSync(@Nullable String account) { + } + + /** + * Forces an immediate deletion of user's data. + * This should only be used for debugging purposes. + * + * @param account the account to use for sync. + */ + public static void forceDelete(@Nullable String account) { + } +} diff --git a/java/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java b/java/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java new file mode 100644 index 000000000..dcc64a223 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java @@ -0,0 +1,47 @@ +/* + * 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.accounts; + +import android.content.Context; + +import javax.annotation.Nonnull; + +/** + * Utility class for retrieving accounts that may be used for login. + */ +public class LoginAccountUtils { + /** + * This defines the type of account this class deals with. + * This account type is used when listing the accounts available on the device for login. + */ + public static final String ACCOUNT_TYPE = ""; + + private LoginAccountUtils() { + // This utility class is not publicly instantiable. + } + + /** + * Get the accounts available for login. + * + * @return an array of accounts. Empty (never null) if no accounts are available for login. + */ + @Nonnull + @SuppressWarnings("unused") + public static String[] getAccountsForLogin(final Context context) { + return new String[0]; + } +} diff --git a/java/src/com/android/inputmethod/latin/define/DebugFlags.java b/java/src/com/android/inputmethod/latin/define/DebugFlags.java new file mode 100644 index 000000000..c509e8322 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/define/DebugFlags.java @@ -0,0 +1,31 @@ +/* + * 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/DecoderSpecificConstants.java b/java/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java new file mode 100644 index 000000000..7f57ce858 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2015 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; + +/** + * Decoder specific constants for LatinIme. + */ +public class DecoderSpecificConstants { + + // Must be equal to MAX_WORD_LENGTH in native/jni/src/defines.h + public static final int DICTIONARY_MAX_WORD_LENGTH = 48; + + // (MAX_PREV_WORD_COUNT_FOR_N_GRAM + 1)-gram is supported in Java side. Needs to modify + // MAX_PREV_WORD_COUNT_FOR_N_GRAM in native/jni/src/defines.h for suggestions. + public static final int MAX_PREV_WORD_COUNT_FOR_N_GRAM = 3; + + public static final String DECODER_DICT_SUFFIX = ""; + + public static final boolean SHOULD_VERIFY_MAGIC_NUMBER = true; + public static final boolean SHOULD_VERIFY_CHECKSUM = true; + public static final boolean SHOULD_USE_DICT_VERSION = true; + public static final boolean SHOULD_AUTO_CORRECT_USING_NON_WHITE_LISTED_SUGGESTION = false; + public static final boolean SHOULD_REMOVE_PREVIOUSLY_REJECTED_SUGGESTION = true; +} diff --git a/java/src/com/android/inputmethod/latin/define/JniLibName.java b/java/src/com/android/inputmethod/latin/define/JniLibName.java new file mode 100644 index 000000000..abfc36d39 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/define/JniLibName.java @@ -0,0 +1,25 @@ +/* + * 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 new file mode 100644 index 000000000..f31c20822 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/define/ProductionFlags.java @@ -0,0 +1,58 @@ +/* + * 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; + + /** + * Include all suggestions from all dictionaries in + * {@link com.android.inputmethod.latin.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; + + /** + * When {@code false}, the split keyboard is not yet ready to be enabled. + */ + public static final boolean IS_SPLIT_KEYBOARD_SUPPORTED = true; + + /** + * When {@code false}, account sign-in in keyboard is not yet ready to be enabled. + */ + public static final boolean ENABLE_ACCOUNT_SIGN_IN = false; + + /** + * When {@code true}, user history dictionary sync feature is ready to be enabled. + */ + public static final boolean ENABLE_USER_HISTORY_DICTIONARY_SYNC = + ENABLE_ACCOUNT_SIGN_IN && false; + + /** + * When {@code true}, the IME maintains per account {@link UserHistoryDictionary}. + */ + public static final boolean ENABLE_PER_ACCOUNT_USER_HISTORY_DICTIONARY = + ENABLE_ACCOUNT_SIGN_IN && false; +} diff --git a/java/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java b/java/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java new file mode 100644 index 000000000..4e8a10b1f --- /dev/null +++ b/java/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java @@ -0,0 +1,57 @@ +/* + * 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 android.preference.PreferenceFragment; +import android.view.inputmethod.InputMethodSubtype; + +import com.android.inputmethod.latin.RichInputMethodSubtype; +import com.android.inputmethod.latin.RichInputMethodManager; + +import javax.annotation.Nonnull; + +/** + * Utility class for managing additional features settings. + */ +@SuppressWarnings("unused") +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 PreferenceFragment settingsFragment) { + // do nothing. + } + + public static void readAdditionalFeaturesPreferencesIntoArray(final Context context, + final SharedPreferences prefs, final int[] additionalFeaturesPreferences) { + // do nothing. + } + + @Nonnull + public static RichInputMethodSubtype createRichInputMethodSubtype( + @Nonnull final RichInputMethodManager imm, + @Nonnull final InputMethodSubtype subtype, + final Context context) { + return new RichInputMethodSubtype(subtype); + } +} diff --git a/java/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java b/java/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java new file mode 100644 index 000000000..8291b4f72 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/touchinputconsumer/GestureConsumer.java @@ -0,0 +1,69 @@ +/* + * 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.touchinputconsumer; + +import android.view.inputmethod.EditorInfo; + +import com.android.inputmethod.keyboard.Keyboard; +import com.android.inputmethod.latin.DictionaryFacilitator; +import com.android.inputmethod.latin.SuggestedWords; +import com.android.inputmethod.latin.common.InputPointers; +import com.android.inputmethod.latin.inputlogic.PrivateCommandPerformer; + +import java.util.Locale; + +/** + * Stub for GestureConsumer. + *
+ * The methods of this class should only be called from a single thread, e.g., + * the UI Thread. + */ +@SuppressWarnings("unused") +public class GestureConsumer { + public static final GestureConsumer NULL_GESTURE_CONSUMER = + new GestureConsumer(); + + public static GestureConsumer newInstance( + final EditorInfo editorInfo, final PrivateCommandPerformer commandPerformer, + final Locale locale, final Keyboard keyboard) { + return GestureConsumer.NULL_GESTURE_CONSUMER; + } + + private GestureConsumer() { + } + + public boolean willConsume() { + return false; + } + + public void onInit(final Locale locale, final Keyboard keyboard) { + } + + public void onGestureStarted(final Locale locale, final Keyboard keyboard) { + } + + public void onGestureCanceled() { + } + + public void onGestureCompleted(final InputPointers inputPointers) { + } + + public void onImeSuggestionsProcessed(final SuggestedWords suggestedWords, + final int composingStart, final int composingLength, + final DictionaryFacilitator dictionaryFacilitator) { + } +} diff --git a/java/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java b/java/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java new file mode 100644 index 000000000..5eb613c9b --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/DictionaryHeaderUtils.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015 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.AssetFileAddress; +import com.android.inputmethod.latin.makedict.DictionaryHeader; + +import java.io.File; + +public class DictionaryHeaderUtils { + + public static int getContentVersion(AssetFileAddress fileAddress) { + final DictionaryHeader header = DictionaryInfoUtils.getDictionaryFileHeaderOrNull( + new File(fileAddress.mFilename), fileAddress.mOffset, fileAddress.mLength); + return Integer.parseInt(header.mVersionString); + } +} diff --git a/java/src/com/android/inputmethod/latin/utils/FeedbackUtils.java b/java/src/com/android/inputmethod/latin/utils/FeedbackUtils.java new file mode 100644 index 000000000..67de8ba32 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/FeedbackUtils.java @@ -0,0 +1,38 @@ +/* + * 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; + +@SuppressWarnings("unused") +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 new file mode 100644 index 000000000..9f4584ec9 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/FileTransforms.java @@ -0,0 +1,38 @@ +/* + * 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/ManagedProfileUtils.java b/java/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java new file mode 100644 index 000000000..ef1872bf4 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java @@ -0,0 +1,43 @@ +/* + * 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.annotations.UsedForTesting; + +public class ManagedProfileUtils { + private static ManagedProfileUtils INSTANCE = new ManagedProfileUtils(); + private static ManagedProfileUtils sTestInstance; + + private ManagedProfileUtils() { + // This utility class is not publicly instantiable. + } + + @UsedForTesting + public static void setTestInstance(final ManagedProfileUtils testInstance) { + sTestInstance = testInstance; + } + + public static ManagedProfileUtils getInstance() { + return sTestInstance == null ? INSTANCE : sTestInstance; + } + + public boolean hasWorkProfile(final Context context) { + return false; + } +} \ No newline at end of file diff --git a/java/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java b/java/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java new file mode 100644 index 000000000..97fb17de3 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java @@ -0,0 +1,39 @@ +/* + * 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. + */ +@SuppressWarnings("unused") +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 new file mode 100644 index 000000000..03e58478b --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/StatsUtils.java @@ -0,0 +1,110 @@ +/* + * 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.view.inputmethod.InputMethodSubtype; + +import com.android.inputmethod.latin.DictionaryFacilitator; +import com.android.inputmethod.latin.RichInputMethodManager; +import com.android.inputmethod.latin.SuggestedWords; +import com.android.inputmethod.latin.settings.SettingsValues; + +import javax.annotation.Nullable; + +@SuppressWarnings("unused") +public final class StatsUtils { + + private StatsUtils() { + // Intentional empty constructor. + } + + public static void onCreate(final SettingsValues settingsValues, + RichInputMethodManager richImm) { + } + + public static void onPickSuggestionManually(final SuggestedWords suggestedWords, + final SuggestedWords.SuggestedWordInfo suggestionInfo, + final DictionaryFacilitator dictionaryFacilitator) { + } + + public static void onBackspaceWordDelete(int wordLength) { + } + + public static void onBackspacePressed(int lengthToDelete) { + } + + public static void onBackspaceSelectedText(int selectedTextLength) { + } + + public static void onDeleteMultiCharInput(int multiCharLength) { + } + + public static void onRevertAutoCorrect() { + } + + public static void onRevertDoubleSpacePeriod() { + } + + public static void onRevertSwapPunctuation() { + } + + public static void onFinishInputView() { + } + + public static void onCreateInputView() { + } + + public static void onStartInputView(int inputType, int displayOrientation, boolean restarting) { + } + + public static void onAutoCorrection(final String typedWord, final String autoCorrectionWord, + final boolean isBatchInput, final DictionaryFacilitator dictionaryFacilitator, + final String prevWordsContext) { + } + + public static void onWordCommitUserTyped(final String commitWord, final boolean isBatchMode) { + } + + public static void onWordCommitAutoCorrect(final String commitWord, final boolean isBatchMode) { + } + + public static void onWordCommitSuggestionPickedManually( + final String commitWord, final boolean isBatchMode) { + } + + public static void onDoubleSpacePeriod() { + } + + public static void onLoadSettings(SettingsValues settingsValues) { + } + + public static void onInvalidWordIdentification(final String invalidWord) { + } + + public static void onSubtypeChanged(final InputMethodSubtype oldSubtype, + final InputMethodSubtype newSubtype) { + } + + public static void onSettingsActivity(final String entryPoint) { + } + + public static void onInputConnectionLaggy(final int operation, final long duration) { + } + + public static void onDecoderLaggy(final int operation, final long duration) { + } +} diff --git a/java/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java b/java/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java new file mode 100644 index 000000000..cd42f50c7 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java @@ -0,0 +1,56 @@ +/* + * 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.DictionaryFacilitator; +import com.android.inputmethod.latin.settings.SettingsValues; + +@SuppressWarnings("unused") +public class StatsUtilsManager { + + private static final StatsUtilsManager sInstance = new StatsUtilsManager(); + private static StatsUtilsManager sTestInstance = null; + + /** + * @return the singleton instance of {@link StatsUtilsManager}. + */ + public static StatsUtilsManager getInstance() { + return sTestInstance != null ? sTestInstance : sInstance; + } + + public static void setTestInstance(final StatsUtilsManager testInstance) { + sTestInstance = testInstance; + } + + public void onCreate(final Context context, final DictionaryFacilitator dictionaryFacilitator) { + } + + public void onLoadSettings(final Context context, final SettingsValues settingsValues) { + } + + public void onStartInputView() { + } + + public void onFinishInputView() { + } + + public void onDestroy(final Context context) { + } +} -- cgit v1.2.3-83-g751a