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 destroyedParameters
Called once per startScan invocation on the main dispatcher to produce the node list. It may suspend while rendered pixels are copied from the application window.
Optionally supplies specialized nodes for individual rules. Rules without an override continue to evaluate nodeProvider's accessibility tree.
DisplayMetrics.density, forwarded to density-dependent rules.
Constructors
Functions
Stops any active scan and emits ScannerState.Idle.
Replaces the active scanner configuration.
Cancels any in-progress scan, then starts a new one.
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.