Android AccessibilityManager Support#31
Merged
Merged
Conversation
m1maker
approved these changes
Apr 25, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously we only support AndroidTextToSpeech, which meant that native screen readers (namely TalkBack) could not take advantage of messages sent by SRAL. While AndroidTextToSpeech does respect some configurations from TalkBack (such as speech rate), this should allow any service or device that connects to AccessibilityManager to hook into the messages from SRAL.
Like the AndroidTextToSpeech support, this PR necessitates a java bridge to connect to AccessibilityManager. There is also a
AndroidAccessibilityManager.cppto expose the meta details and methods (this is mostly identical toAndroidTextToSpeech.cpp).Important
This uses the event type TYPE_ANNOUNCEMENT which is marked as "Deprecated in API level 36". This is the most semantically generic event, which makes it good for this library. I'm open to changing this if there is a good generic alternative, but I think using a semantic (but incorrect) type might be worse, as that could be misleading and behave in unexpected ways. I think, since this works on modern Android devices, this should be fine, and if/when support for this event is removed, we can re-evaluate just changing the type.
As part of this PR, we are changing the bit values of SRAL engines, prioritizing
SRAL_ENGINE_ANDROID_ACCESSIBILITY_MANAGERoverSRAL_ENGINE_ANDROID_TEXT_TO_SPEECH(which mimics the ordering of other engines).Like the PR for AndroidTextToSpeech, I tested this locally on a physical Android device. The code for that is beyond the scope here, but I'm happy to share any details / recordings / etc if that would be valuable.