I have two Accessibility services in two different apps on a device. Each of them draws some view over other apps. I faced with the following problem: when 2 Accessibility services are enabled, only one draws view, another one doesn't get any events.
Configuration for events is following:
@Override
protected void onServiceConnected() {
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
info.feedbackType = AccessibilityEvent.TYPES_ALL_MASK;
info.notificationTimeout = TIMEOUT_IN_MS;
setServiceInfo(info);
super.onServiceConnected();
}
I can reproduce it on pre-Lollipop Android version, also on Android M. Whilst on Android O and N, all services work fine.
Could somebody please explain to me how it can happen, maybe there are some improvements starting from Android N? If there is a way to make them work at the same time, could you please provide me an implementation of this?
You actually simply can't run two accessibility services at a time Pre Android N. One will always crash, and create a stale/daemon service that runs in the background, preventing you from restarting the service that crashed. This independent of how the service functions and what it does. In fact, even the fake UIAutomation service that runs with Android Instrumentation tests will cause a running service to crash. There is no way around this limitation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With