Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a06ea9df authored by Steve Elliott's avatar Steve Elliott
Browse files

Asynchronous notif pipeline evaluation

This CL introduces NotifPipelineChoreographer, which can be used to
"schedule" listener invocations at a later time.

In effect, this replaces the following code:

   foo.addListener { expensive() }
   bar.addListener { expensive() }

With:

   val choreographer: NotifPipelineChoreographer = ...
   choreographer.addOnEvalListener { expensive() }
   foo.addListener { choreographer.schedule() }
   bar.addListener { choreographer.schedule() }

This will coalesce the calls to expensive(), which will be evaluated at
some point in the future when the NotifPipelineChoreographer invokes its
registered OnEvalListeners.

The implementation included is based on android.view.Choreographer,
which will perform a scheduled evaluation at most once per frame, in
conjunction with a 100ms timeout to force evaluation.

The NotifPipelineChoreographer is used to coalesce all evaluations of
ShadeListBuilder.buildList, which includes all Pluggable invalidations
and new emissions from the NotifCollection.

Test: atest, perfetto + unlock phone (transition from keyguard) and
verify ShadeListBuilder.buildList is invoked at most once per frame

Fixes: 217800329

Change-Id: I4be70b495bdda5a32a202a92b9b28f2cff3402c9
parent 135c992b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment