This Handler class should be static or leaks might occur: IncomingHandler

If IncomingHandler class is not static, it will have a reference to your Service object. Handler objects for the same thread all share a common Looper object, which they post messages to and read from. As messages contain target Handler, as long as there are messages with target handler in the message queue, the handler … Read more

Handler as a method parameter

From dispatchGesture doc, callback AccessibilityService.GestureResultCallback: The object to call back when the status of the gesture is known. If null, no status is reported. handler Handler: The handler on which to call back the callback object. If null, the object is called back on the service’s main thread. That basically means, if you don’t provide … Read more