开发学院手机开发Android 开发 帐滓Android的BinderProxy和Binder?? 阅读

帐滓Android的BinderProxy和Binder??

 2010-05-31 14:28:00 来源:WEB开发网   
核心提示:flags)throws RemoteException;此Native函??作於: Native函?定柳於Android 框架的/jni/android_util_binder.cpp?案彦static struct binderproxy_offsets_t{// Class state.jclass mClass
flags)

throws RemoteException;

此Native函??作於:

---- Native函?定柳於Android 框架的/jni/android_util_binder.cpp?案彦

static struct binderproxy_offsets_t

{

// Class state.

jclass mClass;

jmethodID mConstructor;

jmethodID mSendDeathNotice;

// Object state.

jfieldID mObject;

jfieldID mSelf;

} gBinderProxyOffsets;

在呃gBinderProxyOffsets.mObject彦,放的是BpBinder。

static jboolean android_os_BinderProxy_transact(JNIEnv* env, jobject obj,

jint code, jobject dataObj,

jobject replyObj, jint flags)

{

if (dataObj == NULL) {

jniThrowException(env, "java/lang/NullPointerException", NULL);

return JNI_FALSE;

}

Parcel* data = parcelForJavaObject(env, dataObj);

if (data == NULL) {

return JNI_FALSE;

}

Parcel* reply = parcelForJavaObject(env, replyObj);

if (reply == NULL && replyObj != NULL) {

return JNI_FALSE;

}

IBinder* target = (IBinder*)

env->GetIntField(obj, gBinderProxyOffsets.mObject);

if (target == NULL) {

jniThrowException(env, "java/lang/IllegalStateException", "Binder has been finalized!");

return JNI_FALSE;

}

LOGV("Java code calling transact on %p in Java object %p with code %d ",

target, obj, code);

//printf("Transact from Java code to %p sending: ", target); data->print();

status_t err = target->transact(code, *data, reply, flags);

//if (reply) printf("Transact from Java code to %p received: ", target); reply->print();

if (err == NO_ERROR) {

return JNI_TRUE;

} else if (err == UNKNOWN_TRANSACTION) {

return JNI_FALSE;

上一页  1 2 3 4 5 6  下一页

Tags:Android BinderProxy Binder

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接