Home | History | Annotate | Download | only in server

Lines Matching defs:Service

66  * This class is instantiated by the system as a system level service and can be
67 * accessed only by the system. The task of this service is to be a centralized
90 final List<Service> mServices = new ArrayList<Service>();
95 final Map<ComponentName, Service> mComponentNameToServiceMap =
96 new HashMap<ComponentName, Service>();
117 Service service = (Service) message.obj;
121 notifyEventListenerLocked(service, eventType);
122 AccessibilityEvent oldEvent = service.mPendingEvents.get(eventType);
123 service.mPendingEvents.remove(eventType);
307 Service service = mServices.get(i);
309 service.mServiceInterface.onInterrupt();
312 Slog.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
313 if (removeDeadServiceLocked(service)) {
319 + service.mService, re);
332 Service service = (Service) arguments.arg2;
335 service.mEventTypes = info.eventTypes;
336 service.mFeedbackType = info.feedbackType;
339 service.mPackageNames.addAll(Arrays.asList(packageNames));
341 service.mNotificationTimeout = info.notificationTimeout;
342 service.mIsDefault = (info.flags & AccessibilityServiceInfo.DEFAULT) != 0;
366 * and denotes the period after the last event before notifying the service.
375 Service service = mServices.get(i);
377 if (service.mIsDefault == isDefault) {
378 if (canDispathEventLocked(service, event, mHandledFeedbackTypes)) {
379 mHandledFeedbackTypes |= service.mFeedbackType;
380 notifyAccessibilityServiceDelayedLocked(service, event);
394 * and denotes the period after the last event before notifying the service.
396 * @param service The service.
399 private void notifyAccessibilityServiceDelayedLocked(Service service,
403 AccessibilityEvent oldEvent = service.mPendingEvents.get(eventType);
404 service.mPendingEvents.put(eventType, event);
406 int what = eventType | (service.mId << 16);
412 Message message = mHandler.obtainMessage(what, service);
414 mHandler.sendMessageDelayed(message, service.mNotificationTimeout);
420 * not notified service is interested in the event.
429 List<Service> services = mServices;
431 // linear in the number of service which is not large
433 Service service = services.get(i);
434 if (service.mPendingEvents.get(eventType) == event) {
442 * Notifies a service
444 * @param service The service.
447 private void notifyEventListenerLocked(Service service, int eventType) {
448 IEventListener listener = service.mServiceInterface;
449 AccessibilityEvent event = service.mPendingEvents.get(eventType);
458 Slog.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
460 removeDeadServiceLocked(service);
463 Slog.e(LOG_TAG, "Error during sending " + event + " to " + service.mService, re);
469 * Removes a dead service.
471 * @param service The service.
472 * @return True if the service was removed, false otherwise.
474 private boolean removeDeadServiceLocked(Service service) {
475 mServices.remove(service);
476 mHandler.removeMessages(service.mId);
479 Slog.i(LOG_TAG, "Dead service " + service.mService + " removed");
491 * Determines if given event can be dispatched to a service based on the package of the
493 * service is notified if it is interested in events from the package and no other service
498 * @param service The potential receiver.
503 private boolean canDispathEventLocked(Service service, AccessibilityEvent event,
506 if (!service.isConfigured()) {
510 if (!service.mService.isBinderAlive()) {
511 removeDeadServiceLocked(service);
516 if ((service.mEventTypes & eventType) != eventType) {
520 Set<String> packageNames = service.mPackageNames;
524 int feedbackType = service.mFeedbackType;
546 List<Service> services = mServices;
549 Service service = services.get(i);
551 service.unbind();
552 mComponentNameToServiceMap.remove(service.mComponentName);
586 * Updates the state of each service by starting (or keeping running) enabled ones and
595 Map<ComponentName, Service> componentNameToServiceMap = mComponentNameToServiceMap;
596 List<Service> services = mServices;
603 Service service = componentNameToServiceMap.get(componentName);
606 if (service == null) {
607 new Service(componentName).bind();
610 if (service != null) {
611 service.unbind();
613 services.remove(service);
635 * This class represents an accessibility service. It stores all per service
636 * data required for the service management, provides API for starting/stopping the
637 * service and is responsible for adding/removing the service in the data structures
638 * for service management. The class also exposes configuration interface that is
639 * passed to the service it represents as soon it is bound. It also serves as the
640 * connection for the service.
642 class Service extends IAccessibilityServiceConnection.Stub implements ServiceConnection {
665 // the events pending events to be dispatched to this service
669 Service(ComponentName componentName) {
680 * Binds to the accessibility service.
689 * Unbinds form the accessibility service and removes it from the data
690 * structures for service management.
699 * Returns if the service is configured i.e. at least event types of interest
702 * @return True if the service is configured, false otherwise.
712 public void onServiceConnected(ComponentName componentName, IBinder service) {
713 mService = service;
714 mServiceInterface = IEventListener.Stub.asInterface(service);
725 Slog.w(LOG_TAG, "Error while setting Controller for service: " + service, re);
731 Service service = mComponentNameToServiceMap.remove(componentName);
732 mServices.remove(service);