一.Activity的系统架构
从第一讲的Activity启动流程中我们知道,系统层级是通过Context来调用startActivity,最终实现是在AMS中。而系统进程通过zygote的fork&run 出的ActivityThread来接受从AMS中发出来的消息并处理。
Activity的架构如下:
1.ActivityThread
main()函数是ActivityThread的入口;
public static void main(String[] args) {
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "ActivityThreadMain");
// Install selective syscall interception
AndroidOs.install();
// CloseGuard defaults to true and can be quite spammy. We
// disable it here, but selectively enable it later (via
// StrictMode) on debug builds, but using DropBox, not logs.
CloseGuard.setEnabled(false);
Environment.initForCurrentUser();
// Make sure TrustedCertificateStore looks in the right place for CA certificates
final File configDir = Environment.getUserConfigDirectory(UserHandle.</