aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-12-15 22:55:10 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-12-15 22:55:10 -0800
commit6ba5f0d341a0fef9020c9dee814fb4b369620737 (patch)
treeb2e94a1b59b49abd8389881d61da856a5e0faaf3 /java/src
parentbe2f81f05539c064bdc1791d0dd60f3e68292ae1 (diff)
parentf8481883cc269f0be551a749a98567bf9d62b106 (diff)
downloadlatinime-6ba5f0d341a0fef9020c9dee814fb4b369620737.tar.gz
latinime-6ba5f0d341a0fef9020c9dee814fb4b369620737.tar.xz
latinime-6ba5f0d341a0fef9020c9dee814fb4b369620737.zip
Merge "Add error log to expensive ArraysCompatUtils.binarySearch"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/compat/ArraysCompatUtils.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/compat/ArraysCompatUtils.java b/java/src/com/android/inputmethod/compat/ArraysCompatUtils.java
index f6afbcfe2..011473bef 100644
--- a/java/src/com/android/inputmethod/compat/ArraysCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/ArraysCompatUtils.java
@@ -16,10 +16,14 @@
package com.android.inputmethod.compat;
+import android.util.Log;
+
import java.lang.reflect.Method;
import java.util.Arrays;
public class ArraysCompatUtils {
+ private static final String TAG = ArraysCompatUtils.class.getSimpleName();
+
private static final Method METHOD_Arrays_binarySearch = CompatUtils
.getMethod(Arrays.class, "binarySearch", int[].class, int.class, int.class, int.class);
@@ -33,8 +37,15 @@ public class ArraysCompatUtils {
}
}
- /* package */ static int compatBinarySearch(int[] array, int startIndex, int endIndex,
- int value) {
+ // TODO: Implement fast binary search
+ /* package for testing */
+ static int compatBinarySearch(int[] array, int startIndex, int endIndex, int value) {
+ // Output error log because this method has strict performance penalty.
+ // Note that this method has been called only from spell checker and spell checker exists
+ // only from IceCreamSandwich and after, so that there is no chance on pre-ICS device to
+ // invoke this method.
+ Log.e(TAG, "Invoked expensive binarySearch");
+
if (startIndex > endIndex) throw new IllegalArgumentException();
if (startIndex < 0 || endIndex > array.length) throw new ArrayIndexOutOfBoundsException();