源码位置:frameworks/base/core/java/android/os/ServiceManager.java

addService方法

188     @UnsupportedAppUsage
189     public static void addService(String name, IBinder service, boolean allowIsolated,
190             int dumpPriority) {
191         try {
192             getIServiceManager().addService(name, service, allowIsolated, dumpPriority);
193         } catch (RemoteException e) {
194             Log.e(TAG, "error in addService", e);
195         }
196     }

→getIServiceManager()

104     @UnsupportedAppUsage
105     private static IServiceManager getIServiceManager() {
106         if (sServiceManager != null) {
107             return sServiceManager;
108         }
109 
110         // Find the service manager
111         sServiceManager = ServiceManagerNative
112                 .asInterface(Binder.allowBlocking(BinderInternal.getContextObject()));
113         return sServiceManager;
114     }

依赖的源码见:


0 条评论

发表回复

您的电子邮箱地址不会被公开。