在Android中ProcessState是客户端和服务端公共的部分,作为Binder通信的基础,ProcessState是一个singleton类,每个 进程只有一个对象,这个对象负责打开Binder驱动,建立线程池,让其进程里面的所有线程都能通过Binder通信。 与之相关的是IPCThreadState,每个线程都有一个IPCThreadState实例登记在Linux线程的上下文附属数据中,主要负责 Binder的读取,写入和请求处理框架。IPCThreadState在构造的时候获取进程的ProcessState并记录在自己的成员变量 mProcess中,通过mProcess可以获得B.
IPCThreadState::self()->getCallingPid()
原创 2024-04-19 12:17:07
33阅读
 Step 15. talkWithDriver         这个函数定义在frameworks/base/libs/binder/IPCThreadState.cpp文件中: status_t IPCThreadState::talkWithDriver(bool doReceive)  
原创 2011-09-09 01:02:30
1128阅读
StartThreadPool和joinThreadPool分析:startThreadPool()的实现如下所示:上面spawnpooledThread()函数的实现如下所示: PoolThread是在IPCThreadState中定义的一个Thread子类,它的实现如下所示:下面看看IPCThreadState的joinThreadPool的实现,因为新创建的线程也会调用这个函数,具体代码如下
前面一节我们分析了Binder通信相关的两个重要类:ProcessState 和 IPCThreadState。ProcessState负责打开Binder 驱动,每个进程只有一个。而 IPCThreadState负责提供与Binder通信相关的接口,每个线程有一个。下面我们通过具体 示例MediaPlayerService来分析我们应用程序中怎么通过Binder通信的。frameworks/ba
转载 2023-12-21 10:44:58
94阅读
前面一节我们分析了Binder通信相关的两个重要类:ProcessState 和 IPCThreadState。ProcessState负责打开Binder 驱动,每个进程只有一个。而 IPCThreadState负责提供与Binder通信相关的接口,每个线程有一个。下面我们通过具体 示例MediaPlayerService来分析我们应用程序中怎么通过Binder通信的。 frameworks/base/media/mediaserver/main_mediaserver.cppint main(int argc, char*argv[]){ sp proc(ProcessState)::s.
转载 2013-08-07 19:08:00
154阅读
一、源码分析 (1) clearCallingIdentity方法,最终调用如下: int64_t IPCThreadState::clearCallingIdentity() { int64_t token = ((int64_t)mCallingUid<<32) | mCallingPid; clearCaller(); return token
转载 2023-08-31 16:34:37
13阅读
一、源码分析(1)clearCallingIdentity方法,最终调用如下:int64_t IPCThreadState::clearCallingIdentity() { int64_t token = ((int64_t)mCallingUid<<32) | mCallingPid; clearCaller(); return token; } void
转载 7月前
38阅读
android IPC通信中的UID和PID识别   IPCThreadState对象维护了2个变量            pid_t          &nb
 作者:Gityuan 一、源码分析(1)clearCallingIdentity方法,最终调用如下:int64_t IPCThreadState::clearCallingIdentity() { int64_t token = ((int64_t)mCallingUid<<32) | mCallingPid; clearCaller(); retu
转载 2024-08-18 14:34:38
19阅读
这个函数虽然很长,但是主要调用了talkWithDriver函数来与Binder驱动程序进行交互:   status_t IPCThreadState::talkWithDriver(bool doReceive)  {      LOG_ASSERT(mProcess->mDriverFD&nbs
原创 2011-07-25 02:43:00
6505阅读
 基于Android 6.0源码剖析,分析Binder线程池以及binder线程启动过程。frameworks/base/cmds/app_process/app_main.cpp frameworks/native/libs/binder/ProcessState.cpp framework/native/libs/binder/IPCThreadState.cpp kernel/dr
转载 2024-05-21 08:17:05
59阅读
文章大纲引言一、Binder线程池的启动1、ProcessState#startThreadPool函数来启动线程池2、IPCThreadState#joinThreadPool 将当前线程进入到线程池中去等待和处理IPC请求二、Service 代理对象的获取1、获取Service Manager 代理对象BpServiceManager2、调用BpServiceManager#getServi
一、Binder 类的结构图        在C++层次,就能看到各种关于Binder博客中经常反复肯定会被提到的BpBinder类和BBinder了,这两个类都继承于IBinder。当然还有IInterface,BpInterface,BnInterface,BpRefBase,ProcessState ,IPCThreadState 。 1 I
转载 2023-07-10 00:41:40
98阅读
PCThreadState对象维护了2个变量            pid_t               mCallingPid;            uid_t               mCallingUid;    从变量名称来看,这2个变量保存了进程的PID和UID,并且由于这两个变量由IPCThreadState对象维护,可见它们是与IPC相关的。具体它们保
转载 2021-08-13 10:44:31
460阅读
Binder驱动Binder 驱动是整个Binder框架的核心,这部分就会详细介绍消息协议、内存共享机制、对象传递的具体细节了应用层和驱动的消息协议Binder应用层的IPCThreadState和Binder驱动之间通过ioctl来传递数据
原创 2022-04-18 16:48:00
241阅读
以下几篇文章是较深入分析binder机制。 目录1.Android - Binder机制 - ServiceManager2.Android - Binder机制 - 普通service注册3.Android - Binder机制 - 获得普通service4.Android - Binder机制 - client和普通service交互5.Android - Binder机制 - Binder框架总结6.Android - Binder机制 - ProcessState和IPCThreadState7.Android - Binder机制 - 驱动 Android - Binder机制 -. Read More
转载 2013-05-08 20:02:00
107阅读
2评论
以下几篇文章是较深入分析binder机制。 目录1.Android - Binder机制 - ServiceManager2.Android - Binder机制 - 普通service注册3.Android - Binder机制 - 获得普通service4.Android - Binder机制 - client和普通service交互5.Android - Binder机制 - Binder框架总结6.Android - Binder机制 - ProcessState和IPCThreadState7.Android - Binder机制 - 驱动 Android - Binder机制 -. Read More
转载 2013-05-08 19:58:00
404阅读
2评论
全文参考网址:http://light3moon.com/1986/12/20/%E6%96%87%E7%AB%A0%E7%B4%A2%E5%BC%95/1、  Binder通信模型通信流程图:各个步骤流程:1)  service 运行,阻塞于 ioctl,等待 client 发起请求service 进程运行起来,然后通过调用 IPCThreadState 的 joinThre
转载 2024-05-04 16:51:00
95阅读
Binder驱动Binder 驱动是整个Binder框架的核心,这部分就会详细介绍消息协议、内存共享机制、对象传递的具体细节了应用层和驱动的消息协议Binder应用层的IPCThreadState和Binder驱动之间通过ioctl来传递数据,因此,定义了一些ioctl命令:命令说明数据格式BIDNER_WRITE_READ向驱动读取和写入数据,既可以单独读
原创 2021-09-24 14:02:28
266阅读
  • 1
  • 2