帐滓Android的BinderProxy和Binder??
2010-05-31 14:28:00 来源:WEB开发网** 有了BinderProxy物件,myActivity彦就能呼叫BinderProxy的IBinder::transact()函?,咄而呼叫到myBinder的IBinder::onTransact()函?。也可藉由ibinderForJavaObject()可取得?物件相??的BpBinder物件。
**** 以下是?考儋料 ****
**** 是?Android框架原始程式瘁彦面摘?出?的,
提供斤您?考。
---- BinderProxy??是定柳於Android 框架的/java/Binder.java?案彦
final class BinderProxy implements IBinder {
public native boolean pingBinder();
public native boolean isBinderAlive();
public IInterface queryLocalInterface(String descriptor) {
return null;
}
public native String getInterfaceDescriptor() throws RemoteException;
public native boolean transact(int code, Parcel data, Parcel reply,
int flags) throws RemoteException;
public native void linkToDeath(DeathRecipient recipient, int flags)
throws RemoteException;
public native boolean unlinkToDeath(DeathRecipient recipient, int flags);
BinderProxy() {
mSelf = new WeakReference(this);
}
@Override
protected void finalize() throws Throwable {
try {
destroy();
} finally {
super.finalize();
}
}
private native final void destroy();
private static final void sendDeathNotice(DeathRecipient recipient) {
if (Config.LOGV) Log.v("JavaBinder", "sendDeathNotice to " + recipient);
try {
recipient.binderDied();
}
catch (RuntimeException exc) {
Log.w("BinderNative", "Uncaught exception from death notification",
exc);
}
}
final private WeakReference mSelf;
private int mObject;
}
其中,最重要的Native函?是:
public native boolean transact(int code, Parcel data, Parcel reply, int
Tags:Android BinderProxy Binder
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接