summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/InputMethodManagerService.java
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2013-03-14 09:43:02 -0700
committerCraig Mautner <cmautner@google.com>2013-03-14 09:43:02 -0700
commitca0ac718cbc2ad3e7ad2400f5fa34068f154ee20 (patch)
treede2e71086e7584da4684c0c1b404b20d087aa930 /services/java/com/android/server/InputMethodManagerService.java
parent6efb4c746f89458ffb3da21d7d70af0b220a4876 (diff)
downloadframeworks_base-ca0ac718cbc2ad3e7ad2400f5fa34068f154ee20.zip
frameworks_base-ca0ac718cbc2ad3e7ad2400f5fa34068f154ee20.tar.gz
frameworks_base-ca0ac718cbc2ad3e7ad2400f5fa34068f154ee20.tar.bz2
Remove WindowManager messages from remote queue.
When a new IME is attached it is not enough to remove the WindowManager messages from the local queue, but the ones in the previous IME queue must also be removed. Fixes bug 8263462. Change-Id: I9e916c6052a83dc7691bcba0b6ab8328b9b7cc36
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java19
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 d0048bf..14841af 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -1199,7 +1199,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) {
@@ -1237,14 +1237,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);
@@ -2309,8 +2316,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();
@@ -2320,8 +2326,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();