/** @hide */
  void dispatchTrackballEvent(
      Context context, int seq, MotionEvent motion, IInputMethodCallback callback) {
    synchronized (mH) {
      if (DEBUG) Log.d(TAG, "dispatchTrackballEvent");

      if (mCurMethod == null || mCurrentTextBoxAttribute == null) {
        try {
          callback.finishedEvent(seq, false);
        } catch (RemoteException e) {
        }
        return;
      }

      try {
        if (DEBUG) Log.v(TAG, "DISPATCH TRACKBALL: " + mCurMethod);
        mCurMethod.dispatchTrackballEvent(seq, motion, callback);
      } catch (RemoteException e) {
        Log.w(TAG, "IME died: " + mCurId + " dropping trackball: " + motion, e);
        try {
          callback.finishedEvent(seq, false);
        } catch (RemoteException ex) {
        }
      }
    }
  }
  /** @hide */
  public void dispatchKeyEvent(
      Context context, int seq, KeyEvent key, IInputMethodCallback callback) {
    synchronized (mH) {
      if (DEBUG) Log.d(TAG, "dispatchKeyEvent");

      if (mCurMethod == null) {
        try {
          callback.finishedEvent(seq, false);
        } catch (RemoteException e) {
        }
        return;
      }

      if (key.getAction() == KeyEvent.ACTION_DOWN && key.getKeyCode() == KeyEvent.KEYCODE_SYM) {
        showInputMethodPicker();
        try {
          callback.finishedEvent(seq, true);
        } catch (RemoteException e) {
        }
        return;
      }
      try {
        if (DEBUG) Log.v(TAG, "DISPATCH KEY: " + mCurMethod);
        mCurMethod.dispatchKeyEvent(seq, key, callback);
      } catch (RemoteException e) {
        Log.w(TAG, "IME died: " + mCurId + " dropping: " + key, e);
        try {
          callback.finishedEvent(seq, false);
        } catch (RemoteException ex) {
        }
      }
    }
  }