Пример #1
0
  @Override
  protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    AbstractInputMethodService target = mTarget.get();
    if (target == null) {
      return;
    }
    if (target.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
        != PackageManager.PERMISSION_GRANTED) {

      fout.println(
          "Permission Denial: can't dump InputMethodManager from from pid="
              + Binder.getCallingPid()
              + ", uid="
              + Binder.getCallingUid());
      return;
    }

    CountDownLatch latch = new CountDownLatch(1);
    mCaller.executeOrSendMessage(mCaller.obtainMessageOOOO(DO_DUMP, fd, fout, args, latch));
    try {
      if (!latch.await(5, TimeUnit.SECONDS)) {
        fout.println("Timeout waiting for dump");
      }
    } catch (InterruptedException e) {
      fout.println("Interrupted waiting for dump");
    }
  }
Пример #2
0
 @Override
 public void dispatchAppVisibility(boolean visible) {
   // We don't do this in preview mode; we'll let the preview
   // activity tell us when to run.
   if (!mIWallpaperEngine.mIsPreview) {
     Message msg = mCaller.obtainMessageI(MSG_VISIBILITY_CHANGED, visible ? 1 : 0);
     mCaller.sendMessage(msg);
   }
 }
Пример #3
0
 public void revokeSession(IInputMethodSession session) {
   try {
     InputMethodSession ls =
         ((IInputMethodSessionWrapper) session).getInternalInputMethodSession();
     mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_REVOKE_SESSION, ls));
   } catch (ClassCastException e) {
     Log.w(TAG, "Incoming session not of correct type: " + session, e);
   }
 }
Пример #4
0
 public void setSessionEnabled(IInputMethodSession session, boolean enabled) {
   try {
     InputMethodSession ls =
         ((IInputMethodSessionWrapper) session).getInternalInputMethodSession();
     mCaller.executeOrSendMessage(
         mCaller.obtainMessageIO(DO_SET_SESSION_ENABLED, enabled ? 1 : 0, ls));
   } catch (ClassCastException e) {
     Log.w(TAG, "Incoming session not of correct type: " + session, e);
   }
 }
Пример #5
0
 @Override
 public void resized(
     Rect frame,
     Rect contentInsets,
     Rect visibleInsets,
     boolean reportDraw,
     Configuration newConfig) {
   Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED, reportDraw ? 1 : 0);
   mCaller.sendMessage(msg);
 }
Пример #6
0
  public void createPrintJob(PrintJobInfo printJob) {
    synchronized (mLock) {
      addPrintJobLocked(printJob);
      setPrintJobState(printJob.getId(), PrintJobInfo.STATE_CREATED, null);

      Message message =
          mHandlerCaller.obtainMessageO(
              HandlerCallerCallback.MSG_ON_PRINT_JOB_STATE_CHANGED, printJob);
      mHandlerCaller.executeOrSendMessage(message);
    }
  }
Пример #7
0
 private void dispatchPointer(MotionEvent event) {
   if (event.isTouchEvent()) {
     synchronized (mLock) {
       if (event.getAction() == MotionEvent.ACTION_MOVE) {
         mPendingMove = event;
       } else {
         mPendingMove = null;
       }
     }
     Message msg = mCaller.obtainMessageO(MSG_TOUCH_EVENT, event);
     mCaller.sendMessage(msg);
   } else {
     event.recycle();
   }
 }
 @Override
 public IVoiceInteractorRequest startCommand(
     String callingPackage,
     IVoiceInteractorCallback callback,
     String command,
     Bundle extras) {
   Request request = newRequest(callback);
   mHandlerCaller.sendMessage(
       mHandlerCaller.obtainMessageOOOO(
           MSG_START_COMMAND,
           new Caller(callingPackage, Binder.getCallingUid()),
           request,
           command,
           extras));
   return request.mInterface;
 }
 @Override
 public IVoiceInteractorRequest startConfirmation(
     String callingPackage,
     IVoiceInteractorCallback callback,
     CharSequence prompt,
     Bundle extras) {
   Request request = newRequest(callback);
   mHandlerCaller.sendMessage(
       mHandlerCaller.obtainMessageOOOO(
           MSG_START_CONFIRMATION,
           new Caller(callingPackage, Binder.getCallingUid()),
           request,
           prompt,
           extras));
   return request.mInterface;
 }
 @Override
 public IVoiceInteractorRequest startAbortVoice(
     String callingPackage,
     IVoiceInteractorCallback callback,
     CharSequence message,
     Bundle extras) {
   Request request = newRequest(callback);
   mHandlerCaller.sendMessage(
       mHandlerCaller.obtainMessageOOOO(
           MSG_START_ABORT_VOICE,
           new Caller(callingPackage, Binder.getCallingUid()),
           request,
           message,
           extras));
   return request.mInterface;
 }
 @Override
 public boolean[] supportsCommands(String callingPackage, String[] commands) {
   Message msg =
       mHandlerCaller.obtainMessageIOO(
           MSG_SUPPORTS_COMMANDS,
           0,
           new Caller(callingPackage, Binder.getCallingUid()),
           commands);
   SomeArgs args = mHandlerCaller.sendMessageAndWait(msg);
   if (args != null) {
     boolean[] res = (boolean[]) args.arg1;
     args.recycle();
     return res;
   }
   return new boolean[commands.length];
 }
