源码位置:frameworks/base/core/java/com/android/internal/os/RuntimeInit.java
commonInit方法
192 @UnsupportedAppUsage
193 protected static final void commonInit() {
194 if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!");
195
196 /*
197 * set handlers; these apply to all threads in the VM. Apps can replace
198 * the default handler, but not the pre handler.
199 */
200 LoggingHandler loggingHandler = new LoggingHandler();
201 RuntimeHooks.setUncaughtExceptionPreHandler(loggingHandler);
202 Thread.setDefaultUncaughtExceptionHandler(new KillApplicationHandler(loggingHandler));
}
applicationInit方法
357 final Arguments args = new Arguments(argv);
358
359 // The end of of the RuntimeInit event (see #zygoteInit).
360 Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
361
362 // Remaining arguments are passed to the start class's static main
363 return findStaticMain(args.startClass, args.startArgs, classLoader);
→findStaticMain
利用反射找到SystemServer的main方法,并通过Runnable封装返回。
0 条评论