mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 05:52:47 +00:00
remove unused annotations
This commit is contained in:
parent
978d76ed7c
commit
3a354524f3
37 changed files with 6 additions and 183 deletions
13
app/proguard-rules.pro
vendored
13
app/proguard-rules.pro
vendored
|
@ -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
|
# Keep native methods
|
||||||
-keepclassmembers class * {
|
-keepclassmembers class * {
|
||||||
native <methods>;
|
native <methods>;
|
||||||
|
@ -20,7 +8,6 @@
|
||||||
-keep class helium314.keyboard.latin.Dictionary
|
-keep class helium314.keyboard.latin.Dictionary
|
||||||
-keep class helium314.keyboard.latin.NgramContext
|
-keep class helium314.keyboard.latin.NgramContext
|
||||||
-keep class helium314.keyboard.latin.makedict.ProbabilityInfo
|
-keep class helium314.keyboard.latin.makedict.ProbabilityInfo
|
||||||
-keep class helium314.keyboard.latin.utils.LanguageModelParam
|
|
||||||
|
|
||||||
# after upgrading to gradle 8, stack traces contain "unknown source"
|
# after upgrading to gradle 8, stack traces contain "unknown source"
|
||||||
-keepattributes SourceFile,LineNumberTable
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.util.SparseArray;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.Dictionary;
|
import helium314.keyboard.latin.Dictionary;
|
||||||
import helium314.keyboard.latin.NgramContext;
|
import helium314.keyboard.latin.NgramContext;
|
||||||
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
|
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 DICTIONARY_MAX_WORD_LENGTH = 48;
|
||||||
public static final int MAX_PREV_WORD_COUNT_FOR_N_GRAM = 3;
|
public static final int MAX_PREV_WORD_COUNT_FOR_N_GRAM = 3;
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static final String UNIGRAM_COUNT_QUERY = "UNIGRAM_COUNT";
|
public static final String UNIGRAM_COUNT_QUERY = "UNIGRAM_COUNT";
|
||||||
@UsedForTesting
|
|
||||||
public static final String BIGRAM_COUNT_QUERY = "BIGRAM_COUNT";
|
public static final String BIGRAM_COUNT_QUERY = "BIGRAM_COUNT";
|
||||||
@UsedForTesting
|
|
||||||
public static final String MAX_UNIGRAM_COUNT_QUERY = "MAX_UNIGRAM_COUNT";
|
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 String MAX_BIGRAM_COUNT_QUERY = "MAX_BIGRAM_COUNT";
|
||||||
|
|
||||||
public static final int NOT_A_VALID_TIMESTAMP = -1;
|
public static final int NOT_A_VALID_TIMESTAMP = -1;
|
||||||
|
@ -364,7 +359,6 @@ public final class BinaryDictionary extends Dictionary {
|
||||||
return getMaxProbabilityOfExactMatchesNative(mNativeDict, codePoints);
|
return getMaxProbabilityOfExactMatchesNative(mNativeDict, codePoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public boolean isValidNgram(final NgramContext ngramContext, final String word) {
|
public boolean isValidNgram(final NgramContext ngramContext, final String word) {
|
||||||
return getNgramProbability(ngramContext, word) != NOT_A_PROBABILITY;
|
return getNgramProbability(ngramContext, word) != NOT_A_PROBABILITY;
|
||||||
}
|
}
|
||||||
|
@ -505,7 +499,6 @@ public final class BinaryDictionary extends Dictionary {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public void updateEntriesForInputEvents(final WordInputEventForPersonalization[] inputEvents) {
|
public void updateEntriesForInputEvents(final WordInputEventForPersonalization[] inputEvents) {
|
||||||
if (!isValidDictionary()) {
|
if (!isValidDictionary()) {
|
||||||
return;
|
return;
|
||||||
|
@ -620,7 +613,6 @@ public final class BinaryDictionary extends Dictionary {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public String getPropertyForGettingStats(final String query) {
|
public String getPropertyForGettingStats(final String query) {
|
||||||
if (!isValidDictionary()) {
|
if (!isValidDictionary()) {
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
package com.android.inputmethod.latin.utils;
|
package com.android.inputmethod.latin.utils;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import com.android.inputmethod.latin.BinaryDictionary;
|
import com.android.inputmethod.latin.BinaryDictionary;
|
||||||
import helium314.keyboard.latin.common.StringUtils;
|
import helium314.keyboard.latin.common.StringUtils;
|
||||||
import helium314.keyboard.latin.makedict.DictionaryHeader;
|
import helium314.keyboard.latin.makedict.DictionaryHeader;
|
||||||
|
@ -31,7 +30,6 @@ public final class BinaryDictionaryUtils {
|
||||||
JniUtils.loadNativeLibrary();
|
JniUtils.loadNativeLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
private static native boolean createEmptyDictFileNative(String filePath, long dictVersion,
|
private static native boolean createEmptyDictFileNative(String filePath, long dictVersion,
|
||||||
String locale, String[] attributeKeyStringArray, String[] attributeValueStringArray);
|
String locale, String[] attributeKeyStringArray, String[] attributeValueStringArray);
|
||||||
private static native float calcNormalizedScoreNative(int[] before, int[] after, int score);
|
private static native float calcNormalizedScoreNative(int[] before, int[] after, int score);
|
||||||
|
@ -82,7 +80,6 @@ public final class BinaryDictionaryUtils {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static boolean createEmptyDictFile(final String filePath, final long dictVersion,
|
public static boolean createEmptyDictFile(final String filePath, final long dictVersion,
|
||||||
final Locale locale, final Map<String, String> attributeMap) {
|
final Locale locale, final Map<String, String> attributeMap) {
|
||||||
final String[] keyArray = new String[attributeMap.size()];
|
final String[] keyArray = new String[attributeMap.size()];
|
||||||
|
@ -112,7 +109,6 @@ public final class BinaryDictionaryUtils {
|
||||||
* @param currentTime seconds since the unix epoch
|
* @param currentTime seconds since the unix epoch
|
||||||
* @return current time got in the native code.
|
* @return current time got in the native code.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public static int setCurrentTimeForTest(final int currentTime) {
|
public static int setCurrentTimeForTest(final int currentTime) {
|
||||||
return setCurrentTimeForTestNative(currentTime);
|
return setCurrentTimeForTestNative(currentTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ package com.android.inputmethod.latin.utils;
|
||||||
|
|
||||||
import helium314.keyboard.latin.utils.Log;
|
import helium314.keyboard.latin.utils.Log;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.NgramContext;
|
import helium314.keyboard.latin.NgramContext;
|
||||||
import helium314.keyboard.latin.common.StringUtils;
|
import helium314.keyboard.latin.common.StringUtils;
|
||||||
import helium314.keyboard.latin.define.DecoderSpecificConstants;
|
import helium314.keyboard.latin.define.DecoderSpecificConstants;
|
||||||
|
@ -34,7 +33,6 @@ public final class WordInputEventForPersonalization {
|
||||||
// Time stamp in seconds.
|
// Time stamp in seconds.
|
||||||
public final int mTimestamp;
|
public final int mTimestamp;
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public WordInputEventForPersonalization(final CharSequence targetWord,
|
public WordInputEventForPersonalization(final CharSequence targetWord,
|
||||||
final NgramContext ngramContext, final int timestamp) {
|
final NgramContext ngramContext, final int timestamp) {
|
||||||
mTargetWord = StringUtils.toCodePointArray(targetWord);
|
mTargetWord = StringUtils.toCodePointArray(targetWord);
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -11,13 +11,11 @@ import android.text.Spannable
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import android.text.style.SuggestionSpan
|
import android.text.style.SuggestionSpan
|
||||||
import helium314.keyboard.annotations.UsedForTesting
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
// todo: this is not compat any more
|
// todo: this is not compat any more
|
||||||
object SuggestionSpanUtils {
|
object SuggestionSpanUtils {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@UsedForTesting
|
|
||||||
fun getTextWithAutoCorrectionIndicatorUnderline(context: Context?, text: String, locale: Locale?): CharSequence {
|
fun getTextWithAutoCorrectionIndicatorUnderline(context: Context?, text: String, locale: Locale?): CharSequence {
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
return text
|
return text
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
package helium314.keyboard.event
|
package helium314.keyboard.event
|
||||||
|
|
||||||
import helium314.keyboard.annotations.ExternallyReferenced
|
|
||||||
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo
|
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo
|
||||||
import helium314.keyboard.latin.common.Constants
|
import helium314.keyboard.latin.common.Constants
|
||||||
import helium314.keyboard.latin.common.StringUtils
|
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}
|
// 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.
|
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,
|
return Event(EVENT_TYPE_INPUT_KEYPRESS, null /* text */, codePoint, keyCode,
|
||||||
Constants.EXTERNAL_KEYBOARD_COORDINATE, Constants.EXTERNAL_KEYBOARD_COORDINATE,
|
Constants.EXTERNAL_KEYBOARD_COORDINATE, Constants.EXTERNAL_KEYBOARD_COORDINATE,
|
||||||
|
|
|
@ -10,8 +10,6 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -57,7 +55,6 @@ public class KeyboardLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public int[] getKeyCodes() {
|
public int[] getKeyCodes() {
|
||||||
return mKeyCodes;
|
return mKeyCodes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
|
|
||||||
import helium314.keyboard.accessibility.AccessibilityUtils;
|
import helium314.keyboard.accessibility.AccessibilityUtils;
|
||||||
import helium314.keyboard.accessibility.MainKeyboardAccessibilityDelegate;
|
import helium314.keyboard.accessibility.MainKeyboardAccessibilityDelegate;
|
||||||
import helium314.keyboard.annotations.ExternallyReferenced;
|
|
||||||
import helium314.keyboard.compat.ConfigurationCompatKt;
|
import helium314.keyboard.compat.ConfigurationCompatKt;
|
||||||
import helium314.keyboard.keyboard.internal.DrawingPreviewPlacerView;
|
import helium314.keyboard.keyboard.internal.DrawingPreviewPlacerView;
|
||||||
import helium314.keyboard.keyboard.internal.DrawingProxy;
|
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) {
|
public void setLanguageOnSpacebarAnimAlpha(final int alpha) {
|
||||||
mLanguageOnSpacebarAnimAlpha = alpha;
|
mLanguageOnSpacebarAnimAlpha = alpha;
|
||||||
invalidateKey(mSpaceKey);
|
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) {
|
public void setKeyboardActionListener(final KeyboardActionListener listener) {
|
||||||
mKeyboardActionListener = listener;
|
mKeyboardActionListener = listener;
|
||||||
PointerTracker.setKeyboardActionListener(listener);
|
PointerTracker.setKeyboardActionListener(listener);
|
||||||
|
|
|
@ -11,7 +11,6 @@ import android.graphics.Paint;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.keyboard.internal.KeyboardBuilder;
|
import helium314.keyboard.keyboard.internal.KeyboardBuilder;
|
||||||
import helium314.keyboard.keyboard.internal.KeyboardParams;
|
import helium314.keyboard.keyboard.internal.KeyboardParams;
|
||||||
import helium314.keyboard.keyboard.internal.MoreKeySpec;
|
import helium314.keyboard.keyboard.internal.MoreKeySpec;
|
||||||
|
@ -31,7 +30,6 @@ public final class MoreKeysKeyboard extends Keyboard {
|
||||||
return mDefaultKeyCoordX;
|
return mDefaultKeyCoordX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
static class MoreKeysKeyboardParams extends KeyboardParams {
|
static class MoreKeysKeyboardParams extends KeyboardParams {
|
||||||
public boolean mIsMoreKeysFixedOrder;
|
public boolean mIsMoreKeysFixedOrder;
|
||||||
/* package */int mTopRowAdjustment;
|
/* package */int mTopRowAdjustment;
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.content.Context
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.util.Xml
|
import android.util.Xml
|
||||||
import androidx.annotation.XmlRes
|
import androidx.annotation.XmlRes
|
||||||
import helium314.keyboard.annotations.UsedForTesting
|
|
||||||
import helium314.keyboard.keyboard.Key
|
import helium314.keyboard.keyboard.Key
|
||||||
import helium314.keyboard.keyboard.Key.KeyParams
|
import helium314.keyboard.keyboard.Key.KeyParams
|
||||||
import helium314.keyboard.keyboard.Keyboard
|
import helium314.keyboard.keyboard.Keyboard
|
||||||
|
@ -86,7 +85,6 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
||||||
mParams.readAttributes(mContext, null)
|
mParams.readAttributes(mContext, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
fun disableTouchPositionCorrectionDataForTest() {
|
fun disableTouchPositionCorrectionDataForTest() {
|
||||||
mParams.mTouchPositionCorrection.setEnabled(false)
|
mParams.mTouchPositionCorrection.setEnabled(false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ package helium314.keyboard.keyboard.internal;
|
||||||
|
|
||||||
import helium314.keyboard.latin.utils.Log;
|
import helium314.keyboard.latin.utils.Log;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Locale;
|
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
|
* Utilities for matrix operations. Don't instantiate objects inside this class to prevent
|
||||||
* unexpected performance regressions.
|
* unexpected performance regressions.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public class MatrixUtils {
|
public class MatrixUtils {
|
||||||
static final String TAG = MatrixUtils.class.getSimpleName();
|
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 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.
|
* the value of squareMatrix is modified in this function and can't be resuable.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public static void inverse(final float[][] squareMatrix,
|
public static void inverse(final float[][] squareMatrix,
|
||||||
final float[][] inverseMatrix) throws MatrixOperationFailedException {
|
final float[][] inverseMatrix) throws MatrixOperationFailedException {
|
||||||
final int size = squareMatrix.length;
|
final int size = squareMatrix.length;
|
||||||
|
@ -110,7 +106,6 @@ public class MatrixUtils {
|
||||||
/**
|
/**
|
||||||
* A matrix operation to multiply m0 and m1.
|
* A matrix operation to multiply m0 and m1.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public static void multiply(final float[][] m0, final float[][] m1,
|
public static void multiply(final float[][] m0, final float[][] m1,
|
||||||
final float[][] retval) throws MatrixOperationFailedException {
|
final float[][] retval) throws MatrixOperationFailedException {
|
||||||
if (m0[0].length != m1.length) {
|
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
|
* A utility function to dump the specified matrix in a readable way
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public static void dump(final String title, final float[][] a) {
|
public static void dump(final String title, final float[][] a) {
|
||||||
final int column = a[0].length;
|
final int column = a[0].length;
|
||||||
final int row = a.length;
|
final int row = a.length;
|
||||||
|
|
|
@ -6,10 +6,8 @@
|
||||||
|
|
||||||
package helium314.keyboard.keyboard.internal;
|
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.keyboard.internal.MatrixUtils.MatrixOperationFailedException;
|
||||||
|
import helium314.keyboard.latin.utils.Log;
|
||||||
|
|
||||||
import java.util.Arrays;
|
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
|
* Utilities to smooth coordinates. Currently, we calculate 3d least squares formula by using
|
||||||
* Lagrangian smoothing
|
* Lagrangian smoothing
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
// todo: unused, what could this be used for? maybe just remove (then also remove MatrixUtils)
|
||||||
public class SmoothingUtils {
|
public class SmoothingUtils {
|
||||||
private static final String TAG = SmoothingUtils.class.getSimpleName();
|
private static final String TAG = SmoothingUtils.class.getSimpleName();
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
@ -30,7 +28,6 @@ public class SmoothingUtils {
|
||||||
* Find a most likely 3d least squares formula for specified coordinates.
|
* Find a most likely 3d least squares formula for specified coordinates.
|
||||||
* "retval" should be a 1x4 size matrix.
|
* "retval" should be a 1x4 size matrix.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public static void get3DParameters(final float[] xs, final float[] ys,
|
public static void get3DParameters(final float[] xs, final float[] ys,
|
||||||
final float[][] retval) throws MatrixOperationFailedException {
|
final float[][] retval) throws MatrixOperationFailedException {
|
||||||
final int COEFF_COUNT = 4; // Coefficient count for 3d smoothing
|
final int COEFF_COUNT = 4; // Coefficient count for 3d smoothing
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
package helium314.keyboard.keyboard.internal;
|
package helium314.keyboard.keyboard.internal;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.define.DebugFlags;
|
import helium314.keyboard.latin.define.DebugFlags;
|
||||||
|
|
||||||
public final class TouchPositionCorrection {
|
public final class TouchPositionCorrection {
|
||||||
|
@ -57,7 +56,6 @@ public final class TouchPositionCorrection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public void setEnabled(final boolean enabled) {
|
public void setEnabled(final boolean enabled) {
|
||||||
mEnabled = enabled;
|
mEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.BinaryDictionary;
|
import com.android.inputmethod.latin.BinaryDictionary;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.ExternallyReferenced;
|
|
||||||
import helium314.keyboard.latin.ContactsManager.ContactsChangedListener;
|
import helium314.keyboard.latin.ContactsManager.ContactsChangedListener;
|
||||||
import helium314.keyboard.latin.common.StringUtils;
|
import helium314.keyboard.latin.common.StringUtils;
|
||||||
import helium314.keyboard.latin.permissions.PermissionsUtil;
|
import helium314.keyboard.latin.permissions.PermissionsUtil;
|
||||||
|
@ -50,7 +49,6 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary
|
||||||
reloadDictionaryIfRequired();
|
reloadDictionaryIfRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExternallyReferenced
|
|
||||||
public static ContactsBinaryDictionary getDictionary(final Context context, final Locale locale,
|
public static ContactsBinaryDictionary getDictionary(final Context context, final Locale locale,
|
||||||
final File dictFile, final String dictNamePrefix, @Nullable final String account) {
|
final File dictFile, final String dictNamePrefix, @Nullable final String account) {
|
||||||
return new ContactsBinaryDictionary(context, locale, dictFile, dictNamePrefix + NAME);
|
return new ContactsBinaryDictionary(context, locale, dictFile, dictNamePrefix + NAME);
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
package helium314.keyboard.latin;
|
package helium314.keyboard.latin;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
|
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
|
||||||
import helium314.keyboard.latin.common.ComposedData;
|
import helium314.keyboard.latin.common.ComposedData;
|
||||||
import helium314.keyboard.latin.settings.SettingsValuesForSuggestion;
|
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
|
* Not a true dictionary. A placeholder used to indicate suggestions that don't come from any
|
||||||
* real dictionary.
|
* real dictionary.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
static class PhonyDictionary extends Dictionary {
|
static class PhonyDictionary extends Dictionary {
|
||||||
@UsedForTesting
|
|
||||||
PhonyDictionary(final String type) {
|
PhonyDictionary(final String type) {
|
||||||
super(type, null);
|
super(type, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ import android.view.inputmethod.InputMethodInfo;
|
||||||
import android.view.inputmethod.InputMethodSubtype;
|
import android.view.inputmethod.InputMethodSubtype;
|
||||||
|
|
||||||
import helium314.keyboard.accessibility.AccessibilityUtils;
|
import helium314.keyboard.accessibility.AccessibilityUtils;
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.compat.ConfigurationCompatKt;
|
import helium314.keyboard.compat.ConfigurationCompatKt;
|
||||||
import helium314.keyboard.compat.EditorInfoCompatUtils;
|
import helium314.keyboard.compat.EditorInfoCompatUtils;
|
||||||
import helium314.keyboard.compat.InsetsOutlineProvider;
|
import helium314.keyboard.compat.InsetsOutlineProvider;
|
||||||
|
@ -147,7 +146,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private SuggestionStripView mSuggestionStripView;
|
private SuggestionStripView mSuggestionStripView;
|
||||||
|
|
||||||
private RichInputMethodManager mRichImm;
|
private RichInputMethodManager mRichImm;
|
||||||
@UsedForTesting final KeyboardSwitcher mKeyboardSwitcher;
|
final KeyboardSwitcher mKeyboardSwitcher;
|
||||||
private final SubtypeState mSubtypeState = new SubtypeState();
|
private final SubtypeState mSubtypeState = new SubtypeState();
|
||||||
private EmojiAltPhysicalKeyDetector mEmojiAltPhysicalKeyDetector;
|
private EmojiAltPhysicalKeyDetector mEmojiAltPhysicalKeyDetector;
|
||||||
private final StatsUtilsManager mStatsUtilsManager;
|
private final StatsUtilsManager mStatsUtilsManager;
|
||||||
|
@ -407,7 +406,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return hasMessages(MSG_DEALLOCATE_MEMORY);
|
return hasMessages(MSG_DEALLOCATE_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public void removeAllMessages() {
|
public void removeAllMessages() {
|
||||||
for (int i = 0; i <= MSG_LAST; ++i) {
|
for (int i = 0; i <= MSG_LAST; ++i) {
|
||||||
removeMessages(i);
|
removeMessages(i);
|
||||||
|
@ -647,9 +645,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
StatsUtils.onCreate(mSettings.getCurrent(), mRichImm);
|
StatsUtils.onCreate(mSettings.getCurrent(), mRichImm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has to be package-visible for unit tests
|
private void loadSettings() {
|
||||||
@UsedForTesting
|
|
||||||
void loadSettings() {
|
|
||||||
final Locale locale = mRichImm.getCurrentSubtypeLocale();
|
final Locale locale = mRichImm.getCurrentSubtypeLocale();
|
||||||
final EditorInfo editorInfo = getCurrentInputEditorInfo();
|
final EditorInfo editorInfo = getCurrentInputEditorInfo();
|
||||||
final InputAttributes inputAttributes = new InputAttributes(
|
final InputAttributes inputAttributes = new InputAttributes(
|
||||||
|
@ -762,7 +758,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
unregisterReceiver(mDictionaryPackInstallReceiver);
|
unregisterReceiver(mDictionaryPackInstallReceiver);
|
||||||
unregisterReceiver(mDictionaryDumpBroadcastReceiver);
|
unregisterReceiver(mDictionaryDumpBroadcastReceiver);
|
||||||
|
@ -1785,9 +1780,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mDictionaryFacilitator.removeWord(word);
|
mDictionaryFacilitator.removeWord(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outside LatinIME, only used by the {@link InputTestsBase} test suite.
|
private void loadKeyboard() {
|
||||||
@UsedForTesting
|
|
||||||
void loadKeyboard() {
|
|
||||||
// Since we are switching languages, the most urgent thing is to let the keyboard graphics
|
// 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
|
// 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
|
// the screen. Anything we do right now will delay this, so wait until the next frame
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.common.StringUtils;
|
import helium314.keyboard.latin.common.StringUtils;
|
||||||
import helium314.keyboard.latin.define.DecoderSpecificConstants;
|
import helium314.keyboard.latin.define.DecoderSpecificConstants;
|
||||||
|
|
||||||
|
@ -199,7 +198,6 @@ public class NgramContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// n is 1-indexed.
|
// n is 1-indexed.
|
||||||
@UsedForTesting
|
|
||||||
public boolean isNthPrevWordBeginningOfSentence(final int n) {
|
public boolean isNthPrevWordBeginningOfSentence(final int n) {
|
||||||
if (n <= 0 || n > mPrevWordsCount) {
|
if (n <= 0 || n > mPrevWordsCount) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -15,7 +15,6 @@ import android.view.inputmethod.InputMethodInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.view.inputmethod.InputMethodSubtype;
|
import android.view.inputmethod.InputMethodSubtype;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.compat.ConfigurationCompatKt;
|
import helium314.keyboard.compat.ConfigurationCompatKt;
|
||||||
import helium314.keyboard.latin.common.LocaleUtils;
|
import helium314.keyboard.latin.common.LocaleUtils;
|
||||||
import helium314.keyboard.latin.settings.Settings;
|
import helium314.keyboard.latin.settings.Settings;
|
||||||
|
@ -210,7 +209,6 @@ public class RichInputMethodManager {
|
||||||
|
|
||||||
private static RichInputMethodSubtype sForcedSubtypeForTesting = null;
|
private static RichInputMethodSubtype sForcedSubtypeForTesting = null;
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
static void forceSubtype(@NonNull final InputMethodSubtype subtype) {
|
static void forceSubtype(@NonNull final InputMethodSubtype subtype) {
|
||||||
sForcedSubtypeForTesting = RichInputMethodSubtype.getRichInputMethodSubtype(subtype);
|
sForcedSubtypeForTesting = RichInputMethodSubtype.getRichInputMethodSubtype(subtype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ package helium314.keyboard.latin;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import helium314.keyboard.latin.utils.Log;
|
import helium314.keyboard.latin.utils.Log;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.keyboard.Keyboard;
|
import helium314.keyboard.keyboard.Keyboard;
|
||||||
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
|
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
|
||||||
import helium314.keyboard.latin.common.ComposedData;
|
import helium314.keyboard.latin.common.ComposedData;
|
||||||
|
@ -272,7 +271,6 @@ public final class Suggest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns [allowsToBeAutoCorrected, hasAutoCorrection]
|
// returns [allowsToBeAutoCorrected, hasAutoCorrection]
|
||||||
@UsedForTesting
|
|
||||||
boolean[] shouldBeAutoCorrected(
|
boolean[] shouldBeAutoCorrected(
|
||||||
final int trailingSingleQuotesCount,
|
final int trailingSingleQuotesCount,
|
||||||
final String typedWordString,
|
final String typedWordString,
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.view.inputmethod.CompletionInfo;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.common.StringUtils;
|
import helium314.keyboard.latin.common.StringUtils;
|
||||||
import helium314.keyboard.latin.define.DebugFlags;
|
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
|
* typed by the user. Otherwise returns {@code null}. Note that gesture input is not
|
||||||
* considered to be a typed word.
|
* considered to be a typed word.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public SuggestedWordInfo getTypedWordInfoOrNull() {
|
public SuggestedWordInfo getTypedWordInfoOrNull() {
|
||||||
if (SuggestedWords.INDEX_OF_TYPED_WORD >= size()) {
|
if (SuggestedWords.INDEX_OF_TYPED_WORD >= size()) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -13,13 +13,12 @@ import android.database.sqlite.SQLiteException;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.provider.UserDictionary.Words;
|
import android.provider.UserDictionary.Words;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import helium314.keyboard.latin.utils.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.BinaryDictionary;
|
import com.android.inputmethod.latin.BinaryDictionary;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.ExternallyReferenced;
|
import helium314.keyboard.latin.utils.Log;
|
||||||
import helium314.keyboard.latin.utils.SubtypeLocaleUtils;
|
import helium314.keyboard.latin.utils.SubtypeLocaleUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -82,7 +81,6 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
|
||||||
reloadDictionaryIfRequired();
|
reloadDictionaryIfRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExternallyReferenced
|
|
||||||
public static UserBinaryDictionary getDictionary(
|
public static UserBinaryDictionary getDictionary(
|
||||||
final Context context, final Locale locale, final File dictFile,
|
final Context context, final Locale locale, final File dictFile,
|
||||||
final String dictNamePrefix, @Nullable final String account) {
|
final String dictNamePrefix, @Nullable final String account) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ package helium314.keyboard.latin;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.event.CombinerChain;
|
import helium314.keyboard.event.CombinerChain;
|
||||||
import helium314.keyboard.event.Event;
|
import helium314.keyboard.event.Event;
|
||||||
import helium314.keyboard.keyboard.Keyboard;
|
import helium314.keyboard.keyboard.Keyboard;
|
||||||
|
@ -483,17 +482,14 @@ public final class WordComposer {
|
||||||
return mRejectedBatchModeSuggestion;
|
return mRejectedBatchModeSuggestion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
void addInputPointerForTest(int index, int keyX, int keyY) {
|
void addInputPointerForTest(int index, int keyX, int keyY) {
|
||||||
mInputPointers.addPointerAt(index, keyX, keyY, 0, 0);
|
mInputPointers.addPointerAt(index, keyX, keyY, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
void setTypedWordCacheForTests(String typedWordCacheForTests) {
|
void setTypedWordCacheForTests(String typedWordCacheForTests) {
|
||||||
mTypedWordCache = typedWordCacheForTests;
|
mTypedWordCache = typedWordCacheForTests;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
static WordComposer getComposerForTest(boolean isEmpty) {
|
static WordComposer getComposerForTest(boolean isEmpty) {
|
||||||
return new WordComposer(isEmpty);
|
return new WordComposer(isEmpty);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ package helium314.keyboard.latin.common;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
|
|
||||||
// TODO: This class is not thread-safe.
|
// TODO: This class is not thread-safe.
|
||||||
public final class InputPointers {
|
public final class InputPointers {
|
||||||
private static final boolean DEBUG_TIME = false;
|
private static final boolean DEBUG_TIME = false;
|
||||||
|
@ -54,7 +52,6 @@ public final class InputPointers {
|
||||||
mTimes.addAt(index, time);
|
mTimes.addAt(index, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public void addPointer(final int x, final int y, final int pointerId, final int time) {
|
public void addPointer(final int x, final int y, final int pointerId, final int time) {
|
||||||
mXCoordinates.add(x);
|
mXCoordinates.add(x);
|
||||||
mYCoordinates.add(y);
|
mYCoordinates.add(y);
|
||||||
|
@ -102,7 +99,6 @@ public final class InputPointers {
|
||||||
* Shift to the left by elementCount, discarding elementCount pointers at the start.
|
* Shift to the left by elementCount, discarding elementCount pointers at the start.
|
||||||
* @param elementCount how many elements to shift.
|
* @param elementCount how many elements to shift.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public void shift(final int elementCount) {
|
public void shift(final int elementCount) {
|
||||||
mXCoordinates.shift(elementCount);
|
mXCoordinates.shift(elementCount);
|
||||||
mYCoordinates.shift(elementCount);
|
mYCoordinates.shift(elementCount);
|
||||||
|
|
|
@ -8,8 +8,6 @@ package helium314.keyboard.latin.common;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
// TODO: This class is not thread-safe.
|
// 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.
|
* Shift to the left by elementCount, discarding elementCount pointers at the start.
|
||||||
* @param elementCount how many elements to shift.
|
* @param elementCount how many elements to shift.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public void shift(final int elementCount) {
|
public void shift(final int elementCount) {
|
||||||
System.arraycopy(mArray, elementCount, mArray, 0, mLength - elementCount);
|
System.arraycopy(mArray, elementCount, mArray, 0, mLength - elementCount);
|
||||||
mLength -= elementCount;
|
mLength -= elementCount;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
package helium314.keyboard.latin.makedict;
|
package helium314.keyboard.latin.makedict;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.define.DecoderSpecificConstants;
|
import helium314.keyboard.latin.define.DecoderSpecificConstants;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -244,11 +243,6 @@ public final class FormatSpec {
|
||||||
public final int mVersion;
|
public final int mVersion;
|
||||||
public final boolean mHasTimestamp;
|
public final boolean mHasTimestamp;
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public FormatOptions(final int version) {
|
|
||||||
this(version, false /* hasTimestamp */);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormatOptions(final int version, final boolean hasTimestamp) {
|
public FormatOptions(final int version, final boolean hasTimestamp) {
|
||||||
mVersion = version;
|
mVersion = version;
|
||||||
mHasTimestamp = hasTimestamp;
|
mHasTimestamp = hasTimestamp;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
package helium314.keyboard.latin.makedict;
|
package helium314.keyboard.latin.makedict;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import com.android.inputmethod.latin.BinaryDictionary;
|
import com.android.inputmethod.latin.BinaryDictionary;
|
||||||
import helium314.keyboard.latin.utils.CombinedFormatUtils;
|
import helium314.keyboard.latin.utils.CombinedFormatUtils;
|
||||||
|
|
||||||
|
@ -21,7 +20,6 @@ public final class ProbabilityInfo {
|
||||||
public final int mLevel;
|
public final int mLevel;
|
||||||
public final int mCount;
|
public final int mCount;
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static ProbabilityInfo max(final ProbabilityInfo probabilityInfo1,
|
public static ProbabilityInfo max(final ProbabilityInfo probabilityInfo1,
|
||||||
final ProbabilityInfo probabilityInfo2) {
|
final ProbabilityInfo probabilityInfo2) {
|
||||||
if (probabilityInfo1 == null) {
|
if (probabilityInfo1 == null) {
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
package helium314.keyboard.latin.makedict;
|
package helium314.keyboard.latin.makedict;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +26,6 @@ public final class WeightedString {
|
||||||
mProbabilityInfo = probabilityInfo;
|
mProbabilityInfo = probabilityInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public int getProbability() {
|
public int getProbability() {
|
||||||
return mProbabilityInfo.mProbability;
|
return mProbabilityInfo.mProbability;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ package helium314.keyboard.latin.makedict;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import com.android.inputmethod.latin.BinaryDictionary;
|
import com.android.inputmethod.latin.BinaryDictionary;
|
||||||
import helium314.keyboard.latin.Dictionary;
|
import helium314.keyboard.latin.Dictionary;
|
||||||
import helium314.keyboard.latin.NgramContext;
|
import helium314.keyboard.latin.NgramContext;
|
||||||
|
@ -39,7 +38,6 @@ public final class WordProperty implements Comparable<WordProperty> {
|
||||||
private int mHashCode = 0;
|
private int mHashCode = 0;
|
||||||
|
|
||||||
// TODO: Support n-gram.
|
// TODO: Support n-gram.
|
||||||
@UsedForTesting
|
|
||||||
public WordProperty(final String word, final ProbabilityInfo probabilityInfo,
|
public WordProperty(final String word, final ProbabilityInfo probabilityInfo,
|
||||||
final ArrayList<WeightedString> shortcutTargets,
|
final ArrayList<WeightedString> shortcutTargets,
|
||||||
@Nullable final ArrayList<WeightedString> bigrams,
|
@Nullable final ArrayList<WeightedString> bigrams,
|
||||||
|
@ -122,7 +120,6 @@ public final class WordProperty implements Comparable<WordProperty> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove
|
// TODO: Remove
|
||||||
@UsedForTesting
|
|
||||||
public ArrayList<WeightedString> getBigrams() {
|
public ArrayList<WeightedString> getBigrams() {
|
||||||
if (null == mNgrams) {
|
if (null == mNgrams) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -197,7 +194,6 @@ public final class WordProperty implements Comparable<WordProperty> {
|
||||||
return mHashCode;
|
return mHashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return getProbability() != Dictionary.NOT_A_PROBABILITY;
|
return getProbability() != Dictionary.NOT_A_PROBABILITY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,6 @@ import android.content.Context;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.ExternallyReferenced;
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import com.android.inputmethod.latin.BinaryDictionary;
|
import com.android.inputmethod.latin.BinaryDictionary;
|
||||||
import helium314.keyboard.latin.Dictionary;
|
import helium314.keyboard.latin.Dictionary;
|
||||||
import helium314.keyboard.latin.ExpandableBinaryDictionary;
|
import helium314.keyboard.latin.ExpandableBinaryDictionary;
|
||||||
|
@ -43,13 +41,11 @@ public class UserHistoryDictionary extends ExpandableBinaryDictionary {
|
||||||
/**
|
/**
|
||||||
* @returns the name of the {@link UserHistoryDictionary}.
|
* @returns the name of the {@link UserHistoryDictionary}.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
static String getUserHistoryDictName(final String name, final Locale locale,
|
static String getUserHistoryDictName(final String name, final Locale locale,
|
||||||
@Nullable final File dictFile, @Nullable final String account) {
|
@Nullable final File dictFile, @Nullable final String account) {
|
||||||
return getDictName(name, locale, dictFile);
|
return getDictName(name, locale, dictFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExternallyReferenced
|
|
||||||
public static UserHistoryDictionary getDictionary(final Context context, final Locale locale,
|
public static UserHistoryDictionary getDictionary(final Context context, final Locale locale,
|
||||||
final File dictFile, final String dictNamePrefix, @Nullable final String account) {
|
final File dictFile, final String dictNamePrefix, @Nullable final String account) {
|
||||||
return PersonalizationHelper.getUserHistoryDictionary(context, locale, account);
|
return PersonalizationHelper.getUserHistoryDictionary(context, locale, account);
|
||||||
|
|
|
@ -37,7 +37,6 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import helium314.keyboard.accessibility.AccessibilityUtils;
|
import helium314.keyboard.accessibility.AccessibilityUtils;
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.PunctuationSuggestions;
|
import helium314.keyboard.latin.PunctuationSuggestions;
|
||||||
import helium314.keyboard.latin.R;
|
import helium314.keyboard.latin.R;
|
||||||
import helium314.keyboard.latin.SuggestedWords;
|
import helium314.keyboard.latin.SuggestedWords;
|
||||||
|
@ -230,7 +229,6 @@ final class SuggestionStripLayoutHelper {
|
||||||
shouldOmitTypedWord, mCenterPositionInStrip, mTypedWordPositionWhenAutocorrect);
|
shouldOmitTypedWord, mCenterPositionInStrip, mTypedWordPositionWhenAutocorrect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
static boolean shouldOmitTypedWord(final int inputStyle,
|
static boolean shouldOmitTypedWord(final int inputStyle,
|
||||||
final boolean gestureFloatingPreviewTextEnabled,
|
final boolean gestureFloatingPreviewTextEnabled,
|
||||||
final boolean shouldShowUiToAcceptTypedWord) {
|
final boolean shouldShowUiToAcceptTypedWord) {
|
||||||
|
@ -240,7 +238,6 @@ final class SuggestionStripLayoutHelper {
|
||||||
return shouldShowUiToAcceptTypedWord && omitTypedWord;
|
return shouldShowUiToAcceptTypedWord && omitTypedWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
static int getPositionInSuggestionStrip(final int indexInSuggestedWords,
|
static int getPositionInSuggestionStrip(final int indexInSuggestedWords,
|
||||||
final boolean willAutoCorrect, final boolean omitTypedWord,
|
final boolean willAutoCorrect, final boolean omitTypedWord,
|
||||||
final int centerPositionInStrip, final int typedWordPositionWhenAutoCorrect) {
|
final int centerPositionInStrip, final int typedWordPositionWhenAutoCorrect) {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.inputmethod.InputMethodSubtype;
|
import android.view.inputmethod.InputMethodSubtype;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.R;
|
import helium314.keyboard.latin.R;
|
||||||
import helium314.keyboard.latin.common.LocaleUtils;
|
import helium314.keyboard.latin.common.LocaleUtils;
|
||||||
import helium314.keyboard.latin.common.StringUtils;
|
import helium314.keyboard.latin.common.StringUtils;
|
||||||
|
@ -35,7 +34,6 @@ public final class AdditionalSubtypeUtils {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static boolean isAdditionalSubtype(final InputMethodSubtype subtype) {
|
public static boolean isAdditionalSubtype(final InputMethodSubtype subtype) {
|
||||||
return subtype.containsExtraValueKey(IS_ADDITIONAL_SUBTYPE);
|
return subtype.containsExtraValueKey(IS_ADDITIONAL_SUBTYPE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
|
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.define.DecoderSpecificConstants;
|
||||||
import helium314.keyboard.latin.makedict.DictionaryHeader;
|
import helium314.keyboard.latin.makedict.DictionaryHeader;
|
||||||
import helium314.keyboard.latin.makedict.UnsupportedFormatException;
|
import helium314.keyboard.latin.makedict.UnsupportedFormatException;
|
||||||
|
@ -187,7 +185,6 @@ public class DictionaryInfoUtils {
|
||||||
return dictionaryList;
|
return dictionaryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static boolean looksValidForDictionaryInsertion(final CharSequence text,
|
public static boolean looksValidForDictionaryInsertion(final CharSequence text,
|
||||||
final SpacingAndPunctuations spacingAndPunctuations) {
|
final SpacingAndPunctuations spacingAndPunctuations) {
|
||||||
if (TextUtils.isEmpty(text)) {
|
if (TextUtils.isEmpty(text)) {
|
||||||
|
|
|
@ -6,10 +6,6 @@
|
||||||
|
|
||||||
package helium314.keyboard.latin.utils;
|
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.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
@ -52,10 +48,8 @@ public class ExecutorUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
private static ScheduledExecutorService sExecutorServiceForTests;
|
private static ScheduledExecutorService sExecutorServiceForTests;
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static void setExecutorServiceForTests(
|
public static void setExecutorServiceForTests(
|
||||||
final ScheduledExecutorService executorServiceForTests) {
|
final ScheduledExecutorService executorServiceForTests) {
|
||||||
sExecutorServiceForTests = executorServiceForTests;
|
sExecutorServiceForTests = executorServiceForTests;
|
||||||
|
@ -107,12 +101,10 @@ public class ExecutorUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static Runnable chain(final Runnable... runnables) {
|
public static Runnable chain(final Runnable... runnables) {
|
||||||
return new RunnableChain(runnables);
|
return new RunnableChain(runnables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public static class RunnableChain implements Runnable {
|
public static class RunnableChain implements Runnable {
|
||||||
private final Runnable[] mRunnables;
|
private final Runnable[] mRunnables;
|
||||||
|
|
||||||
|
@ -123,7 +115,6 @@ public class ExecutorUtils {
|
||||||
mRunnables = runnables;
|
mRunnables = runnables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public Runnable[] getRunnables() {
|
public Runnable[] getRunnables() {
|
||||||
return mRunnables;
|
return mRunnables;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
import helium314.keyboard.latin.R;
|
import helium314.keyboard.latin.R;
|
||||||
import helium314.keyboard.latin.settings.SettingsValues;
|
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
|
* @return the constant part of the matched "condition,constant" element. Returns null if no
|
||||||
* condition matches.
|
* condition matches.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
static String findConstantForKeyValuePairs(final HashMap<String, String> keyValuePairs,
|
static String findConstantForKeyValuePairs(final HashMap<String, String> keyValuePairs,
|
||||||
final String[] conditionConstantArray) {
|
final String[] conditionConstantArray) {
|
||||||
if (conditionConstantArray == null || keyValuePairs == null) {
|
if (conditionConstantArray == null || keyValuePairs == null) {
|
||||||
|
|
|
@ -16,8 +16,6 @@ import android.text.TextUtils;
|
||||||
import android.text.style.SuggestionSpan;
|
import android.text.style.SuggestionSpan;
|
||||||
import android.text.style.URLSpan;
|
import android.text.style.URLSpan;
|
||||||
|
|
||||||
import helium314.keyboard.annotations.UsedForTesting;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
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>
|
* @return the array which contains the result. All the spans in the <code>charSequence</code>
|
||||||
* is preserved.
|
* is preserved.
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
|
||||||
public static CharSequence[] split(final CharSequence charSequence, final String regex,
|
public static CharSequence[] split(final CharSequence charSequence, final String regex,
|
||||||
final boolean preserveTrailingEmptySegments) {
|
final boolean preserveTrailingEmptySegments) {
|
||||||
// A short-cut for non-spanned strings.
|
// A short-cut for non-spanned strings.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue