CategoryViewModel

AndroidViewModel that drives signal collection and exposes results as UiState.

Coordinates the CollectorRegistry under bounded concurrency/timeouts (CollectorRuntime), gates permissioned categories via PermissionCenter, observes LiveSignalCollector streams and serializes reports for export. All state mutations are applied on the main dispatcher.

Parameters

app

Application context backing collection and preferences.

See also

Constructors

Link copied to clipboard
constructor(app: Application)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val state: StateFlow<UiState>

Observable UI state consumed by the Compose layer.

Functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
fun enableAndRefresh(category: SignalCategory, granted: Boolean)

Refreshes a category after a permission decision, or marks it LoadState.Denied.

Link copied to clipboard
suspend fun exportReportJson(): String

Serializes the current signal snapshot into a pretty-printed ExportReport JSON string.

Link copied to clipboard
open fun <T : Application> getApplication(): T
Link copied to clipboard
Link copied to clipboard

Starts observing a live category's LiveSignalCollector stream, replacing any prior observation. No-op if the category has no live collector.

Link copied to clipboard

Collects a single category under a bounded timeout and publishes its result.

Link copied to clipboard

Collects all passive (no-permission) categories concurrently under the passive semaphore and publishes their results.

Link copied to clipboard

Cancels the current live-observation job, if any.