{"id":13980,"date":"2024-07-12T13:48:17","date_gmt":"2024-07-12T05:48:17","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=13980"},"modified":"2024-07-13T09:32:11","modified_gmt":"2024-07-13T01:32:11","slug":"runtimeinit-java%e6%ba%90%e7%a0%81%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=13980","title":{"rendered":"RuntimeInit.java\u6e90\u7801\u89e3\u6790"},"content":{"rendered":"<p>\u6e90\u7801\u4f4d\u7f6e\uff1a<code>frameworks\/base\/core\/java\/com\/android\/internal\/os\/RuntimeInit.java<\/code><\/p>\n<h2>commonInit\u65b9\u6cd5<\/h2>\n<pre><code class=\"language-java\">192     @UnsupportedAppUsage\n193     protected static final void commonInit() {\n194         if (DEBUG) Slog.d(TAG, &quot;Entered RuntimeInit!&quot;);\n195 \n196         \/*\n197          * set handlers; these apply to all threads in the VM. Apps can replace\n198          * the default handler, but not the pre handler.\n199          *\/\n200         LoggingHandler loggingHandler = new LoggingHandler();\n201         RuntimeHooks.setUncaughtExceptionPreHandler(loggingHandler);\n202         Thread.setDefaultUncaughtExceptionHandler(new KillApplicationHandler(loggingHandler));\n}<\/code><\/pre>\n<h2>applicationInit\u65b9\u6cd5<\/h2>\n<pre><code class=\"language-java\">357         final Arguments args = new Arguments(argv);\n358 \n359         \/\/ The end of of the RuntimeInit event (see #zygoteInit).\n360         Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);\n361 \n362         \/\/ Remaining arguments are passed to the start class&#039;s static main\n363         return findStaticMain(args.startClass, args.startArgs, classLoader);<\/code><\/pre>\n<h3>\u2192findStaticMain<\/h3>\n<p>\u5229\u7528\u53cd\u5c04\u627e\u5230SystemServer\u7684main\u65b9\u6cd5\uff0c\u5e76\u901a\u8fc7Runnable\u5c01\u88c5\u8fd4\u56de\u3002<\/p>\n<button class=\"simplefavorite-button\" data-postid=\"13980\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>\u6e90\u7801\u4f4d\u7f6e\uff1aframeworks\/base\/core\/java\/com\/android\/interna [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1047],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/13980"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13980"}],"version-history":[{"count":4,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/13980\/revisions"}],"predecessor-version":[{"id":14003,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/13980\/revisions\/14003"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13980"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}