Hi freakingtux,
I'm building a native daemon that runs as root started by init.rc, that 
daemon should be accessed through an AIDL from Java applications (probably 
only system ones).

I've found your code really useful, I would like to know if the code in 
your git repository is running fine and if it is possible to run the daemon 
as root and still register to the ServiceManager using the method you 
provided, it would be great!

Thanks,
Francesco

Il giorno venerdì 23 settembre 2011 12:22:08 UTC+2, freakingtux ha scritto:
>
>
>
> On Tuesday, September 13, 2011 6:56:41 PM UTC+2, Nitin wrote:
>>
>>
>>
>> On Saturday, October 23, 2010, Dianne Hackborn <[email protected]> 
>> wrote:
>> > The Java runtime has wrappers around C++ IBinder.  This is what Java's 
>> Binder is.  You can write a JNI function that returns a Java Binder and in 
>> its implementation instantiate a C++ IBinder interface and return it.  You 
>> will need to use this magic function in libandroid_runtime to do this:
>> >
>> > extern jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& 
>> val);
>> >
>> I was able to do it this way, I wil post the link to github for reference.
>>
>> Nitin If you have more pointer please do tell me so. After cloning your
> repository some while ago and documenting the code I started hacking
> to get the code running on inside an apk and not running as system 
> service. This is not really portable but at least it is a start at 
> getting somewhere (I can ndk-build the code and ant install it).
>
> I don't understand how the javaObjectForIBinder approach should work. My 
> best guess at what was suggested is posted here
>
> https://github.com/keesj/Android-HelloWorldService/blob/pure_apk_hack/jni/main_helloworldservice.cpp#L125
>
> Basically I construct a Binder object (what might as well have been passed 
> to the native code) and try to
> replace the native binder. All kinds of alarm bells go of
>
> The code is called from here 
> https://github.com/keesj/Android-HelloWorldService/blob/pure_apk_hack/src/org/credil/helloworldservice/HelloWorldService.javaand
>  the binder is bound the process who created the binder this however is 
> the same process the Java code runnig. So what thread will listen to 
> binder? Should I not call android::ProcessState::self()->startThreadPool(); 
> or perhaps first fork or create a Java thread?
>
> any pointer or better patches to make this work are welcome!
>
> Greetings
>

Il giorno venerdì 23 settembre 2011 12:22:08 UTC+2, freakingtux ha scritto:
>
>
>
> On Tuesday, September 13, 2011 6:56:41 PM UTC+2, Nitin wrote:
>>
>>
>>
>> On Saturday, October 23, 2010, Dianne Hackborn <[email protected]> 
>> wrote:
>> > The Java runtime has wrappers around C++ IBinder.  This is what Java's 
>> Binder is.  You can write a JNI function that returns a Java Binder and in 
>> its implementation instantiate a C++ IBinder interface and return it.  You 
>> will need to use this magic function in libandroid_runtime to do this:
>> >
>> > extern jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& 
>> val);
>> >
>> I was able to do it this way, I wil post the link to github for reference.
>>
>> Nitin If you have more pointer please do tell me so. After cloning your
> repository some while ago and documenting the code I started hacking
> to get the code running on inside an apk and not running as system 
> service. This is not really portable but at least it is a start at 
> getting somewhere (I can ndk-build the code and ant install it).
>
> I don't understand how the javaObjectForIBinder approach should work. My 
> best guess at what was suggested is posted here
>
> https://github.com/keesj/Android-HelloWorldService/blob/pure_apk_hack/jni/main_helloworldservice.cpp#L125
>
> Basically I construct a Binder object (what might as well have been passed 
> to the native code) and try to
> replace the native binder. All kinds of alarm bells go of
>
> The code is called from here 
> https://github.com/keesj/Android-HelloWorldService/blob/pure_apk_hack/src/org/credil/helloworldservice/HelloWorldService.javaand
>  the binder is bound the process who created the binder this however is 
> the same process the Java code runnig. So what thread will listen to 
> binder? Should I not call android::ProcessState::self()->startThreadPool(); 
> or perhaps first fork or create a Java thread?
>
> any pointer or better patches to make this work are welcome!
>
> Greetings
>

Il giorno venerdì 23 settembre 2011 12:22:08 UTC+2, freakingtux ha scritto:
>
>
>
> On Tuesday, September 13, 2011 6:56:41 PM UTC+2, Nitin wrote:
>>
>>
>>
>> On Saturday, October 23, 2010, Dianne Hackborn <[email protected]> 
>> wrote:
>> > The Java runtime has wrappers around C++ IBinder.  This is what Java's 
>> Binder is.  You can write a JNI function that returns a Java Binder and in 
>> its implementation instantiate a C++ IBinder interface and return it.  You 
>> will need to use this magic function in libandroid_runtime to do this:
>> >
>> > extern jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& 
>> val);
>> >
>> I was able to do it this way, I wil post the link to github for reference.
>>
>> Nitin If you have more pointer please do tell me so. After cloning your
> repository some while ago and documenting the code I started hacking
> to get the code running on inside an apk and not running as system 
> service. This is not really portable but at least it is a start at 
> getting somewhere (I can ndk-build the code and ant install it).
>
> I don't understand how the javaObjectForIBinder approach should work. My 
> best guess at what was suggested is posted here
>
> https://github.com/keesj/Android-HelloWorldService/blob/pure_apk_hack/jni/main_helloworldservice.cpp#L125
>
> Basically I construct a Binder object (what might as well have been passed 
> to the native code) and try to
> replace the native binder. All kinds of alarm bells go of
>
> The code is called from here 
> https://github.com/keesj/Android-HelloWorldService/blob/pure_apk_hack/src/org/credil/helloworldservice/HelloWorldService.javaand
>  the binder is bound the process who created the binder this however is 
> the same process the Java code runnig. So what thread will listen to 
> binder? Should I not call android::ProcessState::self()->startThreadPool(); 
> or perhaps first fork or create a Java thread?
>
> any pointer or better patches to make this work are welcome!
>
> Greetings
>

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

Reply via email to