You can register and override "random events", which by now is a bit misleading term, as most of the current "random events" are things like auto-login, welcome screen handler, bank pin handler, auto-zoom adjustment etc.
A seperate thread is running, calling the "shouldActivate" method on every registered event