ComposeA11yScanner
Top-level public API for the Compose Accessibility Scanner.
install attaches a transparent overlay to a ComponentActivity that renders the scan summary bar, issue detail panel, and highlight boxes over flagged nodes. The overlay is removed automatically when the activity is destroyed, so explicit uninstall calls are only needed if the scanner should stop before destroy.
All three methods throw IllegalStateException in non-debug builds (i.e., when ApplicationInfo.FLAG_DEBUGGABLE is absent from the running APK). This is the correct runtime check for library code; BuildConfig.DEBUG in a library module does not reflect the consuming app's build type.
Usage:
// Activity.onCreate — after setContent { … }
ComposeA11yScanner.install(this)
// Anywhere:
lifecycleScope.launch {
ComposeA11yScanner.scan().collect { state -> /* react to ScannerState */}
}Functions
Attaches the accessibility scanner overlay to activity.
Returns a Flow of ScannerState for the most recently installed activity.
Starts a scan for the most recently installed activity and returns the shared state flow.
Removes the scanner overlay from activity and cancels the internal coroutine scope.