Repository navigation
Conversation
|
Hi @126punith! 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: |
Hi! I've signed the CLA, so the bot should update the status shortly. Thanks for taking a look at this PR. I'm happy to make any changes or add more details if needed. |
|
Note on the API check: this change is purely additive. It adds a new Android-only method, |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
Fixes #30862.
AccessibilityInfo.isAccessibilityServiceEnabled()tells an app whether any accessibility service is on, but not which ones. Apps sometimes need that to adapt their behavior. For example, an app may want to avoid auto-playing video audio while TalkBack is reading the screen.This PR adds an Android-only method,
AccessibilityInfo.getEnabledAccessibilityServices(). It returns a promise that resolves to the IDs of the enabled accessibility services, such ascom.google.android.marvin.talkback/.TalkBackService, or an empty array when none are enabled.Changes
NativeAccessibilityInfo.js): adds an optionalgetEnabledAccessibilityServices(onSuccess)method, matching the shape ofisAccessibilityServiceEnabled.AccessibilityInfoModule.kt): implements the method withAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK)and returns each service'sidas aWritableArray. If the manager is unavailable, it returns an empty array.AccessibilityInfo.js): addsgetEnabledAccessibilityServices(): Promise<Array<string>>. The promise rejects on iOS, and when the native module or method is missing, using the same error-message pattern asisAccessibilityServiceEnabled().types_DEPRECATED/.../AccessibilityInfo.d.tsand regeneratesReactNativeApi.d.tswithyarn build-types.@react-native/jest-preset): addsgetEnabledAccessibilityServices, which resolves to[].getEnabledAccessibilityServices:entry toNativeAccessibilityInfoSpecin the fourReactApple*Cxx.apisnapshots.The API returns plain service ID strings rather than descriptor objects to keep the public surface small. Listing installed services is tracked separately in #30864.
Changelog:
[ANDROID] [ADDED] - Add
AccessibilityInfo.getEnabledAccessibilityServices()to list the IDs of enabled accessibility servicesTest Plan:
yarn test packages/react-native/Libraries/Components/AccessibilityInfo packages/jest-preset: 5 suites and 53 tests passed. New tests cover four cases: the native method is available, the native method is missing, the native module is null, and the call is made on iOS.yarn flow-check: 0 errors.yarn lint: passed.yarn format-check-kotlin, plus Prettier on the changed JS/TS files: passed.yarn build-types, thenyarn test-generated-typescript: passed../gradlew :packages:react-native:ReactAndroid:compileDebugKotlin: BUILD SUCCESSFUL. The generatedNativeAccessibilityInfoSpec.javaincludesgetEnabledAccessibilityServices(Callback).NativeAccessibilityInfoSpecline thatpython -m scripts.cxx-api.parsergenerates. My local Doxygen version (1.18.0) differs from the one CI uses (1.16.1) and produces unrelated diffs, so I did not commit the rest of its output.Example usage: