Relative Content

Tag Archive for android-jetpack-composeaccessibilityservicetalkbackaccessibility-api

AccessibilityService onAccessibilityEvent() not received for Compose View for clicked type

I have created my own accessibility service where I want to record events like app open and clicked for selected apps. This is working fine for xml views but for Compose views I don’t get AccessibilityEvent.TYPE_VIEW_CLICKED event in onAccessibilityEvent(). Whenever Compose button is clicked I do get AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGE. And if look at the node hierarchy I see a ComposeView which might be representing the Button but it has isClickable as false.
Another observation is whenever I try this with TalkBack accessibility. I get clicked event for the Compose button in my onAccessibilityEvent() and this time isClickable is true.
My compose views have all the required content description set up. But to be sure I also tried this with JetNews app from google’s code samples here. It gave the same result i.e. no click events.