当前位置:网站首页>What does the mremote variable in servicemanagerproxy refer to?

What does the mremote variable in servicemanagerproxy refer to?

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

First, the code marked in red Binder.allowBlocking(BinderInternal.getContextObject()), What's actually back is BinderProxy Object instances

 sServiceManager = ServiceManagerNative
                .asInterface(Binder.allowBlocking(BinderInternal.getContextObject()));

  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);
    }

Then continue to ServiceManagerProxy, From below , Obviously .

class ServiceManagerProxy implements IServiceManager {
     public ServiceManagerProxy(IBinder remote) {
       
mRemote = remote;
    }

    ...

    ...

}

}

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