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.
Scanner calls are allowed by default in debuggable builds and denied by default in non-debuggable builds. toggleScanner explicitly overrides either default: false disables the scanner in every build, while true enables it in every build. Checking ApplicationInfo.FLAG_DEBUGGABLE is correct for library code because a library module's BuildConfig.DEBUG 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.
Installs the scanner with an explicit key for single-host Compose navigation. Return the current route, pane, or other stable destination identifier from the provider.
Invalidates the current result and schedules a scan for the latest destination.
Returns scanner state for the latest resumed automatic activity, or the latest surviving manual installation when automatic routing has no active entry.
Overrides the default scanner availability for every build.
Starts a scan for the selected automatic or manual installation and returns its state flow.
Removes the scanner overlay from activity and cancels the internal coroutine scope.