2011年Android Binder机制学习笔记之一

23 篇文章 0 订阅
12 篇文章 0 订阅

2011Android Binder机制学习笔记之一

一.Bn是什么缩写?

Binder Native

二.Bp是什么缩写?

Binder Proxy

三.Binder两个方面?

从应用程序的角度看Binder一共有两个方面:

Native 本地:例如BnABC,这是一个需要被继承和实现的类。

Proxy 代理:例如BpABC,这是一个在接口框架中被实现,但是在接口中没有体现的类。

客户端:例如客户端得到一个接口ABC,在调用的时候实际上被调用的是BpABC

四.Binder的驱动程序在哪个目录?

kernel/include/linux/binder.h

kernel/drivers/android/binder.c

五.Binder驱动是一个什么设备?

是一个miscdevice,主设备号为10

六.Binder设备节点,或者说文件路径是什么?

/dev/binder

七.Binder驱动程序在proc文件系统建立的信息,包含什么信息?

proc目录:调用Binder各个进程的内容

state文件:使用函数binder_read_proc_state

stats文件:使用函数binder_read_proc_stats

transactions文件:使用函数binder_read_proc_transactions

transaction_log文件:使用函数binder_read_proc_transaction_log,其参数为binder_transaction_log (类型为struct binder_transaction_log)

failed_transaction_log文件:使用函数binder_read_proc_transaction_log 其参数为

binder_transaction_log_failed (类型为struct binder_transaction_log)

八.Binderproc文件夹位置:

/proc/binder

九.BRBC的含义

BR_XXX等宏为BinderDriverReturnProtocol,表示Binder驱动返回协议。

BC_XXX等宏为BinderDriverCommandProtocol,表示Binder驱动命令协议。

十.binder_thread数据结构是怎么样的?

struct binder_thread {

      struct binder_proc *proc;

     struct rb_node rb_node;

     int pid;

     int looper;

     struct binder_transaction *transaction_stack;

     struct list_head todo;

     uint32_t return_error;

     uint32_t return_error2;

     wait_queue_head_t wait;

     struct binder_stats stats;

};

十一binder_write_read是怎么样的?

struct binder_write_read {

     signed long write_size;

     signed long write_consumed;

     unsigned long write_buffer;

     signed long read_size;

     signed long read_consumed;

     unsigned long read_buffer;

};

十二binder_thread 的各个成员信息是从哪里获得的?

rb_node

十三Servicemanager的作用

servicemanager是一个守护进程,用该进程和/dev/binder进行通讯。

十四servicemanager可执行程序的路径

/system/bin/servicemanager

十五BnInterfaceBpInterface是两个重要的模版在哪个文件中定义的

IInterface.h文件中

十六.BnInterfaceBpInterface是如何定义的?

BnInterface模版的定义如下所示:

template class BnInterface : public INTERFACE, public BBinder

{

public:

    virtual sp  queryLocalInterface(const String16& _descriptor);

    virtual String16        getInterfaceDescriptor() const;

protected:

    virtual IBinder*        onAsBinder();

};

 

BpInterface模版的定义如下所示

template class BpInterface : public INTERFACE, public BpRefBase

{

public:

                            BpInterface(const sp& remote);

protected:

    virtual IBinder*    onAsBinder();

};

十七IsericeManager相关的两个文件是什么

ISericeManager.h

ISericeManager.cpp

十八.ISericeManager是系统最先被启动的服务

十九.IserviceManager知识要点:

1ISericeManager本地功能并没有使现,

2.它实际上由ServiceManager守护进程执行,

3.用户程序通过调用BpServiceManager来获得其他的服务

二十.如何得到默认的或者缺省的ISericeManager

ISericeManager.h中定义了一个接口,用于得到默认的ISericeManager

sp_defaultServiceManager();此时得到的ISericeManager实际上是一个全局的ISericeManager

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

littletigerat

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值