aidl原理解析

来源:互联网 发布:分区表丢失数据恢复 编辑:程序博客网 时间:2024/06/13 10:37

写一个aidl

aidl就会想到Binder机制,想到CS通信。
定义接口
ITest{

int saySomething(String content);

}

aidl原理
对于客户端,本身持有服务的代理,不会真正去实现,也就是客户端如果说话,不会自己做,而是持有的代理去做这件事

class Proxy implements ITest{
Binder mRemote;
public Proxy(IBinder mRemote){
this.mRemote=mRemote;
}
//传输数据
void transact(){

}

}

对于服务端

class Stub extends Binder implements ITest{

 void onTransact()

}