Repository navigation
feat: Add getEnabledAccessibilityServices to AccessibilityInfo (Android) - #57864
ecryptoguru wants to merge 2 commits into
Conversation
Add a new `AccessibilityInfo.getEnabledAccessibilityServices()` method that returns the list of currently enabled accessibility service IDs on Android, using `AccessibilityManager.getEnabledAccessibilityServiceList()`. This addresses the need to query which accessibility services a user has enabled, allowing apps to tailor their UI accordingly (e.g., disabling video autoplay when a screen reader service is active). Changes: - Add `getEnabledAccessibilityServices(feedbackTypeFlags?)` to the JS AccessibilityInfo API (returns Promise<Array<string>>) - Implement native Android module method in AccessibilityInfoModule.kt - Add optional method to NativeAccessibilityInfo Flow spec - Update TypeScript definitions (.d.ts) and generated ReactNativeApi.d.ts - Update Jest mock and add comprehensive unit tests - Add typetest coverage Closes react#30862 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Hi @ecryptoguru! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
Summary:
An Android app can ask whether a screen reader is running, but that doesn’t tell it which accessibility services are enabled. This PR adds
AccessibilityInfo.getEnabledAccessibilityServices(feedbackTypeFlags?). It returns the service IDs reported by Android’sAccessibilityManager. Omitting the argument requests all feedback types; passing a mask filters the list.On iOS the promise resolves to
[]. On Android it rejects if the native method is unavailable. The change includes the Flow and TypeScript declarations, the generated API snapshot, and the Jest mock.Closes #30862. PR #59234 also addresses this issue; this version includes the optional feedback mask.
Changelog:
[ANDROID] [ADDED] - Apps can call
AccessibilityInfo.getEnabledAccessibilityServices()to list enabled Android accessibility service IDs, optionally filtered by feedback type.Test Plan:
AccessibilityInfo-test.jsJest suite onb33ed0ec: 42 tests passed. The four new cases cover the Android service IDs, passing a feedback mask to native, rejection when the native method is missing, and the empty array on iOS.yarn build-types --validate,yarn test-typescript-legacy, andyarn test-generated-typescriptpassed. ESLint passed on all four changed JavaScript files.b33ed0ecand ran it on Android 17 (API 37) with TalkBack 17.0. With TalkBack enabled, both the no-argument call andFEEDBACK_SPOKENreturned its service ID. After disabling TalkBack and relaunching, both returned[]. Fixture and device logs.Implementation prepared with Devin. Codex assisted with verification and the PR description.