WEB开发网
开发学院手机开发Android 开发 Android IPC 通讯机制源码分析 阅读

Android IPC 通讯机制源码分析

 2010-05-29 05:27:00 来源:WEB开发网   
核心提示:0);//将调用if (error < NO_ERROR) reply.setError(error);//CameraService的onTransact函数} else {const status_t error = the_context_object->transact(tr.code, buffe
0);//将调用

if (error < NO_ERROR) reply.setError(error);//CameraService的onTransact函数

} else {

const status_t error = the_context_object->transact(tr.code, buffer, &reply, 0);

if (error < NO_ERROR) reply.setError(error);

}

//LOGI("<<<< TRANSACT from pid %d restore pid %d uid %d ",

// mCallingPid, origPid, origUid);

if ((tr.flags & TF_ONE_WAY) == 0) {

LOG_ONEWAY("Sending reply to %d!", mCallingPid);

sendReply(reply, 0);

} else {

LOG_ONEWAY("NOT sending reply to %d!", mCallingPid);

}

mCallingPid = origPid;

mCallingUid = origUid;

IF_LOG_TRANSACTIONS() {

TextOutput::Bundle _b(alog);

alog << "BC_REPLY thr " << (void*)pthread_self() << " / obj "

<< tr.target.ptr << ": " << indent << reply << dedent << endl;

}

..................................

}

break;

}

..................................

if ((tr.flags & TF_ONE_WAY) == 0) {

LOG_ONEWAY("Sending reply to %d!", mCallingPid);

sendReply(reply, 0); //通过binder kernel返回数据到caller进程这个过程大家

} else { //参照前面的叙述自己分析一下

LOG_ONEWAY("NOT sending reply to %d!", mCallingPid);

}

if (result != NO_ERROR) {

mLastError = result;

}

return result;

}

调用CameraService BBinder对象中的transact函数:

status_t BBinder::transact(

uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)

{

.....................

switch (code) {

case PING_TRANSACTION:

reply->writeInt32(pingBinder());

break;

上一页  10 11 12 13 14 15 16 17 18  下一页

Tags:Android IPC 通讯

编辑录入:coldstar [复制链接] [打 印]
赞助商链接