diff options
author | Jeff Brown <jeffbrown@google.com> | 2013-04-05 14:09:41 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-04-05 14:09:41 -0700 |
commit | ae9d6aa6d96ad382bba27e8104ea99ad06d81008 (patch) | |
tree | 49d59b75ce49e66c38772e57bb7fbb292085721b /services/java/com/android/server/InputMethodManagerService.java | |
parent | 8740cb1da6adb71a4e195774801c97db5853b097 (diff) | |
parent | 4c2a7b23f5f012cf00357035f840a32d4da20eb5 (diff) | |
download | frameworks_base-ae9d6aa6d96ad382bba27e8104ea99ad06d81008.zip frameworks_base-ae9d6aa6d96ad382bba27e8104ea99ad06d81008.tar.gz frameworks_base-ae9d6aa6d96ad382bba27e8104ea99ad06d81008.tar.bz2 |
am 4c2a7b23: am 4a706bc6: Merge "Correctly manage the lifecycle of IME InputChannels." into jb-mr2-dev
* commit '4c2a7b23f5f012cf00357035f840a32d4da20eb5':
Correctly manage the lifecycle of IME InputChannels.
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index d2dba58..d19433e 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -1075,7 +1075,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Attach new input asks to show input"); showCurrentInputLocked(getAppShowFlags(), null); } - return new InputBindResult(session.session, session.channel, mCurId, mCurSeq); + return new InputBindResult(session.session, + session.channel != null ? session.channel.dup() : null, mCurId, mCurSeq); } InputBindResult startInputLocked(IInputMethodClient client, @@ -2362,13 +2363,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return true; case MSG_CREATE_SESSION: { args = (SomeArgs)msg.obj; + IInputMethod method = (IInputMethod)args.arg1; InputChannel channel = (InputChannel)args.arg2; try { - ((IInputMethod)args.arg1).createSession(channel, - (IInputSessionCallback)args.arg3); + method.createSession(channel, (IInputSessionCallback)args.arg3); } catch (RemoteException e) { } finally { - if (channel != null) { + // Dispose the channel if the input method is not local to this process + // because the remote proxy will get its own copy when unparceled. + if (channel != null && Binder.isProxy(method)) { channel.dispose(); } } @@ -2409,16 +2412,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // There is nothing interesting about the last client dying. } return true; - case MSG_BIND_METHOD: + case MSG_BIND_METHOD: { args = (SomeArgs)msg.obj; + IInputMethodClient client = (IInputMethodClient)args.arg1; + InputBindResult res = (InputBindResult)args.arg2; try { - ((IInputMethodClient)args.arg1).onBindMethod( - (InputBindResult)args.arg2); + client.onBindMethod(res); } catch (RemoteException e) { Slog.w(TAG, "Client died receiving input method " + args.arg2); + } finally { + // Dispose the channel if the input method is not local to this process + // because the remote proxy will get its own copy when unparceled. + if (res.channel != null && Binder.isProxy(client)) { + res.channel.dispose(); + } } args.recycle(); return true; + } case MSG_SET_ACTIVE: try { ((ClientState)msg.obj).client.setActive(msg.arg1 != 0); |