square / papa

PAPA: Performance of Android Production Applications
Apache License 2.0
351 stars 15 forks source link

Switch to window based commits #55

Open pyricau opened 1 year ago

pyricau commented 1 year ago

https://developer.android.com/reference/android/view/ViewTreeObserver#registerFrameCommitCallback(java.lang.Runnable)

We can reimplement this pre API 29 by using a draw (or pre draw) listener then posting at front. JankStats likely does this.

The sticking point is, you need a window. But maybe we should just grab all windows and go with the timestamp for the first one.

We can also get smarter when we have a touch event, as we'll know which window the touch event is associated with and could check the UI for that touch event. Of course that might prove tricky if the touch is to close a window and we send the update event from the below window long after it's gone.

pyricau commented 1 year ago

We can already switch to that for app launch though.