Hi,
I was trying to port the framework code to run on top of standard
JVM.
The native code and kernel module is also reused to support this.
I managed to get some of the components like Parcel workable. But
when
I perform the ParcelTest in cts.
A few test cases encounter weird null pointer reference exception.
For example,   in testWriteStrongInterface():
binder = (Binder) p.readStrongBinder();
This one statement fails to complete the cast with null pointer
exception.
The log for this test from android_util_Binder.cpp is as follows(I
added some logging print statement):
V/JavaBinder(28880): binder init...
V/JavaBinder(28880): Creating JavaBBinderHolder for Object 0xb6ca78dc
V/JavaBinder(28880): Java Binder 0xb6ca78dc: acquiring first ref on
holder 0x8f80b90
V/JavaBinder(28880): binder init...
V/JavaBinder(28880): Creating JavaBBinderHolder for Object 0xb6ca78dc
V/JavaBinder(28880): Java Binder 0xb6ca78dc: acquiring first ref on
holder 0x8f80b28
V/JavaBinder(28880): reading strong binder...
V/JavaBinder(28880): Creating JavaBBinder 0x8f80b58: env 0x8e80d20,
mVM 0xb71c3564, mObject 0x8ecbc80, object 0xb6ca78dc
V/JavaBinder(28880): Now have 0 binder ops
V/JavaBinder(28880): Creating JavaBinder 0x8f80b58 (refs 0x8f2a5b0)
for Object 0xb6ca78dc, weakCount=2
V/JavaBinder(28880): reading strong binder...
V/JavaBinder(28880): objectForBinder 0x8f80b58: it's our own
0x8ecbc80!
#
# A fatal error has been detected by the Java Runtime Environment:
#
...
The problem occurs inside javaObjectForIBinder() .
jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& val)
{
    if (val == NULL) return NULL;
    if (val->checkSubclass(&gBinderOffsets)) {
        // One of our own!
        jobject object = static_cast<JavaBBinder*>(val.get())-
>object();

        printf("objectForBinder %p: it's our own %p!\n", val.get(),
object);
        return object;
    }
    ..
}

The obtained jobject(0x8ecbc80) is still usable inside the native
code.
But somehow the returning object cannot be used in Java.
Is is related to some garbage collection logic that's unique to
Dalvik?
Thanks very much!
--
Ryan

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to