当前位置:网站首页>Getiservicemanager () source code analysis

Getiservicemanager () source code analysis

2020-11-10 08:34:00 Tianwang gaidihu 626

From the source , The return is ServiceManagerProxy Object instances

private static IServiceManager getIServiceManager() {
        if (sServiceManager != null) {
            return sServiceManager;
        }

        // Find the service manager
       
sServiceManager = ServiceManagerNative
                .asInterface(Binder.allowBlocking(BinderInternal.getContextObject()));

        return sServiceManager;
    }

static public IServiceManager asInterface(IBinder obj)
    {
        if (obj == null) {
            return null;
        }
        IServiceManager in =
            (IServiceManager)obj.queryLocalInterface(descriptor);
        if (in != null) {
            return in;
        }
        return new ServiceManagerProxy(obj);
    }

 

版权声明
本文为[Tianwang gaidihu 626]所创,转载请带上原文链接,感谢