Whenever possible (i.e. any API != 28), we'll now detect the end of a frame by spying on main thread messages and running code right when the main thread message is done running and before a new main thread message starts running, by leveraging Looper.getMainLooper().setMessageLogging { }. We're also detecting whether we're in a frame or not by looking at the name of the runnable, rather than by creating a stacktrace.
Non backward compatible API changes
Renamed MainThreadMessageSpy.startTracing() and MainThreadMessageSpy.stopTracing() to MainThreadMessageSpy.addTracer() and MainThreadMessageSpy.removeTracer().
New APIs
MainThreadMessageSpy.startSpyingMainThreadDispatching() and MainThreadMessageSpy.stopSpyingMainThreadDispatching(), MainThreadMessageSpy.currentMessageAsString, MainThreadMessageSpy.enabled and MainThreadMessageSpy.onCurrentMessageFinished()
MainThreadMessageScopedLazy (prop by mainThreadMessageScopedLazy {}) property for main thread scoped lazy properties that get cleared at the end of each main thread message.
Choreographers.postOnFrameRendered(), Choreographers.postOnWindowFrameRendered() and Choreographers.isInChoreographerFrame
InputEventTrigger.rendered, InputEventTrigger.renderedUptime and InputEventTrigger.onInputEventFrameRendered
Behavior changes
Whenever possible (i.e. any API != 28), we'll now detect the end of a frame by spying on main thread messages and running code right when the main thread message is done running and before a new main thread message starts running, by leveraging
Looper.getMainLooper().setMessageLogging { }
. We're also detecting whether we're in a frame or not by looking at the name of the runnable, rather than by creating a stacktrace.Non backward compatible API changes
MainThreadMessageSpy.startTracing()
andMainThreadMessageSpy.stopTracing()
toMainThreadMessageSpy.addTracer()
andMainThreadMessageSpy.removeTracer()
.New APIs
MainThreadMessageSpy.startSpyingMainThreadDispatching()
andMainThreadMessageSpy.stopSpyingMainThreadDispatching()
,MainThreadMessageSpy.currentMessageAsString
,MainThreadMessageSpy.enabled
andMainThreadMessageSpy.onCurrentMessageFinished()
MainThreadMessageScopedLazy
(prop by mainThreadMessageScopedLazy {}
) property for main thread scoped lazy properties that get cleared at the end of each main thread message.Choreographers.postOnFrameRendered()
,Choreographers.postOnWindowFrameRendered()
andChoreographers.isInChoreographerFrame
InputEventTrigger.rendered
,InputEventTrigger.renderedUptime
andInputEventTrigger.onInputEventFrameRendered