diff options
author | Craig Mautner <cmautner@google.com> | 2013-03-14 16:55:12 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-03-14 16:55:12 +0000 |
commit | 0317f6db1aac545ce727812f5988b6ccd8584d90 (patch) | |
tree | cbd048632c55a7b9498a2dab67af5cd7db203796 /services/java/com/android/server/InputMethodManagerService.java | |
parent | 2044158fe12fada339762825d0b4ec3961a14d34 (diff) | |
parent | b7ca680485f90c2507d969d7d64e5bec3acc3c33 (diff) | |
download | frameworks_base-0317f6db1aac545ce727812f5988b6ccd8584d90.zip frameworks_base-0317f6db1aac545ce727812f5988b6ccd8584d90.tar.gz frameworks_base-0317f6db1aac545ce727812f5988b6ccd8584d90.tar.bz2 |
am b7ca6804: am 67bea2ef: Merge "Remove WindowManager messages from remote queue." into jb-mr2-dev
* commit 'b7ca680485f90c2507d969d7d64e5bec3acc3c33':
Remove WindowManager messages from remote queue.
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index dbd743a..f037ea5 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -1204,7 +1204,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mCurId = info.getId(); mCurToken = new Binder(); try { - if (DEBUG) Slog.v(TAG, "Adding window token: " + mCurToken); + if (true || DEBUG) Slog.v(TAG, "Adding window token: " + mCurToken); mIWindowManager.addWindowToken(mCurToken, WindowManager.LayoutParams.TYPE_INPUT_METHOD); } catch (RemoteException e) { @@ -1242,14 +1242,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub public void onServiceConnected(ComponentName name, IBinder service) { synchronized (mMethodMap) { if (mCurIntent != null && name.equals(mCurIntent.getComponent())) { + IInputMethod prevMethod = mCurMethod; mCurMethod = IInputMethod.Stub.asInterface(service); if (mCurToken == null) { Slog.w(TAG, "Service connected without a token!"); unbindCurrentMethodLocked(false, false); return; } - // Remove commands relating to the previous service. Otherwise WindowManagerService - // will reject the command because the token attached to these messages is invalid. + // Remove messages relating to the previous service. Otherwise WindowManagerService + // will throw a BadTokenException because the old token is being removed. + if (prevMethod != null) { + try { + prevMethod.removeSoftInputMessages(); + } catch (RemoteException e) { + } + } mCaller.removeMessages(MSG_SHOW_SOFT_INPUT); mCaller.removeMessages(MSG_HIDE_SOFT_INPUT); if (true || DEBUG) Slog.v(TAG, "Initiating attach with token: " + mCurToken); @@ -2314,8 +2321,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub try { if (true || DEBUG) Slog.v(TAG, "Calling " + args.arg1 + ".showSoftInput(" + msg.arg1 + ", " + args.arg2 + ")"); - ((IInputMethod)args.arg1).showSoftInput(msg.arg1, - (ResultReceiver)args.arg2); + ((IInputMethod)args.arg1).showSoftInput(msg.arg1, (ResultReceiver)args.arg2); } catch (RemoteException e) { } args.recycle(); @@ -2325,8 +2331,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub try { if (true || DEBUG) Slog.v(TAG, "Calling " + args.arg1 + ".hideSoftInput(0, " + args.arg2 + ")"); - ((IInputMethod)args.arg1).hideSoftInput(0, - (ResultReceiver)args.arg2); + ((IInputMethod)args.arg1).hideSoftInput(0, (ResultReceiver)args.arg2); } catch (RemoteException e) { } args.recycle(); |