diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index 1da33ed3fe17cdd3e0499f99466c839285b1b00b..6f3c48c47b84b8933628fea5c1ff06e110931a2d 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -199,6 +199,9 @@ public final class BinaryDictionary extends Dictionary {
             int[] word, int probability, int timestamp);
     private static native boolean removeNgramEntryNative(long dict,
             int[][] prevWordCodePointArrays, boolean[] isBeginningOfSentenceArray, int[] word);
+    private static native boolean updateCounterNative(long dict,
+            int[][] prevWordCodePointArrays, boolean[] isBeginningOfSentenceArray,
+            int[] word, boolean isValidWord, int count, int timestamp);
     private static native int addMultipleDictionaryEntriesNative(long dict,
             LanguageModelParam[] languageModelParams, int startIndex);
     private static native String getPropertyNative(long dict, String query);
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
index da8c2ac03fb446fb425606d56c712b0a4d8de648..1e6baa5ec1e6edbbad06c7be0b9f614c781ec757 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
@@ -427,6 +427,19 @@ static bool latinime_BinaryDictionary_removeNgramEntry(JNIEnv *env, jclass clazz
             CodePointArrayView(wordCodePoints, codePointCount));
 }
 
+static bool latinime_BinaryDictionary_updateCounter(JNIEnv *env, jclass clazz, jlong dict,
+        jobjectArray prevWordCodePointArrays, jbooleanArray isBeginningOfSentenceArray,
+        jintArray word, jboolean isValidWord, jint count, jint timestamp) {
+    Dictionary *dictionary = reinterpret_cast<Dictionary *>(dict);
+    if (!dictionary) {
+        return false;
+    }
+    jsize wordLength = env->GetArrayLength(word);
+    int wordCodePoints[wordLength];
+    env->GetIntArrayRegion(word, 0, wordLength, wordCodePoints);
+    return false;
+}
+
 // Returns how many language model params are processed.
 static int latinime_BinaryDictionary_addMultipleDictionaryEntries(JNIEnv *env, jclass clazz,
         jlong dict, jobjectArray languageModelParams, jint startIndex) {
@@ -724,6 +737,11 @@ static const JNINativeMethod sMethods[] = {
         const_cast<char *>("(J[[I[Z[I)Z"),
         reinterpret_cast<void *>(latinime_BinaryDictionary_removeNgramEntry)
     },
+    {
+        const_cast<char *>("updateCounterNative"),
+        const_cast<char *>("(J[[I[Z[IZII)Z"),
+        reinterpret_cast<void *>(latinime_BinaryDictionary_updateCounter)
+    },
     {
         const_cast<char *>("addMultipleDictionaryEntriesNative"),
         const_cast<char *>(