Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: System Property Detection Detect State change #30863

Closed
amarlette opened this issue Feb 3, 2021 · 8 comments
Closed

Android: System Property Detection Detect State change #30863

amarlette opened this issue Feb 3, 2021 · 8 comments
Labels
Accessibility Team - Evaluated Accessibility Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Platform: Android Android applications. React Native Engineering - Evaluated Resolution: Locked This issue was locked by the bot.

Comments

@amarlette
Copy link

amarlette commented Feb 3, 2021

Requires API Proposal

This issue may require a new API, or a change to an existing API. An API proposal should be added and discussed before proceeding with implementation. The API proposal can be added in the comments of this issue or linked as a separate issue.

Description

Currently the AccessibilityInfo API can only detect "screenReaderChanged", and not other services. It would be nice to be able to detect other services such as Select to Speak, Switch Access, Voice Access, etc.

React Native version:

v0.63

Expected Behavior

The ability to detect a general change in the accessibility state of the system should be supported in the AccessibilityInfo API.

Android Details

The AccessibilityManager class has a general "accessibilityStateChange" listener, that is triggered when any accessibility service changes from active to inactive or vice-versa.
https://developer.android.com/reference/android/view/accessibility/AccessibilityManager#addAccessibilityStateChangeListener(android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener)

Note: The currently supported "screenReaderChanged" method maps to the TouchExplorationStateChangeListener.

@grgr-dkrk
Copy link
Contributor

I'd like to work on this issue.
I'll add the API proposal soon.

@amarlette
Copy link
Author

Thank you @grgr-dkrk!

@grgr-dkrk
Copy link
Contributor

I'm sorry for replying late.

I try to implement isAccessibilityStateEnabled, but it can cause name conflicts with the React Native property accessibilityState, which can be confusing to developers.
I'm thinking of using isAccessibilityServiceEnabled or isAccessibilityFeaturesEnabled instead of that name, but please let me know if there is a problem with this.

@blavalla
Copy link
Contributor

@grgr-dkrk , Good call out on the name! I think the name is isAccessibilityServiceEnabled fits the goal of this issue better than isAccessibilityFeatureEnabled.

I've also made a new issue to add some easier methods for some specific services that have both iOS and Android versions (SwitchAccess/SwitchControl, SelectToSpeak/SpeakScreen) here #31346. That might be a better issue to start on, as behind the scenes it will need to do much of the same work of querying the AccessibilityManager's service list, and using the AccessibilityStateChangeListener to detect when services become enabled/disabled, but will provide users with a simpler API.

I think there is still value to the API outlined in this issue, but it is Android-specific, and would only really be necessary for the edge case of services that wouldn't be covered by #31346. Let me know what you think!

@grgr-dkrk
Copy link
Contributor

@blavalla Thank you! I apologize for the late reply.
As you pointed out in #31346, I think it is necessary to implement this feature to listen for the state of the service.
On Android, I think the implementation of #31346 can be achieved by resolving both this Issue and #30862, how about it?

@grgr-dkrk
Copy link
Contributor

I would consider getting the status with isEnabled(), but it also includes the overlays used by many apps.
If there is no problem with this, I will implement it. Thanks.

@blavalla
Copy link
Contributor

I would consider getting the status with isEnabled(), but it also includes the overlays used by many apps.
If there is no problem with this, I will implement it. Thanks.

I think all three of these issues are definitely related as you said, but what the right API on the RN side is an open question.

I created #31346 because this would allow for an API that works on both iOS and Android and covers the most common use cases. I think that would be a good starting point for this space, and once it's implemented we may discover that #30862 is not really necessary for most users. If you have a specific use case in mind where you need to implement #30862 (detecting a non-Google, 3rd party service on Android for example), I'm happy to review the implementation. But I want to make sure that we also solve the more common case as well, which #31346 handles.

@grgr-dkrk
Copy link
Contributor

@blavalla I got it. Thanks!

@facebook facebook locked as resolved and limited conversation to collaborators Oct 30, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility Team - Evaluated Accessibility Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Platform: Android Android applications. React Native Engineering - Evaluated Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants