UiStateReadRecords

class UiStateReadRecords(config: UiStateReadRecords.Config, binderEventListener: UiStateReadRecords.BinderEventListener? = null) : BinderObserver

A BinderObserver responsible for tracking and recording state reads in binders.

The UiStateReadRecords keeps a live record of which state is read and by who. These records are exclusively those that are read during the UI phases (namely Mount and Draw). These records may be used to determine which binders or draw hosts need to be re-bound or invalidated respectively, when a state that they read is updated, which can help to significantly optimize execution in the respective phases.

Parameters

config

Supplies the read tracking status and current treeId to the observer.

Constructors

Link copied to clipboard
constructor(config: UiStateReadRecords.Config, binderEventListener: UiStateReadRecords.BinderEventListener? = null)

Types

Link copied to clipboard

Optional listener for binder lifecycle events. Allows external systems (e.g., observability) to observe shouldUpdate results and bind durations without subclassing UiStateReadRecords.

Link copied to clipboard
interface Config

Functions

Link copied to clipboard
fun getBindersToRebind(dirtyStates: Set<StateId>): ScatterSet<BinderId>
Link copied to clipboard
Link copied to clipboard
open override fun onDepsChanged(binderId: BinderId, changes: List<DepChange>)
Link copied to clipboard
open override fun onDepsNotCollected(binderId: BinderId)
Link copied to clipboard
open override fun onStateReadRebind(binderId: BinderId)
Link copied to clipboard
fun recordOnDraw(hostId: Long, description: String?, func: () -> Unit)
Link copied to clipboard
fun removeDrawScope(hostId: Long)