Add UI Automation Flag to Not Suppress Accessibility Services (Android) #2319
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.
Proposed Changes
This PR introduces a modification to the
MaestroDriverService.kt
file to add a UI automation flag that prevents the suppression of accessibility services during testing on Android devices. This change allows for more comprehensive testing scenarios where accessibility services need to remain active.Background
While Maestro supports both iOS and Android, this change specifically targets the Android implementation. By default, UiAutomation suppresses accessibility services on Android. However, in some testing scenarios, it's crucial to have these services running to accurately simulate real-world conditions or test accessibility features.
Implementation
The change is implemented in the
grpcServer()
function of theMaestroDriverService
class:This modification sets the UI automation flags to include
FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
using thesetUiAutomationFlags()
method of theConfigurator
instance.Usage
For more information about the
FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
flag and its usage, please refer to the Android Developer Documentation.Testing
After testing with my own app, I have confirmed that the Accessibility service will not be disabled when using a local Maestro build with the specified flag and setting
stopApp=false
underlaunchApp
.