Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save martinomburajr/549d881dbf0f1357cfb6beba66ae9cf3 to your computer and use it in GitHub Desktop.

Select an option

Save martinomburajr/549d881dbf0f1357cfb6beba66ae9cf3 to your computer and use it in GitHub Desktop.
The Activity Threads main method
/**
* Code retrieved from https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/ActivityThread.java
* Modifications are indicated in the comments
*/
public static void main(String[] args) {
//Modification - Removed unrelated initializers.
//Android initializes some tracers, event loggers, enviroment initializers, trusted certificates and updates the process' state
Looper.prepareMainLooper();
ActivityThread thread = new ActivityThread();
thread.attach(false);
if (sMainThreadHandler == null) {
sMainThreadHandler = thread.getHandler();
}
// More logging
// End of event ActivityThreadMain.
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
Looper.loop();
throw new RuntimeException("Main thread loop unexpectedly exited");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment