defaultServiceManager()返回的是C++层的IServiceManager对象

获取IServiceManager对象的目的是为了和ServiceManager进程进行通信

如:Server要通过IServiceManager对象发送请求指令注册到ServiceManager进程中,Client要通过IServiceManager对象发送请求来获取Server对象

ServiceManager进程是一个守护进程

 

对于一个server而言,它都会存在一个“远程BpBinder对象”和“本地BBinder对象”

远程BpBinder对象的作用是和Binder驱动进行交互,具体的方式是:当Server要向Binder发起事物请求时,会调用BpBinder的transact()接口,而该接口会调用IPCThreadState::transact()接口,通过IPCThreadState类和Binder驱动交互,并且BpBinder在Binder驱动中的Binder引用描述会被保存到ProcessState类的mHandleToObject矢量缓冲数组中。

本地BBinder是Server响应Client请求的类,当Client有请求发送给Server时,都会调用到BBinder的onTransact()函数,而每个Server都会覆盖onTransact()函数,这样,每个Server就可以在onTransact()中根据自己的情况来对请求进行处理。

相关文章:

  • 2022-12-23
  • 2021-08-14
  • 2021-08-24
  • 2021-05-30
  • 2021-05-27
  • 2021-10-29
  • 2021-08-13
猜你喜欢
  • 2022-01-03
  • 2021-11-15
  • 2021-06-15
  • 2022-12-23
  • 2021-07-28
  • 2021-07-03
相关资源
相似解决方案