Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package android.inputmethodservice; |
| 18 | |
| 19 | import com.android.internal.os.HandlerCaller; |
Svetoslav Ganov | 758143e | 2012-08-06 16:40:27 -0700 | [diff] [blame] | 20 | import com.android.internal.os.SomeArgs; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import com.android.internal.view.IInputContext; |
| 22 | import com.android.internal.view.IInputMethod; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | import com.android.internal.view.IInputMethodSession; |
Michael Wright | 52a5352 | 2013-03-14 10:59:38 -0700 | [diff] [blame] | 24 | import com.android.internal.view.IInputSessionCallback; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | import com.android.internal.view.InputConnectionWrapper; |
| 26 | |
| 27 | import android.content.Context; |
| 28 | import android.content.pm.PackageManager; |
| 29 | import android.os.Binder; |
| 30 | import android.os.IBinder; |
| 31 | import android.os.Message; |
| 32 | import android.os.RemoteException; |
The Android Open Source Project | 4df2423 | 2009-03-05 14:34:35 -0800 | [diff] [blame] | 33 | import android.os.ResultReceiver; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | import android.util.Log; |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 35 | import android.view.InputChannel; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | import android.view.inputmethod.EditorInfo; |
| 37 | import android.view.inputmethod.InputBinding; |
| 38 | import android.view.inputmethod.InputConnection; |
| 39 | import android.view.inputmethod.InputMethod; |
| 40 | import android.view.inputmethod.InputMethodSession; |
satok | ab751aa | 2010-09-14 19:17:36 +0900 | [diff] [blame] | 41 | import android.view.inputmethod.InputMethodSubtype; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | |
| 43 | import java.io.FileDescriptor; |
| 44 | import java.io.PrintWriter; |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 45 | import java.lang.ref.WeakReference; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 46 | import java.util.concurrent.CountDownLatch; |
| 47 | import java.util.concurrent.TimeUnit; |
| 48 | |
| 49 | /** |
| 50 | * Implements the internal IInputMethod interface to convert incoming calls |
| 51 | * on to it back to calls on the public InputMethod interface, scheduling |
| 52 | * them on the main thread of the process. |
| 53 | */ |
| 54 | class IInputMethodWrapper extends IInputMethod.Stub |
| 55 | implements HandlerCaller.Callback { |
| 56 | private static final String TAG = "InputMethodWrapper"; |
Craig Mautner | e4bbb1c | 2013-03-15 11:38:44 -0700 | [diff] [blame] | 57 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | private static final int DO_DUMP = 1; |
| 59 | private static final int DO_ATTACH_TOKEN = 10; |
| 60 | private static final int DO_SET_INPUT_CONTEXT = 20; |
| 61 | private static final int DO_UNSET_INPUT_CONTEXT = 30; |
| 62 | private static final int DO_START_INPUT = 32; |
| 63 | private static final int DO_RESTART_INPUT = 34; |
| 64 | private static final int DO_CREATE_SESSION = 40; |
| 65 | private static final int DO_SET_SESSION_ENABLED = 45; |
| 66 | private static final int DO_REVOKE_SESSION = 50; |
| 67 | private static final int DO_SHOW_SOFT_INPUT = 60; |
| 68 | private static final int DO_HIDE_SOFT_INPUT = 70; |
satok | ab751aa | 2010-09-14 19:17:36 +0900 | [diff] [blame] | 69 | private static final int DO_CHANGE_INPUTMETHOD_SUBTYPE = 80; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 71 | final WeakReference<AbstractInputMethodService> mTarget; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 72 | final HandlerCaller mCaller; |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 73 | final WeakReference<InputMethod> mInputMethod; |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 74 | final int mTargetSdkVersion; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | |
| 76 | static class Notifier { |
| 77 | boolean notified; |
| 78 | } |
| 79 | |
| 80 | // NOTE: we should have a cache of these. |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 81 | static final class InputMethodSessionCallbackWrapper implements InputMethod.SessionCallback { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | final Context mContext; |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 83 | final InputChannel mChannel; |
Michael Wright | 52a5352 | 2013-03-14 10:59:38 -0700 | [diff] [blame] | 84 | final IInputSessionCallback mCb; |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 85 | |
| 86 | InputMethodSessionCallbackWrapper(Context context, InputChannel channel, |
| 87 | IInputSessionCallback cb) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | mContext = context; |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 89 | mChannel = channel; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | mCb = cb; |
| 91 | } |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 92 | |
| 93 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 94 | public void sessionCreated(InputMethodSession session) { |
| 95 | try { |
| 96 | if (session != null) { |
| 97 | IInputMethodSessionWrapper wrap = |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 98 | new IInputMethodSessionWrapper(mContext, session, mChannel); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 99 | mCb.sessionCreated(wrap); |
| 100 | } else { |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 101 | if (mChannel != null) { |
| 102 | mChannel.dispose(); |
| 103 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 104 | mCb.sessionCreated(null); |
| 105 | } |
| 106 | } catch (RemoteException e) { |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | public IInputMethodWrapper(AbstractInputMethodService context, |
| 112 | InputMethod inputMethod) { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 113 | mTarget = new WeakReference<AbstractInputMethodService>(context); |
Mita Yun | ed218c7 | 2012-12-06 17:18:25 -0800 | [diff] [blame] | 114 | mCaller = new HandlerCaller(context.getApplicationContext(), null, |
| 115 | this, true /*asyncHandler*/); |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 116 | mInputMethod = new WeakReference<InputMethod>(inputMethod); |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 117 | mTargetSdkVersion = context.getApplicationInfo().targetSdkVersion; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | public InputMethod getInternalInputMethod() { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 121 | return mInputMethod.get(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 124 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 125 | public void executeMessage(Message msg) { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 126 | InputMethod inputMethod = mInputMethod.get(); |
| 127 | // Need a valid reference to the inputMethod for everything except a dump. |
| 128 | if (inputMethod == null && msg.what != DO_DUMP) { |
| 129 | Log.w(TAG, "Input method reference was null, ignoring message: " + msg.what); |
| 130 | return; |
| 131 | } |
| 132 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 133 | switch (msg.what) { |
| 134 | case DO_DUMP: { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 135 | AbstractInputMethodService target = mTarget.get(); |
| 136 | if (target == null) { |
| 137 | return; |
| 138 | } |
Svetoslav Ganov | 758143e | 2012-08-06 16:40:27 -0700 | [diff] [blame] | 139 | SomeArgs args = (SomeArgs)msg.obj; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 140 | try { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 141 | target.dump((FileDescriptor)args.arg1, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 142 | (PrintWriter)args.arg2, (String[])args.arg3); |
| 143 | } catch (RuntimeException e) { |
| 144 | ((PrintWriter)args.arg2).println("Exception: " + e); |
| 145 | } |
| 146 | synchronized (args.arg4) { |
| 147 | ((CountDownLatch)args.arg4).countDown(); |
| 148 | } |
Svetoslav Ganov | 758143e | 2012-08-06 16:40:27 -0700 | [diff] [blame] | 149 | args.recycle(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 150 | return; |
| 151 | } |
| 152 | |
| 153 | case DO_ATTACH_TOKEN: { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 154 | inputMethod.attachToken((IBinder)msg.obj); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | return; |
| 156 | } |
| 157 | case DO_SET_INPUT_CONTEXT: { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 158 | inputMethod.bindInput((InputBinding)msg.obj); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 159 | return; |
| 160 | } |
| 161 | case DO_UNSET_INPUT_CONTEXT: |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 162 | inputMethod.unbindInput(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 163 | return; |
| 164 | case DO_START_INPUT: { |
Svetoslav Ganov | 758143e | 2012-08-06 16:40:27 -0700 | [diff] [blame] | 165 | SomeArgs args = (SomeArgs)msg.obj; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 166 | IInputContext inputContext = (IInputContext)args.arg1; |
| 167 | InputConnection ic = inputContext != null |
| 168 | ? new InputConnectionWrapper(inputContext) : null; |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 169 | EditorInfo info = (EditorInfo)args.arg2; |
| 170 | info.makeCompatible(mTargetSdkVersion); |
| 171 | inputMethod.startInput(ic, info); |
Svetoslav Ganov | 758143e | 2012-08-06 16:40:27 -0700 | [diff] [blame] | 172 | args.recycle(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 173 | return; |
| 174 | } |
| 175 | case DO_RESTART_INPUT: { |
Svetoslav Ganov | 758143e | 2012-08-06 16:40:27 -0700 | [diff] [blame] | 176 | SomeArgs args = (SomeArgs)msg.obj; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 177 | IInputContext inputContext = (IInputContext)args.arg1; |
| 178 | InputConnection ic = inputContext != null |
| 179 | ? new InputConnectionWrapper(inputContext) : null; |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 180 | EditorInfo info = (EditorInfo)args.arg2; |
| 181 | info.makeCompatible(mTargetSdkVersion); |
| 182 | inputMethod.restartInput(ic, info); |
Svetoslav Ganov | 758143e | 2012-08-06 16:40:27 -0700 | [diff] [blame] | 183 | args.recycle(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 184 | return; |
| 185 | } |
| 186 | case DO_CREATE_SESSION: { |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 187 | SomeArgs args = (SomeArgs)msg.obj; |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 188 | inputMethod.createSession(new InputMethodSessionCallbackWrapper( |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 189 | mCaller.mContext, (InputChannel)args.arg1, |
| 190 | (IInputSessionCallback)args.arg2)); |
| 191 | args.recycle(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 192 | return; |
| 193 | } |
| 194 | case DO_SET_SESSION_ENABLED: |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 195 | inputMethod.setSessionEnabled((InputMethodSession)msg.obj, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 196 | msg.arg1 != 0); |
| 197 | return; |
| 198 | case DO_REVOKE_SESSION: |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 199 | inputMethod.revokeSession((InputMethodSession)msg.obj); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 200 | return; |
| 201 | case DO_SHOW_SOFT_INPUT: |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 202 | inputMethod.showSoftInput(msg.arg1, (ResultReceiver)msg.obj); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 203 | return; |
| 204 | case DO_HIDE_SOFT_INPUT: |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 205 | inputMethod.hideSoftInput(msg.arg1, (ResultReceiver)msg.obj); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 206 | return; |
satok | ab751aa | 2010-09-14 19:17:36 +0900 | [diff] [blame] | 207 | case DO_CHANGE_INPUTMETHOD_SUBTYPE: |
| 208 | inputMethod.changeInputMethodSubtype((InputMethodSubtype)msg.obj); |
| 209 | return; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 210 | } |
| 211 | Log.w(TAG, "Unhandled message code: " + msg.what); |
| 212 | } |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 213 | |
| 214 | @Override |
| 215 | protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) { |
Devin Taylor | 0c33ed2 | 2010-02-23 13:26:46 -0600 | [diff] [blame] | 216 | AbstractInputMethodService target = mTarget.get(); |
| 217 | if (target == null) { |
| 218 | return; |
| 219 | } |
| 220 | if (target.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | != PackageManager.PERMISSION_GRANTED) { |
| 222 | |
| 223 | fout.println("Permission Denial: can't dump InputMethodManager from from pid=" |
| 224 | + Binder.getCallingPid() |
| 225 | + ", uid=" + Binder.getCallingUid()); |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | CountDownLatch latch = new CountDownLatch(1); |
| 230 | mCaller.executeOrSendMessage(mCaller.obtainMessageOOOO(DO_DUMP, |
| 231 | fd, fout, args, latch)); |
| 232 | try { |
| 233 | if (!latch.await(5, TimeUnit.SECONDS)) { |
| 234 | fout.println("Timeout waiting for dump"); |
| 235 | } |
| 236 | } catch (InterruptedException e) { |
| 237 | fout.println("Interrupted waiting for dump"); |
| 238 | } |
| 239 | } |
| 240 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 241 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 242 | public void attachToken(IBinder token) { |
| 243 | mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_ATTACH_TOKEN, token)); |
| 244 | } |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 245 | |
| 246 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 247 | public void bindInput(InputBinding binding) { |
| 248 | InputConnection ic = new InputConnectionWrapper( |
| 249 | IInputContext.Stub.asInterface(binding.getConnectionToken())); |
| 250 | InputBinding nu = new InputBinding(ic, binding); |
| 251 | mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu)); |
| 252 | } |
| 253 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 254 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 255 | public void unbindInput() { |
| 256 | mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_UNSET_INPUT_CONTEXT)); |
| 257 | } |
| 258 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 259 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 260 | public void startInput(IInputContext inputContext, EditorInfo attribute) { |
| 261 | mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_START_INPUT, |
| 262 | inputContext, attribute)); |
| 263 | } |
| 264 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 265 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | public void restartInput(IInputContext inputContext, EditorInfo attribute) { |
| 267 | mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_RESTART_INPUT, |
| 268 | inputContext, attribute)); |
| 269 | } |
| 270 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 271 | @Override |
| 272 | public void createSession(InputChannel channel, IInputSessionCallback callback) { |
| 273 | mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_CREATE_SESSION, |
| 274 | channel, callback)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 275 | } |
| 276 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 277 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 278 | public void setSessionEnabled(IInputMethodSession session, boolean enabled) { |
| 279 | try { |
| 280 | InputMethodSession ls = ((IInputMethodSessionWrapper) |
| 281 | session).getInternalInputMethodSession(); |
| 282 | mCaller.executeOrSendMessage(mCaller.obtainMessageIO( |
| 283 | DO_SET_SESSION_ENABLED, enabled ? 1 : 0, ls)); |
| 284 | } catch (ClassCastException e) { |
| 285 | Log.w(TAG, "Incoming session not of correct type: " + session, e); |
| 286 | } |
| 287 | } |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 288 | |
| 289 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 290 | public void revokeSession(IInputMethodSession session) { |
| 291 | try { |
| 292 | InputMethodSession ls = ((IInputMethodSessionWrapper) |
| 293 | session).getInternalInputMethodSession(); |
| 294 | mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_REVOKE_SESSION, ls)); |
| 295 | } catch (ClassCastException e) { |
| 296 | Log.w(TAG, "Incoming session not of correct type: " + session, e); |
| 297 | } |
| 298 | } |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 299 | |
| 300 | @Override |
The Android Open Source Project | 4df2423 | 2009-03-05 14:34:35 -0800 | [diff] [blame] | 301 | public void showSoftInput(int flags, ResultReceiver resultReceiver) { |
| 302 | mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_SHOW_SOFT_INPUT, |
| 303 | flags, resultReceiver)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 304 | } |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 305 | |
| 306 | @Override |
The Android Open Source Project | 4df2423 | 2009-03-05 14:34:35 -0800 | [diff] [blame] | 307 | public void hideSoftInput(int flags, ResultReceiver resultReceiver) { |
| 308 | mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_HIDE_SOFT_INPUT, |
| 309 | flags, resultReceiver)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 310 | } |
satok | ab751aa | 2010-09-14 19:17:36 +0900 | [diff] [blame] | 311 | |
Jeff Brown | c28867a | 2013-03-26 15:42:39 -0700 | [diff] [blame] | 312 | @Override |
satok | ab751aa | 2010-09-14 19:17:36 +0900 | [diff] [blame] | 313 | public void changeInputMethodSubtype(InputMethodSubtype subtype) { |
| 314 | mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CHANGE_INPUTMETHOD_SUBTYPE, |
| 315 | subtype)); |
| 316 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 317 | } |