A11yScannerController
Public SDK entry point for running accessibility scans.
Typical usage:
val controller = A11yScannerController(
nodeProvider = { A11yNodeExtractor().extract(semanticsOwner) },
screenDensity = resources.displayMetrics.density,
)
.configure(ScannerConfig(enabledRules = ScannerRules.allRuleIds().toSet()))
.withRules(MyCustomRule())
lifecycleScope.launch {
controller.startScan().collect { state -> /* update UI */}
}
// ...
controller.stopScan()
// ...
controller.destroy() // cancel the internal scope when the host is destroyedContent copied to clipboard
Parameters
nodeProvider
Called once per startScan invocation to produce the node list. Must be safe to call on Dispatchers.Default.
screenDensity
DisplayMetrics.density, forwarded to density-dependent rules.
Functions
Link copied to clipboard
Stops any active scan and emits ScannerState.Idle.
Link copied to clipboard
Replaces the active scanner configuration.
Link copied to clipboard
Cancels any in-progress scan, then starts a new one.
Link copied to clipboard
Appends rules to the set that will run alongside the standard rule set. Custom rules are automatically added to ScannerConfig.enabledRules so the engine never filters them out. Returns this controller for chaining.