diff options
Diffstat (limited to 'java-overridable/src/com/android')
19 files changed, 512 insertions, 149 deletions
diff --git a/java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java b/java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java index 21535e421..f5e56eb4b 100644 --- a/java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java +++ b/java-overridable/src/com/android/inputmethod/compat/AppWorkaroundsHelper.java @@ -18,6 +18,7 @@ package com.android.inputmethod.compat; import android.content.pm.PackageInfo; +@SuppressWarnings("unused") public class AppWorkaroundsHelper { private AppWorkaroundsHelper() { // This helper class is not publicly instantiable. diff --git a/java-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java b/java-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java index df0e3f0e1..13caea403 100644 --- a/java-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java +++ b/java-overridable/src/com/android/inputmethod/dictionarypack/DictionaryPackConstants.java @@ -62,4 +62,11 @@ public class DictionaryPackConstants { */ 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 index ed817658e..d8951df86 100644 --- a/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java +++ b/java-overridable/src/com/android/inputmethod/dictionarypack/MetadataUriGetter.java @@ -21,6 +21,7 @@ import android.content.Context; /** * Helper to get the metadata URI from its base URI and the additional ID, if any. */ +@SuppressWarnings("unused") public class MetadataUriGetter { private MetadataUriGetter() { // This helper class is not instantiable. diff --git a/java-overridable/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java b/java-overridable/src/com/android/inputmethod/latin/DictionaryFacilitatorProvider.java new file mode 100644 index 000000000..a48b41fa7 --- /dev/null +++ b/java-overridable/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-overridable/src/com/android/inputmethod/latin/SpecialKeyDetector.java b/java-overridable/src/com/android/inputmethod/latin/SpecialKeyDetector.java deleted file mode 100644 index 27b2f5012..000000000 --- a/java-overridable/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-overridable/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java b/java-overridable/src/com/android/inputmethod/latin/accounts/AccountStateChangedListener.java new file mode 100644 index 000000000..60d420fc3 --- /dev/null +++ b/java-overridable/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-overridable/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java b/java-overridable/src/com/android/inputmethod/latin/accounts/LoginAccountUtils.java new file mode 100644 index 000000000..dcc64a223 --- /dev/null +++ b/java-overridable/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-overridable/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java b/java-overridable/src/com/android/inputmethod/latin/define/DecoderSpecificConstants.java new file mode 100644 index 000000000..7f57ce858 --- /dev/null +++ b/java-overridable/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-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java b/java-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java index 5ab126486..f31c20822 100644 --- a/java-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java +++ b/java-overridable/src/com/android/inputmethod/latin/define/ProductionFlags.java @@ -24,15 +24,8 @@ public final class ProductionFlags { public static final boolean IS_HARDWARE_KEYBOARD_SUPPORTED = false; /** - * When true, enable {@link InputMethodService#onUpdateCursorAnchorInfo} callback via - * {@link InputConnection#requestUpdateCursorAnchorInfo}. This flag has no effect in API - * Level 20 and prior. In general, this callback provides detailed positional information, - * even though an explicit support is required by the editor. - */ - public static final boolean ENABLE_CURSOR_ANCHOR_INFO_CALLBACK = true; - - /** - * Include all suggestions from all dictionaries in {@link SuggestedWords#mRawSuggestions}. + * Include all suggestions from all dictionaries in + * {@link com.android.inputmethod.latin.SuggestedWords#mRawSuggestions}. */ public static final boolean INCLUDE_RAW_SUGGESTIONS = false; @@ -40,4 +33,26 @@ public final class ProductionFlags { * 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/personalization/ContextualDictionaryUpdater.java b/java-overridable/src/com/android/inputmethod/latin/personalization/ContextualDictionaryUpdater.java deleted file mode 100644 index 7dc120e06..000000000 --- a/java-overridable/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-overridable/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdater.java b/java-overridable/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdater.java deleted file mode 100644 index c97a0d232..000000000 --- a/java-overridable/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-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java b/java-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java index 6543003e8..4e8a10b1f 100644 --- a/java-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java +++ b/java-overridable/src/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java @@ -18,12 +18,18 @@ 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.inputmethodcommon.InputMethodSettingsFragment; +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; @@ -32,12 +38,20 @@ public class AdditionalFeaturesSettingUtils { } public static void addAdditionalFeaturesPreferences( - final Context context, final InputMethodSettingsFragment settingsFragment) { + final Context context, final PreferenceFragment settingsFragment) { // do nothing. } - public static void readAdditionalFeaturesPreferencesIntoArray( + 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 new file mode 100644 index 000000000..8291b4f72 --- /dev/null +++ b/java-overridable/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. + * <br> + * 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 new file mode 100644 index 000000000..5eb613c9b --- /dev/null +++ b/java-overridable/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-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.java index 0aed41ee4..67de8ba32 100644 --- a/java-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.java +++ b/java-overridable/src/com/android/inputmethod/latin/utils/FeedbackUtils.java @@ -19,6 +19,7 @@ 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; diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/ManagedProfileUtils.java new file mode 100644 index 000000000..ef1872bf4 --- /dev/null +++ b/java-overridable/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-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java b/java-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java index 9ad319da6..97fb17de3 100644 --- a/java-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java +++ b/java-overridable/src/com/android/inputmethod/latin/utils/MetadataFileUriGetter.java @@ -23,6 +23,7 @@ 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. diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java index 79c19d077..c069a0f64 100644 --- a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java +++ b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java @@ -16,19 +16,89 @@ package com.android.inputmethod.latin.utils; -import android.content.Context; +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 { - public static void init(final Context context) { + + 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 onCreate(final SettingsValues settingsValues) { + public static void onInvalidWordIdentification(final String invalidWord) { } - public static void onLoadSettings(final SettingsValues settingsValues) { + public static void onSubtypeChanged(final InputMethodSubtype oldSubtype, + final InputMethodSubtype newSubtype) { } - public static void onDestroy() { + public static void onSettingsActivity(final String entryPoint) { } } diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtilsManager.java new file mode 100644 index 000000000..cd42f50c7 --- /dev/null +++ b/java-overridable/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) { + } +} |