I’m trying to understand what happens when a button is clicked in android. So I set up a couple of break points for a simple button click. The picture shows what happens when a button is clicked my questions are: (GUI generated events are events that are generated as a result of interaction with the gui for example Button Clicks, editing text etc…)
1- Is Looper.loop() the main loop for the application or the OS looper ?
2- Where does ViewRootImpl(handler).dispatchMessage(Message) reside? Application or OS?
3- Can I intercept GUI generated events in the main looper ? if yes then how?
4- Can we safely assume that all GUI generated events are handled in ViewRootImpl(handler).handleCallback(Message)?

I don’t know what you think the “OS looper” is. The
Looperruns in your process, if that’s what you mean.I don’t know what you think the “OS” is in this context.
ViewRootImplis a Dalvik-compiled class that is loaded into your Dalvik VM and its code executes within your process. Otherwise, you would not be able to see it in your stack trace.Only by modifying the firmware to replace various classes like
ViewRootImplwith your own code.I certainly would not make that assumption. For example, not all applications use the widget framework (e.g., games).