aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 7cf8c5e49..0754b1fa9 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -148,6 +148,17 @@ public final class InputLogic {
mInputLogicHandler.reset();
}
+ // Normally this class just gets out of scope after the process ends, but in unit tests, we
+ // create several instances of LatinIME in the same process, which results in several
+ // instances of InputLogic. This cleans up the associated handler so that tests don't leak
+ // handlers.
+ public void recycle() {
+ final InputLogicHandler inputLogicHandler = mInputLogicHandler;
+ mInputLogicHandler = InputLogicHandler.NULL_HANDLER;
+ inputLogicHandler.destroy();
+ mSuggest.mDictionaryFacilitator.closeDictionaries();
+ }
+
/**
* React to a string input.
*