Multiple applications that view other applications using the accessibility service do not work simultaneously

I have two accessibility services in two different applications on the device. Each of them draws attention to other applications. I ran into the following problem: when 2 accessibility services are enabled, only one draw image, the other does not receive any events.

The configuration for the events is as follows:

@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 play it on the Android version prior to Lollipop, also on Android M. While on Android O and N, all services work fine.

Can someone please explain to me how this can happen, maybe there are some improvements starting with Android N? If there is a way to make them work at the same time, could you please provide me with an implementation of this?

+5
source share
1 answer

In fact, you simply cannot run two accessibility services at the same time. Pre Android N. It will always crash and create an obsolete / daemon service that runs in the background, preventing a service that crashed from restarting. It does not depend on how the service functions and what it does. In fact, even a fake UIAutomation service that works with Android Instrumentation tests will cause the service to fail. This restriction does not exist.

+2
source

Source: https://habr.com/ru/post/1273044/


All Articles