From 9313bef894cef4be2f5821be1d812b30f1451894 Mon Sep 17 00:00:00 2001 From: satok Date: Tue, 25 Jan 2011 16:52:06 +0900 Subject: [PATCH] Avoid disk writes on UI thread. Change-Id: I0a498e47afb2c9a5241e2f329c39e266550135a5 --- .../android/inputmethod/latin/SubtypeSwitcher.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index 7a1ac2e27..c1e14ad18 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -288,11 +288,18 @@ public class SubtypeSwitcher { //////////////////////////// public void switchToShortcutIME() { - IBinder token = mService.getWindow().getWindow().getAttributes().token; + final IBinder token = mService.getWindow().getWindow().getAttributes().token; if (token == null || mShortcutInfo == null) { return; } - mImm.setInputMethodAndSubtype(token, mShortcutInfo.getId(), mShortcutSubtype); + final String imiId = mShortcutInfo.getId(); + final InputMethodSubtype subtype = mShortcutSubtype; + new Thread("SwitchToShortcutIME") { + @Override + public void run() { + mImm.setInputMethodAndSubtype(token, imiId, subtype); + } + }.start(); } public Drawable getShortcutIcon() {