Exophase said:
dflemstr said:
I think he meant the Dalvik VM. Would still be problematic though.
Actually, that's kinda interesting.. Although a very different and much more limited question, is there any prospect of porting the Dalvik VM to Pandora, or maybe Dalvik binaries can be converted back to JVM ones?
Possible but difficult. To convert JVM binaries to DVM binaries, you just replace every stack push by a register store instruction in a round-robin fashion. But it's more difficult to convert register stores to stack instructions, since you'll have to somehow find the order that was used when the code was a JVM binary and reuse it (or else you'll have unnecessary pops when you want to reach a value that was pushed in the wrong order). And let's not forget that some other instructions (related to class loading) can't be mapped 1:1 between JVM and DVM. But it is at least theoretically possible, because every DVM binary once was a JVM binary (there is no javac for DVM so you always have to first use javac and then use a JVM→DVM compiler) so...
Exophase said:
If typical JNI code in apps really does tend to just do number crunching with the Java part still handling all the abstraction then maybe not much of Android proper is really needed to run them.
Well, there's the issue of the Android library itself. Android doesn't run the Java standard library; it uses an altered (stripped down) version of it with less cross-dependencies, and it adds its own extensions to replace some of the Java standard library. Which is good in a way, because most of the standard Java library consists of horribly deprecated, pre-generics code that is slow and badly designed (especially the collections and IO libraries). But the problem is that the new Android library uses JNI to add its new features (The standard Java library also uses JNI for its native functionality - file, sound, raster and memory access etc - but libjli and related libraries are available for virtually every platform already).
It uses OpenGL ES bindings, native audio system bindings - probably ALSA or similar; bindings to new IO and threading libraries and of course bindings to some kind of "core Android library" that controls things such as user elevation, DRM management, access policies, the "window manager" aka the library that controls the frame buffer, etc. All of the code for these libraries is licensed under Apache 2.0, so it *can* be ported, but the C code needs to actually *be* ported, compared to the rest of the (Java part of the) core library, which makes the task a tad more difficult.
Quickly analyzing the Android JAR, I see that the following Java packages are non-standard:
com.android
com.android.internal
res.* (← These packages only contain resources such as images/sounds/data)
assets.* (← Ditto)
android.speech (← Uses ESpeak)
android.speech.tts
android.webkit (← Uses WebKit (durr))
android.appwidget
android.media
android.os (← Kernel interface + rights management + more)
android.accessibilityservice
android.location (← GPS dependency)
android.widget
android.graphics (← This seems to be a port of the AWT drawing API, dunno if it adds dependencies yet)
android.graphics.drawable
android.graphics.drawable.shapes
android.util
android.opengl (← OpenGL ES API)
android.app (← Process management)
android.app.admin
android.app.backup
android.preference
android.gesture
android.bluetooth
android.service
android.service.wallpaper
android.database (← SQLite dependency afaict)
android.net
android.net.wifi
android.net.http
android.text
android.text.util
android.text.method
android.text.style
android.text.format
android.inputmethodservice
android.telephony (← Obviously not portable to the Pandora; should be replaced by mock methods)
android.telephony.gsm
android.telephony.cdma
android.content
android.content.pm
android.content.res
android.provider (← Provider specific info; uses clearly defined interfaces so the Pandora could implement this package)
android.test (← Only for the SDK; not part of the internal RT lib)
android.test.suitebuilder
android.test.suitebuilder.annotation
android.test.mock
android.sax (← Port of the org.w3c....sax package afaict)
android.hardware (← Limited interface for non-standard devices + SD cards and the like)
android.view (← Interface to some kind of rasterization slave library)
android.view.animation
android.view.accessibility
android.view.inputmethod
dalvik (← Dalvik standard library stuff)
dalvik.bytecode
dalvik.annotation
dalvik.system
I can't tell exactly which libraries each of the packages depend on, because there's no equivalent of ldd for Java (all native libraries are linked ad-hoc at runtime) but it seems like the suite can be compiled without any non-standard native libs (there are no Android-specific native libraries) since the SDK doesn't contain any glue code what I can see.