views:

42

answers:

1

I'm interested in knowing how much the IPC mechanisms are meant to be exposed to the outside world. That is, if I wanted to impersonate a dalvik VM instance without having my app actually written in Java, am I allowed to do so, or will the protocol change the next time I look away from the screen? If it's allowed, what are the stability guarantees or lack thereof? Is there anything like documentation, or am I supposed just to read the fine sources on android.git.kernel.org?

The purpose of it all would be to write apps in !Java languages while retaining the ability to construct GUIs. I don't care or mind if the code is technically inside a dalvik process as a JNI callout, what I'm interested in is "if I'm really good at pretending I'm Java over the wire, can I do everything actual Java code can? Or is there something that's only available as Java bytecode and nothing else?"

+1  A: 

The purpose of it all would be to write apps in !Java languages while retaining the ability to construct GUIs.

Only Dalvik VM bytecode is capable of constructing GUIs. That bytecode does not necessarily have to be Java -- it could be from Scala, for example. But it does have to be bytecode run by the VM.

The Android IPC mechanism, based on OpenBinder, is used for coarse-grained stuff, not GUIs. FWIW, JNI, via the NDK, does not use IPC per se -- JNI represents library calls, not inter-process calls.

So, when you ask:

if I'm really good at pretending I'm Java over the wire, can I do everything actual Java code can?

Yes, but only for those things that are done "over the wire". The vast majority of an Android application is not processed "over the wire", for performance reasons.

CommonsWare
Okay, so when my Android app draws a button, it's really done by loading and executing some bytecode that implements drawButton() and then only the resulting pixels are pushed to the OS to display? Is that what you're saying? Which means to avoid Java I'd have to reimplement all the pixel-drawing routines, not just the IPC bits, which is rather silly.
mathrick
Yes, that is what I am saying. Note that this is the case for standard widgets. OpenGL and other forms of SurfaceView (e.g., camera preview) behave differently.
CommonsWare