diff options
| author | Dianne Hackborn <hackbod@google.com> | 2010-03-16 13:06:10 -0700 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2010-03-17 18:08:39 -0700 |
| commit | 8cf1bcd1d26ddbb471e4968b70e32ecabe4f7a20 (patch) | |
| tree | fb17c808df3236d8daeaa4b4d9e6108e93e8529c /services/java/com/android/server/InputMethodManagerService.java | |
| parent | aa773543c4b93e0396eac39d31bdb85f8465688e (diff) | |
Fix issue #2325621: Runtime restart after launching Android keyboard setting.
Again.
Change-Id: Icc36029767fbfea19e474aa0731e8271da1329db
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
| -rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index e336a355b761..11020c2806f5 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -1463,8 +1463,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub void showInputMethodMenu() { if (DEBUG) Slog.v(TAG, "Show switching menu"); - hideInputMethodMenu(); - final Context context = mContext; final PackageManager pm = context.getPackageManager(); @@ -1479,67 +1477,69 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return; } - int N = immis.size(); - - mItems = new CharSequence[N]; - mIms = new InputMethodInfo[N]; - - for (int i = 0; i < N; ++i) { - InputMethodInfo property = immis.get(i); - if (property == null) { - i--; - N--; - continue; - } - mItems[i] = property.loadLabel(pm); - mIms[i] = property; - } + synchronized (mMethodMap) { + hideInputMethodMenuLocked(); - int checkedItem = 0; - for (int i = 0; i < N; ++i) { - if (mIms[i].getId().equals(lastInputMethodId)) { - checkedItem = i; - break; + int N = immis.size(); + + mItems = new CharSequence[N]; + mIms = new InputMethodInfo[N]; + + int j = 0; + for (int i = 0; i < N; ++i) { + InputMethodInfo property = immis.get(i); + if (property == null) { + continue; + } + mItems[j] = property.loadLabel(pm); + mIms[j] = property; + j++; } - } - - AlertDialog.OnClickListener adocl = new AlertDialog.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - hideInputMethodMenu(); + + int checkedItem = 0; + for (int i = 0; i < N; ++i) { + if (mIms[i].getId().equals(lastInputMethodId)) { + checkedItem = i; + break; + } } - }; - - TypedArray a = context.obtainStyledAttributes(null, - com.android.internal.R.styleable.DialogPreference, - com.android.internal.R.attr.alertDialogStyle, 0); - mDialogBuilder = new AlertDialog.Builder(context) - .setTitle(com.android.internal.R.string.select_input_method) - .setOnCancelListener(new OnCancelListener() { - public void onCancel(DialogInterface dialog) { - hideInputMethodMenu(); - } - }) - .setIcon(a.getDrawable( - com.android.internal.R.styleable.DialogPreference_dialogTitle)); - a.recycle(); - - mDialogBuilder.setSingleChoiceItems(mItems, checkedItem, - new AlertDialog.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - synchronized (mMethodMap) { - if (mIms == null || mIms.length <= which) { - return; - } - InputMethodInfo im = mIms[which]; + + AlertDialog.OnClickListener adocl = new AlertDialog.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + hideInputMethodMenu(); + } + }; + + TypedArray a = context.obtainStyledAttributes(null, + com.android.internal.R.styleable.DialogPreference, + com.android.internal.R.attr.alertDialogStyle, 0); + mDialogBuilder = new AlertDialog.Builder(context) + .setTitle(com.android.internal.R.string.select_input_method) + .setOnCancelListener(new OnCancelListener() { + public void onCancel(DialogInterface dialog) { hideInputMethodMenu(); - if (im != null) { - setInputMethodLocked(im.getId()); + } + }) + .setIcon(a.getDrawable( + com.android.internal.R.styleable.DialogPreference_dialogTitle)); + a.recycle(); + + mDialogBuilder.setSingleChoiceItems(mItems, checkedItem, + new AlertDialog.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + synchronized (mMethodMap) { + if (mIms == null || mIms.length <= which) { + return; + } + InputMethodInfo im = mIms[which]; + hideInputMethodMenu(); + if (im != null) { + setInputMethodLocked(im.getId()); + } } } - } - }); + }); - synchronized (mMethodMap) { mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog.getWindow().setType( WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG); |
