Remove old show/hide messages on new ime

The previous show/hide messages in the queue were still trying
to be honored even after a new ime was attached.

Fixes bug 8263462.

Change-Id: Ie85369346cd3f843389a8e7837f5d97b56885309
This commit is contained in:
Craig Mautner
2013-03-11 12:28:07 -07:00
parent bbc30a032d
commit b11b1f2679
2 changed files with 7 additions and 4 deletions

View File

@@ -1204,7 +1204,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mCurId = info.getId();
mCurToken = new Binder();
try {
if (true || DEBUG) Slog.v(TAG, "b8263462 Adding window token: " + mCurToken);
if (DEBUG) Slog.v(TAG, "Adding window token: " + mCurToken);
mIWindowManager.addWindowToken(mCurToken,
WindowManager.LayoutParams.TYPE_INPUT_METHOD);
} catch (RemoteException e) {
@@ -1248,7 +1248,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
unbindCurrentMethodLocked(false, false);
return;
}
if (true || DEBUG) Slog.v(TAG, "b8263462 Initiating attach with token: " + mCurToken);
// Remove commands relating to the previous service. Otherwise WindowManagerService
// will reject the command because the token attached to these messages is invalid.
mCaller.removeMessages(MSG_SHOW_SOFT_INPUT);
mCaller.removeMessages(MSG_HIDE_SOFT_INPUT);
if (DEBUG) Slog.v(TAG, "Initiating attach with token: " + mCurToken);
executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
MSG_ATTACH_TOKEN, mCurMethod, mCurToken));
if (mCurClient != null) {
@@ -2324,7 +2328,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
case MSG_ATTACH_TOKEN:
args = (SomeArgs)msg.obj;
try {
if (true || DEBUG) Slog.v(TAG, "b8263462 Sending attach of token: " + args.arg2);
if (DEBUG) Slog.v(TAG, "Sending attach of token: " + args.arg2);
((IInputMethod)args.arg1).attachToken((IBinder)args.arg2);
} catch (RemoteException e) {
}