remove unused annotations

This commit is contained in:
Helium314 2024-02-01 22:42:25 +01:00
parent 978d76ed7c
commit 3a354524f3
37 changed files with 6 additions and 183 deletions

View file

@ -1,15 +1,3 @@
# Keep classes and methods that have the @UsedForTesting annotation
-keep @helium314.keyboard.annotations.UsedForTesting class *
-keepclassmembers class * {
@helium314.keyboard.annotations.UsedForTesting *;
}
# Keep classes and methods that have the @ExternallyReferenced annotation
-keep @helium314.keyboard.annotations.ExternallyReferenced class *
-keepclassmembers class * {
@helium314.keyboard.annotations.ExternallyReferenced *;
}
# Keep native methods
-keepclassmembers class * {
native <methods>;
@ -20,7 +8,6 @@
-keep class helium314.keyboard.latin.Dictionary
-keep class helium314.keyboard.latin.NgramContext
-keep class helium314.keyboard.latin.makedict.ProbabilityInfo
-keep class helium314.keyboard.latin.utils.LanguageModelParam
# after upgrading to gradle 8, stack traces contain "unknown source"
-keepattributes SourceFile,LineNumberTable

View file

@ -12,7 +12,6 @@ import android.util.SparseArray;
import androidx.annotation.NonNull;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.Dictionary;
import helium314.keyboard.latin.NgramContext;
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
@ -52,13 +51,9 @@ public final class BinaryDictionary extends Dictionary {
public static final int DICTIONARY_MAX_WORD_LENGTH = 48;
public static final int MAX_PREV_WORD_COUNT_FOR_N_GRAM = 3;
@UsedForTesting
public static final String UNIGRAM_COUNT_QUERY = "UNIGRAM_COUNT";
@UsedForTesting
public static final String BIGRAM_COUNT_QUERY = "BIGRAM_COUNT";
@UsedForTesting
public static final String MAX_UNIGRAM_COUNT_QUERY = "MAX_UNIGRAM_COUNT";
@UsedForTesting
public static final String MAX_BIGRAM_COUNT_QUERY = "MAX_BIGRAM_COUNT";
public static final int NOT_A_VALID_TIMESTAMP = -1;
@ -364,7 +359,6 @@ public final class BinaryDictionary extends Dictionary {
return getMaxProbabilityOfExactMatchesNative(mNativeDict, codePoints);
}
@UsedForTesting
public boolean isValidNgram(final NgramContext ngramContext, final String word) {
return getNgramProbability(ngramContext, word) != NOT_A_PROBABILITY;
}
@ -505,7 +499,6 @@ public final class BinaryDictionary extends Dictionary {
return true;
}
@UsedForTesting
public void updateEntriesForInputEvents(final WordInputEventForPersonalization[] inputEvents) {
if (!isValidDictionary()) {
return;
@ -620,7 +613,6 @@ public final class BinaryDictionary extends Dictionary {
}
}
@UsedForTesting
public String getPropertyForGettingStats(final String query) {
if (!isValidDictionary()) {
return "";

View file

@ -6,7 +6,6 @@
package com.android.inputmethod.latin.utils;
import helium314.keyboard.annotations.UsedForTesting;
import com.android.inputmethod.latin.BinaryDictionary;
import helium314.keyboard.latin.common.StringUtils;
import helium314.keyboard.latin.makedict.DictionaryHeader;
@ -31,7 +30,6 @@ public final class BinaryDictionaryUtils {
JniUtils.loadNativeLibrary();
}
@UsedForTesting
private static native boolean createEmptyDictFileNative(String filePath, long dictVersion,
String locale, String[] attributeKeyStringArray, String[] attributeValueStringArray);
private static native float calcNormalizedScoreNative(int[] before, int[] after, int score);
@ -82,7 +80,6 @@ public final class BinaryDictionaryUtils {
return false;
}
@UsedForTesting
public static boolean createEmptyDictFile(final String filePath, final long dictVersion,
final Locale locale, final Map<String, String> attributeMap) {
final String[] keyArray = new String[attributeMap.size()];
@ -112,7 +109,6 @@ public final class BinaryDictionaryUtils {
* @param currentTime seconds since the unix epoch
* @return current time got in the native code.
*/
@UsedForTesting
public static int setCurrentTimeForTest(final int currentTime) {
return setCurrentTimeForTestNative(currentTime);
}

View file

@ -8,7 +8,6 @@ package com.android.inputmethod.latin.utils;
import helium314.keyboard.latin.utils.Log;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.NgramContext;
import helium314.keyboard.latin.common.StringUtils;
import helium314.keyboard.latin.define.DecoderSpecificConstants;
@ -34,7 +33,6 @@ public final class WordInputEventForPersonalization {
// Time stamp in seconds.
public final int mTimestamp;
@UsedForTesting
public WordInputEventForPersonalization(final CharSequence targetWord,
final NgramContext ngramContext, final int timestamp) {
mTargetWord = StringUtils.toCodePointArray(targetWord);

View file

@ -1,13 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
* modified
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
*/
package helium314.keyboard.annotations
/**
* Denotes that the class, method or field should not be eliminated by ProGuard,
* because it is externally referenced. (See proguard.flags)
*/
annotation class ExternallyReferenced

View file

@ -1,13 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
* modified
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
*/
package helium314.keyboard.annotations
/**
* Denotes that the class, method or field should not be eliminated by ProGuard,
* so that unit tests can access it. (See proguard.flags)
*/
annotation class UsedForTesting

View file

@ -11,13 +11,11 @@ import android.text.Spannable
import android.text.SpannableString
import android.text.Spanned
import android.text.style.SuggestionSpan
import helium314.keyboard.annotations.UsedForTesting
import java.util.*
// todo: this is not compat any more
object SuggestionSpanUtils {
@JvmStatic
@UsedForTesting
fun getTextWithAutoCorrectionIndicatorUnderline(context: Context?, text: String, locale: Locale?): CharSequence {
if (text.isEmpty())
return text

View file

@ -6,7 +6,6 @@
package helium314.keyboard.event
import helium314.keyboard.annotations.ExternallyReferenced
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo
import helium314.keyboard.latin.common.Constants
import helium314.keyboard.latin.common.StringUtils
@ -146,7 +145,6 @@ class Event private constructor(
}
// This creates an input event for a dead character. @see {@link #FLAG_DEAD}
@ExternallyReferenced
fun createDeadEvent(codePoint: Int, keyCode: Int, next: Event?): Event { // TODO: add an argument or something if we ever create a software layout with dead keys.
return Event(EVENT_TYPE_INPUT_KEYPRESS, null /* text */, codePoint, keyCode,
Constants.EXTERNAL_KEYBOARD_COORDINATE, Constants.EXTERNAL_KEYBOARD_COORDINATE,

View file

@ -10,8 +10,6 @@ import androidx.annotation.NonNull;
import com.android.inputmethod.keyboard.ProximityInfo;
import helium314.keyboard.annotations.UsedForTesting;
import java.util.ArrayList;
import java.util.List;
@ -57,7 +55,6 @@ public class KeyboardLayout {
}
}
@UsedForTesting
public int[] getKeyCodes() {
return mKeyCodes;
}

View file

@ -29,7 +29,6 @@ import androidx.appcompat.view.ContextThemeWrapper;
import helium314.keyboard.accessibility.AccessibilityUtils;
import helium314.keyboard.accessibility.MainKeyboardAccessibilityDelegate;
import helium314.keyboard.annotations.ExternallyReferenced;
import helium314.keyboard.compat.ConfigurationCompatKt;
import helium314.keyboard.keyboard.internal.DrawingPreviewPlacerView;
import helium314.keyboard.keyboard.internal.DrawingProxy;
@ -310,38 +309,11 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
}
}
@ExternallyReferenced
public int getLanguageOnSpacebarAnimAlpha() {
return mLanguageOnSpacebarAnimAlpha;
}
@ExternallyReferenced
public void setLanguageOnSpacebarAnimAlpha(final int alpha) {
mLanguageOnSpacebarAnimAlpha = alpha;
invalidateKey(mSpaceKey);
}
@ExternallyReferenced
public int getAltCodeKeyWhileTypingAnimAlpha() {
return mAltCodeKeyWhileTypingAnimAlpha;
}
@ExternallyReferenced
public void setAltCodeKeyWhileTypingAnimAlpha(final int alpha) {
if (mAltCodeKeyWhileTypingAnimAlpha == alpha) {
return;
}
// Update the visual of alt-code-key-while-typing.
mAltCodeKeyWhileTypingAnimAlpha = alpha;
final Keyboard keyboard = getKeyboard();
if (keyboard == null) {
return;
}
for (final Key key : keyboard.mAltCodeKeysWhileTyping) {
invalidateKey(key);
}
}
public void setKeyboardActionListener(final KeyboardActionListener listener) {
mKeyboardActionListener = listener;
PointerTracker.setKeyboardActionListener(listener);

View file

@ -11,7 +11,6 @@ import android.graphics.Paint;
import androidx.annotation.NonNull;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.keyboard.internal.KeyboardBuilder;
import helium314.keyboard.keyboard.internal.KeyboardParams;
import helium314.keyboard.keyboard.internal.MoreKeySpec;
@ -31,7 +30,6 @@ public final class MoreKeysKeyboard extends Keyboard {
return mDefaultKeyCoordX;
}
@UsedForTesting
static class MoreKeysKeyboardParams extends KeyboardParams {
public boolean mIsMoreKeysFixedOrder;
/* package */int mTopRowAdjustment;

View file

@ -9,7 +9,6 @@ import android.content.Context
import android.content.res.Resources
import android.util.Xml
import androidx.annotation.XmlRes
import helium314.keyboard.annotations.UsedForTesting
import helium314.keyboard.keyboard.Key
import helium314.keyboard.keyboard.Key.KeyParams
import helium314.keyboard.keyboard.Keyboard
@ -86,7 +85,6 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
mParams.readAttributes(mContext, null)
}
@UsedForTesting
fun disableTouchPositionCorrectionDataForTest() {
mParams.mTouchPositionCorrection.setEnabled(false)
}

View file

@ -8,8 +8,6 @@ package helium314.keyboard.keyboard.internal;
import helium314.keyboard.latin.utils.Log;
import helium314.keyboard.annotations.UsedForTesting;
import java.util.Arrays;
import java.util.Locale;
@ -17,7 +15,6 @@ import java.util.Locale;
* Utilities for matrix operations. Don't instantiate objects inside this class to prevent
* unexpected performance regressions.
*/
@UsedForTesting
public class MatrixUtils {
static final String TAG = MatrixUtils.class.getSimpleName();
@ -88,7 +85,6 @@ public class MatrixUtils {
* The inverse matrix of squareMatrix will be output to inverseMatrix. Please notice that
* the value of squareMatrix is modified in this function and can't be resuable.
*/
@UsedForTesting
public static void inverse(final float[][] squareMatrix,
final float[][] inverseMatrix) throws MatrixOperationFailedException {
final int size = squareMatrix.length;
@ -110,7 +106,6 @@ public class MatrixUtils {
/**
* A matrix operation to multiply m0 and m1.
*/
@UsedForTesting
public static void multiply(final float[][] m0, final float[][] m1,
final float[][] retval) throws MatrixOperationFailedException {
if (m0[0].length != m1.length) {
@ -138,7 +133,6 @@ public class MatrixUtils {
/**
* A utility function to dump the specified matrix in a readable way
*/
@UsedForTesting
public static void dump(final String title, final float[][] a) {
final int column = a[0].length;
final int row = a.length;

View file

@ -6,10 +6,8 @@
package helium314.keyboard.keyboard.internal;
import helium314.keyboard.latin.utils.Log;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.keyboard.internal.MatrixUtils.MatrixOperationFailedException;
import helium314.keyboard.latin.utils.Log;
import java.util.Arrays;
@ -17,7 +15,7 @@ import java.util.Arrays;
* Utilities to smooth coordinates. Currently, we calculate 3d least squares formula by using
* Lagrangian smoothing
*/
@UsedForTesting
// todo: unused, what could this be used for? maybe just remove (then also remove MatrixUtils)
public class SmoothingUtils {
private static final String TAG = SmoothingUtils.class.getSimpleName();
private static final boolean DEBUG = false;
@ -30,7 +28,6 @@ public class SmoothingUtils {
* Find a most likely 3d least squares formula for specified coordinates.
* "retval" should be a 1x4 size matrix.
*/
@UsedForTesting
public static void get3DParameters(final float[] xs, final float[] ys,
final float[][] retval) throws MatrixOperationFailedException {
final int COEFF_COUNT = 4; // Coefficient count for 3d smoothing

View file

@ -6,7 +6,6 @@
package helium314.keyboard.keyboard.internal;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.define.DebugFlags;
public final class TouchPositionCorrection {
@ -57,7 +56,6 @@ public final class TouchPositionCorrection {
}
}
@UsedForTesting
public void setEnabled(final boolean enabled) {
mEnabled = enabled;
}

View file

@ -17,7 +17,6 @@ import androidx.annotation.Nullable;
import com.android.inputmethod.latin.BinaryDictionary;
import helium314.keyboard.annotations.ExternallyReferenced;
import helium314.keyboard.latin.ContactsManager.ContactsChangedListener;
import helium314.keyboard.latin.common.StringUtils;
import helium314.keyboard.latin.permissions.PermissionsUtil;
@ -50,7 +49,6 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary
reloadDictionaryIfRequired();
}
@ExternallyReferenced
public static ContactsBinaryDictionary getDictionary(final Context context, final Locale locale,
final File dictFile, final String dictNamePrefix, @Nullable final String account) {
return new ContactsBinaryDictionary(context, locale, dictFile, dictNamePrefix + NAME);

View file

@ -6,7 +6,6 @@
package helium314.keyboard.latin;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
import helium314.keyboard.latin.common.ComposedData;
import helium314.keyboard.latin.settings.SettingsValuesForSuggestion;
@ -186,9 +185,7 @@ public abstract class Dictionary {
* Not a true dictionary. A placeholder used to indicate suggestions that don't come from any
* real dictionary.
*/
@UsedForTesting
static class PhonyDictionary extends Dictionary {
@UsedForTesting
PhonyDictionary(final String type) {
super(type, null);
}

View file

@ -40,7 +40,6 @@ import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
import helium314.keyboard.accessibility.AccessibilityUtils;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.compat.ConfigurationCompatKt;
import helium314.keyboard.compat.EditorInfoCompatUtils;
import helium314.keyboard.compat.InsetsOutlineProvider;
@ -147,7 +146,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private SuggestionStripView mSuggestionStripView;
private RichInputMethodManager mRichImm;
@UsedForTesting final KeyboardSwitcher mKeyboardSwitcher;
final KeyboardSwitcher mKeyboardSwitcher;
private final SubtypeState mSubtypeState = new SubtypeState();
private EmojiAltPhysicalKeyDetector mEmojiAltPhysicalKeyDetector;
private final StatsUtilsManager mStatsUtilsManager;
@ -407,7 +406,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return hasMessages(MSG_DEALLOCATE_MEMORY);
}
@UsedForTesting
public void removeAllMessages() {
for (int i = 0; i <= MSG_LAST; ++i) {
removeMessages(i);
@ -647,9 +645,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
StatsUtils.onCreate(mSettings.getCurrent(), mRichImm);
}
// Has to be package-visible for unit tests
@UsedForTesting
void loadSettings() {
private void loadSettings() {
final Locale locale = mRichImm.getCurrentSubtypeLocale();
final EditorInfo editorInfo = getCurrentInputEditorInfo();
final InputAttributes inputAttributes = new InputAttributes(
@ -762,7 +758,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
super.onDestroy();
}
@UsedForTesting
public void recycle() {
unregisterReceiver(mDictionaryPackInstallReceiver);
unregisterReceiver(mDictionaryDumpBroadcastReceiver);
@ -1785,9 +1780,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mDictionaryFacilitator.removeWord(word);
}
// Outside LatinIME, only used by the {@link InputTestsBase} test suite.
@UsedForTesting
void loadKeyboard() {
private void loadKeyboard() {
// Since we are switching languages, the most urgent thing is to let the keyboard graphics
// update. LoadKeyboard does that, but we need to wait for buffer flip for it to be on
// the screen. Anything we do right now will delay this, so wait until the next frame

View file

@ -10,7 +10,6 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.common.StringUtils;
import helium314.keyboard.latin.define.DecoderSpecificConstants;
@ -199,7 +198,6 @@ public class NgramContext {
}
// n is 1-indexed.
@UsedForTesting
public boolean isNthPrevWordBeginningOfSentence(final int n) {
if (n <= 0 || n > mPrevWordsCount) {
return false;

View file

@ -15,7 +15,6 @@ import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.compat.ConfigurationCompatKt;
import helium314.keyboard.latin.common.LocaleUtils;
import helium314.keyboard.latin.settings.Settings;
@ -210,7 +209,6 @@ public class RichInputMethodManager {
private static RichInputMethodSubtype sForcedSubtypeForTesting = null;
@UsedForTesting
static void forceSubtype(@NonNull final InputMethodSubtype subtype) {
sForcedSubtypeForTesting = RichInputMethodSubtype.getRichInputMethodSubtype(subtype);
}

View file

@ -9,7 +9,6 @@ package helium314.keyboard.latin;
import android.text.TextUtils;
import helium314.keyboard.latin.utils.Log;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.keyboard.Keyboard;
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
import helium314.keyboard.latin.common.ComposedData;
@ -272,7 +271,6 @@ public final class Suggest {
}
// returns [allowsToBeAutoCorrected, hasAutoCorrection]
@UsedForTesting
boolean[] shouldBeAutoCorrected(
final int trailingSingleQuotesCount,
final String typedWordString,

View file

@ -12,7 +12,6 @@ import android.view.inputmethod.CompletionInfo;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.common.StringUtils;
import helium314.keyboard.latin.define.DebugFlags;
@ -427,7 +426,6 @@ public class SuggestedWords {
* typed by the user. Otherwise returns {@code null}. Note that gesture input is not
* considered to be a typed word.
*/
@UsedForTesting
public SuggestedWordInfo getTypedWordInfoOrNull() {
if (SuggestedWords.INDEX_OF_TYPED_WORD >= size()) {
return null;

View file

@ -13,13 +13,12 @@ import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.provider.UserDictionary.Words;
import android.text.TextUtils;
import helium314.keyboard.latin.utils.Log;
import androidx.annotation.Nullable;
import com.android.inputmethod.latin.BinaryDictionary;
import helium314.keyboard.annotations.ExternallyReferenced;
import helium314.keyboard.latin.utils.Log;
import helium314.keyboard.latin.utils.SubtypeLocaleUtils;
import java.io.File;
@ -82,7 +81,6 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
reloadDictionaryIfRequired();
}
@ExternallyReferenced
public static UserBinaryDictionary getDictionary(
final Context context, final Locale locale, final File dictFile,
final String dictNamePrefix, @Nullable final String account) {

View file

@ -8,7 +8,6 @@ package helium314.keyboard.latin;
import androidx.annotation.NonNull;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.event.CombinerChain;
import helium314.keyboard.event.Event;
import helium314.keyboard.keyboard.Keyboard;
@ -483,17 +482,14 @@ public final class WordComposer {
return mRejectedBatchModeSuggestion;
}
@UsedForTesting
void addInputPointerForTest(int index, int keyX, int keyY) {
mInputPointers.addPointerAt(index, keyX, keyY, 0, 0);
}
@UsedForTesting
void setTypedWordCacheForTests(String typedWordCacheForTests) {
mTypedWordCache = typedWordCacheForTests;
}
@UsedForTesting
static WordComposer getComposerForTest(boolean isEmpty) {
return new WordComposer(isEmpty);
}

View file

@ -8,8 +8,6 @@ package helium314.keyboard.latin.common;
import androidx.annotation.NonNull;
import helium314.keyboard.annotations.UsedForTesting;
// TODO: This class is not thread-safe.
public final class InputPointers {
private static final boolean DEBUG_TIME = false;
@ -54,7 +52,6 @@ public final class InputPointers {
mTimes.addAt(index, time);
}
@UsedForTesting
public void addPointer(final int x, final int y, final int pointerId, final int time) {
mXCoordinates.add(x);
mYCoordinates.add(y);
@ -102,7 +99,6 @@ public final class InputPointers {
* Shift to the left by elementCount, discarding elementCount pointers at the start.
* @param elementCount how many elements to shift.
*/
@UsedForTesting
public void shift(final int elementCount) {
mXCoordinates.shift(elementCount);
mYCoordinates.shift(elementCount);

View file

@ -8,8 +8,6 @@ package helium314.keyboard.latin.common;
import androidx.annotation.NonNull;
import helium314.keyboard.annotations.UsedForTesting;
import java.util.Arrays;
// TODO: This class is not thread-safe.
@ -132,7 +130,6 @@ public final class ResizableIntArray {
* Shift to the left by elementCount, discarding elementCount pointers at the start.
* @param elementCount how many elements to shift.
*/
@UsedForTesting
public void shift(final int elementCount) {
System.arraycopy(mArray, elementCount, mArray, 0, mLength - elementCount);
mLength -= elementCount;

View file

@ -6,7 +6,6 @@
package helium314.keyboard.latin.makedict;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.define.DecoderSpecificConstants;
import java.util.Date;
@ -244,11 +243,6 @@ public final class FormatSpec {
public final int mVersion;
public final boolean mHasTimestamp;
@UsedForTesting
public FormatOptions(final int version) {
this(version, false /* hasTimestamp */);
}
public FormatOptions(final int version, final boolean hasTimestamp) {
mVersion = version;
mHasTimestamp = hasTimestamp;

View file

@ -6,7 +6,6 @@
package helium314.keyboard.latin.makedict;
import helium314.keyboard.annotations.UsedForTesting;
import com.android.inputmethod.latin.BinaryDictionary;
import helium314.keyboard.latin.utils.CombinedFormatUtils;
@ -21,7 +20,6 @@ public final class ProbabilityInfo {
public final int mLevel;
public final int mCount;
@UsedForTesting
public static ProbabilityInfo max(final ProbabilityInfo probabilityInfo1,
final ProbabilityInfo probabilityInfo2) {
if (probabilityInfo1 == null) {

View file

@ -6,8 +6,6 @@
package helium314.keyboard.latin.makedict;
import helium314.keyboard.annotations.UsedForTesting;
import java.util.Arrays;
/**
@ -28,7 +26,6 @@ public final class WeightedString {
mProbabilityInfo = probabilityInfo;
}
@UsedForTesting
public int getProbability() {
return mProbabilityInfo.mProbability;
}

View file

@ -8,7 +8,6 @@ package helium314.keyboard.latin.makedict;
import androidx.annotation.Nullable;
import helium314.keyboard.annotations.UsedForTesting;
import com.android.inputmethod.latin.BinaryDictionary;
import helium314.keyboard.latin.Dictionary;
import helium314.keyboard.latin.NgramContext;
@ -39,7 +38,6 @@ public final class WordProperty implements Comparable<WordProperty> {
private int mHashCode = 0;
// TODO: Support n-gram.
@UsedForTesting
public WordProperty(final String word, final ProbabilityInfo probabilityInfo,
final ArrayList<WeightedString> shortcutTargets,
@Nullable final ArrayList<WeightedString> bigrams,
@ -122,7 +120,6 @@ public final class WordProperty implements Comparable<WordProperty> {
}
// TODO: Remove
@UsedForTesting
public ArrayList<WeightedString> getBigrams() {
if (null == mNgrams) {
return null;
@ -197,7 +194,6 @@ public final class WordProperty implements Comparable<WordProperty> {
return mHashCode;
}
@UsedForTesting
public boolean isValid() {
return getProbability() != Dictionary.NOT_A_PROBABILITY;
}

View file

@ -11,8 +11,6 @@ import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import helium314.keyboard.annotations.ExternallyReferenced;
import helium314.keyboard.annotations.UsedForTesting;
import com.android.inputmethod.latin.BinaryDictionary;
import helium314.keyboard.latin.Dictionary;
import helium314.keyboard.latin.ExpandableBinaryDictionary;
@ -43,13 +41,11 @@ public class UserHistoryDictionary extends ExpandableBinaryDictionary {
/**
* @returns the name of the {@link UserHistoryDictionary}.
*/
@UsedForTesting
static String getUserHistoryDictName(final String name, final Locale locale,
@Nullable final File dictFile, @Nullable final String account) {
return getDictName(name, locale, dictFile);
}
@ExternallyReferenced
public static UserHistoryDictionary getDictionary(final Context context, final Locale locale,
final File dictFile, final String dictNamePrefix, @Nullable final String account) {
return PersonalizationHelper.getUserHistoryDictionary(context, locale, account);

View file

@ -37,7 +37,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import helium314.keyboard.accessibility.AccessibilityUtils;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.PunctuationSuggestions;
import helium314.keyboard.latin.R;
import helium314.keyboard.latin.SuggestedWords;
@ -230,7 +229,6 @@ final class SuggestionStripLayoutHelper {
shouldOmitTypedWord, mCenterPositionInStrip, mTypedWordPositionWhenAutocorrect);
}
@UsedForTesting
static boolean shouldOmitTypedWord(final int inputStyle,
final boolean gestureFloatingPreviewTextEnabled,
final boolean shouldShowUiToAcceptTypedWord) {
@ -240,7 +238,6 @@ final class SuggestionStripLayoutHelper {
return shouldShowUiToAcceptTypedWord && omitTypedWord;
}
@UsedForTesting
static int getPositionInSuggestionStrip(final int indexInSuggestedWords,
final boolean willAutoCorrect, final boolean omitTypedWord,
final int centerPositionInStrip, final int typedWordPositionWhenAutoCorrect) {

View file

@ -10,7 +10,6 @@ import android.os.Build;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodSubtype;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.R;
import helium314.keyboard.latin.common.LocaleUtils;
import helium314.keyboard.latin.common.StringUtils;
@ -35,7 +34,6 @@ public final class AdditionalSubtypeUtils {
// This utility class is not publicly instantiable.
}
@UsedForTesting
public static boolean isAdditionalSubtype(final InputMethodSubtype subtype) {
return subtype.containsExtraValueKey(IS_ADDITIONAL_SUBTYPE);
}

View file

@ -14,8 +14,6 @@ import androidx.annotation.Nullable;
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.Dictionary;
import helium314.keyboard.latin.define.DecoderSpecificConstants;
import helium314.keyboard.latin.makedict.DictionaryHeader;
import helium314.keyboard.latin.makedict.UnsupportedFormatException;
@ -187,7 +185,6 @@ public class DictionaryInfoUtils {
return dictionaryList;
}
@UsedForTesting
public static boolean looksValidForDictionaryInsertion(final CharSequence text,
final SpacingAndPunctuations spacingAndPunctuations) {
if (TextUtils.isEmpty(text)) {

View file

@ -6,10 +6,6 @@
package helium314.keyboard.latin.utils;
import helium314.keyboard.latin.utils.Log;
import helium314.keyboard.annotations.UsedForTesting;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
@ -52,10 +48,8 @@ public class ExecutorUtils {
}
}
@UsedForTesting
private static ScheduledExecutorService sExecutorServiceForTests;
@UsedForTesting
public static void setExecutorServiceForTests(
final ScheduledExecutorService executorServiceForTests) {
sExecutorServiceForTests = executorServiceForTests;
@ -107,12 +101,10 @@ public class ExecutorUtils {
}
}
@UsedForTesting
public static Runnable chain(final Runnable... runnables) {
return new RunnableChain(runnables);
}
@UsedForTesting
public static class RunnableChain implements Runnable {
private final Runnable[] mRunnables;
@ -123,7 +115,6 @@ public class ExecutorUtils {
mRunnables = runnables;
}
@UsedForTesting
public Runnable[] getRunnables() {
return mRunnables;
}

View file

@ -14,7 +14,6 @@ import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import helium314.keyboard.annotations.UsedForTesting;
import helium314.keyboard.latin.R;
import helium314.keyboard.latin.settings.SettingsValues;
@ -109,7 +108,6 @@ public final class ResourceUtils {
* @return the constant part of the matched "condition,constant" element. Returns null if no
* condition matches.
*/
@UsedForTesting
static String findConstantForKeyValuePairs(final HashMap<String, String> keyValuePairs,
final String[] conditionConstantArray) {
if (conditionConstantArray == null || keyValuePairs == null) {

View file

@ -16,8 +16,6 @@ import android.text.TextUtils;
import android.text.style.SuggestionSpan;
import android.text.style.URLSpan;
import helium314.keyboard.annotations.UsedForTesting;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -144,7 +142,6 @@ public final class SpannableStringUtils {
* @return the array which contains the result. All the spans in the <code>charSequence</code>
* is preserved.
*/
@UsedForTesting
public static CharSequence[] split(final CharSequence charSequence, final String regex,
final boolean preserveTrailingEmptySegments) {
// A short-cut for non-spanned strings.