aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2010-09-16 19:14:13 +0900
committerKen Wakasa <kwakasa@google.com>2010-09-25 00:14:24 +0900
commit336bc6bfebe8f965572682e5d5f1d66829ee7e17 (patch)
tree3989ea32c50c60d17b43c100576c67fa41871e90 /java/src
parent1bebdcb4e422c0d9e52833dfd3bc0a8b9e07a266 (diff)
downloadlatinime-336bc6bfebe8f965572682e5d5f1d66829ee7e17.tar.gz
latinime-336bc6bfebe8f965572682e5d5f1d66829ee7e17.tar.xz
latinime-336bc6bfebe8f965572682e5d5f1d66829ee7e17.zip
Keep addWordToDictionary from doing disk I/O on main thread
bug: 2999524 Change-Id: Id8b04d38079cfa1dadd5955eb7f83085e60eb8e2
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/UserDictionary.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserDictionary.java b/java/src/com/android/inputmethod/latin/UserDictionary.java
index 3315cf6c9..49b95e9aa 100644
--- a/java/src/com/android/inputmethod/latin/UserDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserDictionary.java
@@ -89,13 +89,19 @@ public class UserDictionary extends ExpandableDictionary {
super.addWord(word, frequency);
// Update the user dictionary provider
- ContentValues values = new ContentValues(5);
+ final ContentValues values = new ContentValues(5);
values.put(Words.WORD, word);
values.put(Words.FREQUENCY, frequency);
values.put(Words.LOCALE, mLocale);
values.put(Words.APP_ID, 0);
- getContext().getContentResolver().insert(Words.CONTENT_URI, values);
+ final ContentResolver contentResolver = getContext().getContentResolver();
+ new Thread("addWord") {
+ public void run() {
+ contentResolver.insert(Words.CONTENT_URI, values);
+ }
+ }.start();
+
// In case the above does a synchronous callback of the change observer
setRequiresReload(false);
}