Пример #12
0
 @Override
 public void dispatchWallpaperCommand(
     String action, int x, int y, int z, Bundle extras, boolean sync) {
   synchronized (mLock) {
     if (DEBUG) Log.v(TAG, "Dispatch wallpaper command: " + x + ", " + y);
     WallpaperCommand cmd = new WallpaperCommand();
     cmd.action = action;
     cmd.x = x;
     cmd.y = y;
     cmd.z = z;
     cmd.extras = extras;
     cmd.sync = sync;
     Message msg = mCaller.obtainMessage(MSG_WALLPAPER_COMMAND);
     msg.obj = cmd;
     mCaller.sendMessage(msg);
   }
 }
Пример #13
0
  public void setPrintJobCancelling(PrintJobId printJobId, boolean cancelling) {
    synchronized (mLock) {
      PrintJobInfo printJob = getPrintJobInfo(printJobId, PrintManager.APP_ID_ANY);
      if (printJob != null) {
        printJob.setCancelling(cancelling);
        if (shouldPersistPrintJob(printJob)) {
          mPersistanceManager.writeStateLocked();
        }
        mNotificationController.onUpdateNotifications(mPrintJobs);

        Message message =
            mHandlerCaller.obtainMessageO(
                HandlerCallerCallback.MSG_ON_PRINT_JOB_STATE_CHANGED, printJob);
        mHandlerCaller.executeOrSendMessage(message);
      }
    }
  }
Пример #14
0
 @Override
 public void dispatchWallpaperOffsets(
     float x, float y, float xStep, float yStep, boolean sync) {
   synchronized (mLock) {
     if (DEBUG) Log.v(TAG, "Dispatch wallpaper offsets: " + x + ", " + y);
     mPendingXOffset = x;
     mPendingYOffset = y;
     mPendingXOffsetStep = xStep;
     mPendingYOffsetStep = yStep;
     if (sync) {
       mPendingSync = true;
     }
     if (!mOffsetMessageEnqueued) {
       mOffsetMessageEnqueued = true;
       Message msg = mCaller.obtainMessage(MSG_WALLPAPER_OFFSETS);
       mCaller.sendMessage(msg);
     }
   }
 }
Пример #15
0
    IWallpaperEngineWrapper(
        WallpaperService context,
        IWallpaperConnection conn,
        IBinder windowToken,
        int windowType,
        boolean isPreview,
        int reqWidth,
        int reqHeight) {
      if (DEBUG && mCallbackLooper != null) {
        mCallbackLooper.setMessageLogging(new LogPrinter(Log.VERBOSE, TAG));
      }
      mCaller =
          new HandlerCaller(
              context, mCallbackLooper != null ? mCallbackLooper : context.getMainLooper(), this);
      mConnection = conn;
      mWindowToken = windowToken;
      mWindowType = windowType;
      mIsPreview = isPreview;
      mReqWidth = reqWidth;
      mReqHeight = reqHeight;

      Message msg = mCaller.obtainMessage(DO_ATTACH);
      mCaller.sendMessage(msg);
    }
Пример #16
0
 public void unbindInput() {
   mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_UNSET_INPUT_CONTEXT));
 }
Пример #17
0
 public void bindInput(InputBinding binding) {
   InputConnection ic =
       new InputConnectionWrapper(IInputContext.Stub.asInterface(binding.getConnectionToken()));
   InputBinding nu = new InputBinding(ic, binding);
   mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu));
 }
Пример #18
0
 public void attachToken(IBinder token) {
   mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_ATTACH_TOKEN, token));
 }
Пример #19
0
 public void destroy() {
   Message msg = mCaller.obtainMessage(DO_DETACH);
   mCaller.sendMessage(msg);
 }
Пример #20
0
 @Override
 public void onRelayoutContainer() {
   Message msg = mCaller.obtainMessage(MSG_UPDATE_SURFACE);
   mCaller.sendMessage(msg);
 }
 @Override
 public void destroy() {
   mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_DESTROY));
 }
Пример #22
0
 @Override
 public void moved(int newX, int newY) {
   Message msg = mCaller.obtainMessageII(MSG_WINDOW_MOVED, newX, newY);
   mCaller.sendMessage(msg);
 }
Пример #23
0
 public void restartInput(IInputContext inputContext, EditorInfo attribute) {
   mCaller.executeOrSendMessage(
       mCaller.obtainMessageOO(DO_RESTART_INPUT, inputContext, attribute));
 }
Пример #24
0
 public void hideSoftInput(int flags, ResultReceiver resultReceiver) {
   mCaller.executeOrSendMessage(
       mCaller.obtainMessageIO(DO_HIDE_SOFT_INPUT, flags, resultReceiver));
 }
Пример #25
0
 public void createSession(IInputMethodCallback callback) {
   mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CREATE_SESSION, callback));
 }
 @Override
 public void taskFinished(Intent intent, int taskId) {
   mHandlerCaller.sendMessage(
       mHandlerCaller.obtainMessageIO(MSG_TASK_FINISHED, taskId, intent));
 }
 @Override
 public void closeSystemDialogs() {
   mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_CLOSE_SYSTEM_DIALOGS));
 }
Пример #28
0
 @Override
 public void onUpdateSurface() {
   Message msg = mCaller.obtainMessage(MSG_UPDATE_SURFACE);
   mCaller.sendMessage(msg);
 }
Пример #29
0
 public void changeInputMethodSubtype(InputMethodSubtype subtype) {
   mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CHANGE_INPUTMETHOD_SUBTYPE, subtype));
 }
 @Override
 public void taskStarted(Intent intent, int taskId) {
   mHandlerCaller.sendMessage(
       mHandlerCaller.obtainMessageIO(MSG_TASK_STARTED, taskId, intent));
 }