IcedRobot: Android on the JVM?

March 14, 2011
Jessica Thornsby

Running Angry Birds on my 1080p Linux desktop would be the definitive goal.

IcedRobot is a new initiative to bring the Android API to the
Linux Desktop. The project’s goals include separating Dalvik from
the Android infrastructure, avoiding Harmony as much as possible,
creating a Dalvik to Java compiler, and ultimately getting Android
running on the JVM. In this interview, JAXenter speaks to Java
Architect at JP Morgan Chase, Mario Torre, who has previously
worked on OpenJDK and GNU Classpath, about this new project.

JAXenter: The IcedRobot website has just been
launched. Can you give us an introduction to this project?

Mario Torre: First of all, thank you for this
opportunity! The purpose of IcedRobot is to provide a full
environment that is compatible with Android but that can run on
standard Desktop. Android is powerful system, that is composed of
many different layers, but most of those layers are already
available to most users. We thought that it would be interesting,
if not useful, to be able to still use the programming frameworks
and the libraries but without the need to install a full Android
Operating System, being able, in other words to use Android under
GNU/Linux. I said GNU/Linux for a reason in this case, because
Android is only partially based on the GNU toolchain at his
core.

There is also another goal, by separating Dalvik from the OS we
will be able, with little or no effort, to run Android
applications, for the most part unmodified, on something other than
Linux. We are aiming specifically at OSX and QNX, which are
probably the easiest targets, but we have some developers also
interested in Windows and Windows Mobile. In fact, why limit
ourselves? We can run Android on just about every crazy platform we
have access to.

So, short summary, IcedRobot mainly consist of an interpreter,
Daneel, and the framework itself, which is informally part of the
GNU Droid project. We also have some more high level plans, this is
what we referred to as GNU Bishop at FOSDEM, but at this point we
have not yet defined them in details.

JAXenter: What are the technological challenges
of separating Dalvik from the usual Android infrastructure?

Mario: There are a few issues we are facing.
First of all, there are many components that require a specific
processor architecture and whose components exist in assembly or
binary form only and we need to replace those parts or fix them
where possible.

In theory, once we are done with this task, we could already run
Android applications unmodified under Dalvik and IcedRobot would be
complete, and only require maintenance, we would be famous and
happy.

But while discussing our initial planning, we came to another
conclusion: why not make Dalvik a module and use the JDK instead?
We thought this would make everybody happy, Oracle from one side,
because we would give them back the Java compatibility that Google
broke, and Google, because we would reach an ever broader user
base!

I realise how naive this approach is. But we are hackers, and we
did this all the time in our lives: when we have something that
works in some way and we’re not happy with it, we change it. We did
the same with the Caciocavallo project, our first result was to run
GNU Classpath code mostly unmodified under OpenJDK. The second was
to run Swing applications inside an old video cassette
Recorder – using OS9 – and now Clemens Eisserer is porting Swing on HTML 5, so you will not even
need to run Java on the clients anymore!

The reason I say this is because it’s all related in the end.
Wouldn’t it be cool to run Android in a web browser without even
having an VM on your machine in the first place?

But this of course brings up new issues. We need to have a
Dalvik interpreter, we need to be sure that the library works under
the JDK, and because there are quite a few name collisions we need
to be able to resolve them. At this point we still don’t have an
answer for many of those issues, but thanks to the amazing work of
Rémi Forax and Michael Starzinger and Roman Kennke we already have
an Hello World running.

This has not been integrated yet because we are trying to
abstract the parser internals so that we can plug another
implementation if needed. This is all amazing stuff, really, quite
exciting.

JAXenter: What are the major advantages of
Android running on the JVM?

Mario: Well, I think I already hinted at some
of them, like being able to run Android anywhere Java can be run. I
will not say again that we hope to be free of the litigation – did
I just say that?

I would add: running Angry Birds on my 1080p Linux desktop would
be the definitive goal; at FOSDEM we were joking with David Gilber
of JFreeChart fame about the fact that in the Android distribution
there seems to be a JFreeChart jar file, but this really requires
Java2D…well, no problem, let’s use Java2D inside Android
then.

Although those can be seen as silly jokes, the reality is that
there is indeed a full potential in leveraging the APIs that come
with Android. I am personally interested in porting the JDK to QNX
and running Android in one go, and trying to use the GoogleTV
framework. But there are way more creative use cases that just need
to be explored.

In the end, I believe that Android has the potential to close
the gap between the Java SE and the Micro Edition. I never really
understood why all those technologies are separated and could not
coexist in a better, broader, environment. I think it’s about time
to do it.

JAXenter: What is the goal of the ‘Ika’ tool,
which will be developed as part of the IcedRobot project?

Mario: Ika is our swiss army knife tool, a real
life saver whose potential has still to be fully exploited.

It’s a tool that was conceived to handle our complex workflow
without really having to think too much about what we are doing;
it’s responsible for handling the repositories and to apply the
patches and to create new ones and initialise them to a default
state if we need to.

JAXenter: Are there any plans to port IcedRobot
to other platforms, besides Java?

Mario: Not really, at least not for now, but of
course it should be possible to run the Java APIs from within
Jython, Clojure and so on, once the basic platform works. We could
extend this at some point to also run Android (as in dex bytecode)
applications directly in those languages, but this is not something
we are targeting right now.

JAXenter: What are the next steps for the
IcedRobot project?

Mario: We need to finish Daneel, the Dalvik
interpreter, this is the top priority. We will keep working on
decoupling the Dalvik as well. While this is an ongoing task, it’s
really important because it’s not “just” about running Dalvik
standalone, it’s mainly about being able to use the frameworks, so
this will be used by Daneel at some point. Then we will try to make
this work together with Replicant.

I have worked in the past on OpenJDK and GNU Classpath and currently as Java Architect in the Core Team at JP Morgan Chase, in Genève, but I come from Salerno, a small city in the beautiful south of Italy. My interests spawn many areas, especially Music and Visual Arts. I am passionate about graphics and technologies and I always try to include my artistic skills in my daily job. I aim for World Domination. But when I’ll get it, I’ll simply throw all away and start all over again. I am an incurable romantic.