Exemplo n.º 1
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);
   }
 }
Exemplo n.º 2
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);
    }
  }
Exemplo n.º 3
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();
   }
 }
Exemplo n.º 4
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);
      }
    }
  }
Exemplo n.º 5
0
 public void changeInputMethodSubtype(InputMethodSubtype subtype) {
   mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CHANGE_INPUTMETHOD_SUBTYPE, subtype));
 }
Exemplo n.º 6
0
 public void createSession(IInputMethodCallback callback) {
   mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CREATE_SESSION, callback));
 }
Exemplo n.º 7
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));
 }
Exemplo n.º 8
0
 public void attachToken(IBinder token) {
   mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_ATTACH_TOKEN, token));
 }
 public void onAccessibilityEvent(AccessibilityEvent event) {
   Message message = mCaller.obtainMessageO(DO_ON_ACCESSIBILITY_EVENT, event);
   mCaller.sendMessage(message);
 }
 public void setConnection(IAccessibilityServiceConnection connection) {
   Message message = mCaller.obtainMessageO(DO_SET_SET_CONNECTION, connection);
   mCaller.sendMessage(message);
 }
Exemplo n.º 11
0
  public boolean setPrintJobState(PrintJobId printJobId, int state, String error) {
    boolean success = false;

    synchronized (mLock) {
      PrintJobInfo printJob = getPrintJobInfo(printJobId, PrintManager.APP_ID_ANY);
      if (printJob != null) {
        final int oldState = printJob.getState();
        if (oldState == state) {
          return false;
        }

        success = true;

        printJob.setState(state);
        printJob.setStateReason(error);
        printJob.setCancelling(false);

        if (DEBUG_PRINT_JOB_LIFECYCLE) {
          Slog.i(LOG_TAG, "[STATE CHANGED] " + printJob);
        }

        switch (state) {
          case PrintJobInfo.STATE_COMPLETED:
          case PrintJobInfo.STATE_CANCELED:
            mPrintJobs.remove(printJob);
            removePrintJobFileLocked(printJob.getId());
            // $fall-through$

          case PrintJobInfo.STATE_FAILED:
            {
              PrinterId printerId = printJob.getPrinterId();
              if (printerId != null) {
                ComponentName service = printerId.getServiceName();
                if (!hasActivePrintJobsForServiceLocked(service)) {
                  sendOnAllPrintJobsForServiceHandled(service);
                }
              }
            }
            break;

          case PrintJobInfo.STATE_QUEUED:
            {
              sendOnPrintJobQueued(new PrintJobInfo(printJob));
            }
            break;
        }

        if (shouldPersistPrintJob(printJob)) {
          mPersistanceManager.writeStateLocked();
        }

        if (!hasActivePrintJobsLocked()) {
          notifyOnAllPrintJobsHandled();
        }

        Message message =
            mHandlerCaller.obtainMessageO(
                HandlerCallerCallback.MSG_ON_PRINT_JOB_STATE_CHANGED, printJob);
        mHandlerCaller.executeOrSendMessage(message);

        mNotificationController.onUpdateNotifications(mPrintJobs);
      }
    }

    return success;
  }
Exemplo n.º 12
0
 private void sendOnAllPrintJobsForServiceHandled(ComponentName service) {
   Message message =
       mHandlerCaller.obtainMessageO(
           HandlerCallerCallback.MSG_ON_ALL_PRINT_JOBS_FOR_SERIVICE_HANDLED, service);
   mHandlerCaller.executeOrSendMessage(message);
 }
Exemplo n.º 13
0
 private void sendOnPrintJobQueued(PrintJobInfo printJob) {
   Message message =
       mHandlerCaller.obtainMessageO(HandlerCallerCallback.MSG_ON_PRINT_JOB_QUEUED, printJob);
   mHandlerCaller.executeOrSendMessage(message);
 }