{"id":14112,"date":"2024-07-30T09:37:54","date_gmt":"2024-07-30T01:37:54","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=14112"},"modified":"2024-08-22T16:57:42","modified_gmt":"2024-08-22T08:57:42","slug":"servicemanager-java","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=14112","title":{"rendered":"ServiceManager.java"},"content":{"rendered":"<p>\u6e90\u7801\u4f4d\u7f6e\uff1a<code>frameworks\/base\/core\/java\/android\/os\/ServiceManager.java<\/code><\/p>\n<h2>addService\u65b9\u6cd5<\/h2>\n<pre><code class=\"language-java\">188     @UnsupportedAppUsage\n189     public static void addService(String name, IBinder service, boolean allowIsolated,\n190             int dumpPriority) {\n191         try {\n192             getIServiceManager().addService(name, service, allowIsolated, dumpPriority);\n193         } catch (RemoteException e) {\n194             Log.e(TAG, &quot;error in addService&quot;, e);\n195         }\n196     }<\/code><\/pre>\n<p>\u2192getIServiceManager()<\/p>\n<pre><code class=\"language-java\">104     @UnsupportedAppUsage\n105     private static IServiceManager getIServiceManager() {\n106         if (sServiceManager != null) {\n107             return sServiceManager;\n108         }\n109 \n110         \/\/ Find the service manager\n111         sServiceManager = ServiceManagerNative\n112                 .asInterface(Binder.allowBlocking(BinderInternal.getContextObject()));\n113         return sServiceManager;\n114     }<\/code><\/pre>\n<p>\u4f9d\u8d56\u7684\u6e90\u7801\u89c1\uff1a<\/p>\n<ul>\n<li>\n<p>ServiceManagerNative.java<br \/>\n<a href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14423\">http:\/\/xinyiworld.top\/wordpress_it\/?p=14423<\/a><\/p>\n<\/li>\n<li>\n<p>Binder.java<br \/>\n<a href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14431\">http:\/\/xinyiworld.top\/wordpress_it\/?p=14431<\/a><\/p>\n<\/li>\n<li>\n<p>BinderInternal.java<br \/>\n<a href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14425\">http:\/\/xinyiworld.top\/wordpress_it\/?p=14425<\/a><\/p>\n<\/li>\n<\/ul>\n<button class=\"simplefavorite-button\" data-postid=\"14112\" 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\/android\/os\/ServiceM [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1086],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/14112"}],"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=14112"}],"version-history":[{"count":6,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/14112\/revisions"}],"predecessor-version":[{"id":14437,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/14112\/revisions\/14437"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14112"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}