Académique Documents
Professionnel Documents
Culture Documents
Abstract
This paper describes the different approaches to run an Android Application on Another platform OS. We discuss android stack and different components and runtime requirements to run an android application. This paper also gives idea about solution and ideas under development. A sample execution process explains about probable way about how an android application can execute on another platform.
Contents
1. 2. 3. 4. 5. Introduction Android Architecture Co-existence Approach Conclusion Reference
Figures
Figure 1 : Android Stack Architecture 3 Figure 2 : Android Runtime Environment 4 Figure 3 : Android Application building blocks 4 Figure 4 : Possible Customization in Android Runtime Environment 5 Figure 5 : Android Application Framework Abstraction 6 Figure 6 : Android Libraries Abstraction Approach 7
1. Introduction
During the past few years, there is a steep rise in the application development for mobile devices based on different Mobile Platforms like Apples iPhone, Microsofts Windows Mobile/Phone, BlackBerry, Palms WebOS, and Googles Android OS. This gives lots of choices to users while purchasing a new Smartphone i.e. phone model and platform. Unfortunately, picking the phone inherently means users dont have a choice in the OS it uses as they come pre-loaded. This problem could be solved if it is possible to run a mobile application written for one platform to any other platform. This document explores different possibilities to run an application developed for Android on any another platform (could be Linux flavor like MeeGo or Windows or other). This document covers brief about Android Architecture, Some possible Coexistence Approaches and refer some other under development solutions.
2. Android Architecture
Why Android based Application? There are some of the following reasons Android as a platform has a rich ecosystem of downloadable applications, leveraging it would offer to OEMs an economical way to populate their application stores and provide Application interoperability across different Platform. Android as an embedded operating system is not limited for mobile devices; it is actually more than that like it used in Automobile, Tablet PC, Cameras, Setup box and other embedded devices. Android is an open source platform so the costs of designing the android application are drastically reduced. It is not a Linux OS, but it use basic Linux kernel for basic OS operation and enhance this kernel for its own use. Android OS is more of an open-source software stack for embedded devices that include an operating system, middleware and some key Java applications that are essential and common while running on a Java-based, object-oriented application framework on top of Java core libraries running on a Dalvik virtual machine. Android Applications are different than standard mobile applications in two major ways. 1. By Default installed Android application (packaged as an Apk) runs in its own Linux process, has its own Dalvik VM instance and is assigned a unique user ID. There exists 1 thread per process, called as main thread. The main thread has a Looper instance to handle the messages from the message queue. It pops off the messages from message queue and invokes the corresponding methods to handle it. 2. Android application life cycle is managed by the Android Framework.
2.1 Architecture
Five major components constitute the Android system from the lowest level (closest to hardware) to highest level (closest to the user). They are - Linux kernel, Android Runtime, Libraries, Application Framework, and Applications. Figure 1 shows the Android system stack.
2.1.1 Applications
Applications run on top of application framework. Android applications are a set of Developer made applications and core applications (shipped with Android including an email client, SMS program, calendar and others) written in Java programming language.
2.1.3 Libraries
A set of core C/C++ libraries used by various components of the Android system and Framework. Libraries can be considered as a set of instructions that tell the device how to handle different kinds of data. These libraries are not directly exposed to developer.
Dalvik virtual machine: Dalvik VM is software applications that behaves as if it is an independent device with its own operating system and provide a virtualization layer that interprets the applications written in Java. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. It is Similar to JVM but is an optimized version of the same. It has following properties. An interpreter-only register-based virtual machine Designed to allow multiple instances to run at once Relying on underlying OS for process isolation, threading support and low-level memory management. Execute Dalvik Executable (.dex) format which are converted at compile time from standard class and jar files and will zipped into Android package (APK)
Launcher
Android Execution
Runtime Environment
Dalvik VM
Android Framework JNI Android Core Libs Linux OS Figure 2 : Android Runtime Environment
APK Process
Activity 2 Activity n
3. Co-existence Approach
Since Android Application runs in its Android runtime environment which is tightly coupled with Android stack then how could non-Android device run application made specifically for Google's Android platform? So to run Android app on other platform we have following choices - Either Re-write the app according to target platform or some common app platform like HTML5, 3 rd party platform like PhoneGAP etc. But this is not coexistence. - Or Devoid Android runtime environment from Android Stack. This can be achieved by replacing maximum runtime components (Servers, managers and services) with target Platform one or some Platform independent ones. Android is not a application framework but it is a full-blown operating system and all apps that run on Android phones or tablets run in a virtual machine (VM), called Dalvik. So if we can recreate that emulation environment on another OS, the apps should run as normal and without any kind of performance hit to the apps operation. The solution is much like the Java Virtual Machine on a desktop. It brings greater security because apps in a VM are essentially walled off from other applications and from the device's Operating System. When the app in a VM crashes, it has no effect on other applications or on the Operating System, ensuring stability. Also replace maximum runtime components (Servers, managers and services) with target Platform one or some Platform independent ones.
Android Execution
Application
J N
Launcher
Application Framework
Figure 4 : Possible Customization in Android Runtime Environment Following section explains the about some possible customizations in the Android runtime Environment components 1. Virtual Machine: Since android application runs in Sand Box environment and this environment can be provided by some Virtual machine it could be Standard JVM or Dalvik VM or some other customized form of Dalvik VM (decoupled Dalvik from Android Stack).
[Typically JVM is used for desktop not for embedded device because it is not optimized to support embedded system. While Android Dalvik VM is well optimized for embedded device but it is tightly coupled with android stack. So there shall be a need to make DVM independent of android stack.]
2. Launcher: a launcher application needs to be developed to parse and launch the Android application APK/JAR and associate it with VM(JVM or DVM or etc)
3. Application: To run android application in VM, either directly running the Android Application APK file or converting Android application package file into some other form that will be easily understand by the target VM environment like convert into a JAR file and then running JAR on JVM. 4. Android Framework Mangers/Services: It is requiring run and manage android application lifecycle. Android application developed using this framework API so Framework cannot be 100% replaced. Here are two possibilities Either Port complete Framework on the target OS Or make a wrapper of Android application framework which internally uses native OS application framework so that Android application can be run without any code modification. 5. JNI abstraction: This layer is required to call or interaction of JAVA code with modules written in core C/C++ languages.
Android Native libraries and services : The core services used by the android framework to
provide necessary feature to execute an application. These core services are written in C/C++ languages and directly interact with underlying core OS. Here we have choice to replace maximum services by the services which are independent of Android Stack. Some candidate service are like BIONIC, HAL Hardware Abstraction layer, Webkit, Media Framework, SQLite, SGL (SKIA Graphics lib)
6. OS Kernel and Extensions: Following Kernel extensions are important because Application framework
and core manager and services depend on them. a. Binder: Binder driver facilitates inter-process communication and data sharing between applications and services through the use of shared memory. Either we can port the same Driver to Target OS or write a new with same interface which will use native IPC mechanism. b. Power Management: Android has its own power management but application should use the native platform power policies.
3.1 Approaches
Following are the two possible approaches based on above discussion
3.3 Limitations
Android Architectural limitations: Android tight coupling with Linux kernel patches like Binder, Power Mgmt etc. Applications should follow target OS power mgmt policies. Dalvik Virtual machine and Android stack are tightly coupled with each other. Native code written in C/C++ dependent on Bionic is tightly coupled with it Final APIs/features support will depend on the integration of Android framework and core service with native OS. As Android RTE will use native libraries and services, some of the Android APIs may not be supported and it may have impact on some specific features like UXD experience, UXD experience may little different on another Platform as compare to Android Platform. It may possible, only one android app will execute at a time. Workaround could be running android app in Dalvik VM which will in turn execute within JVM. This make more than one android apps will execute but I guess it make significant performance hit Quite possible, android application (APK) may not run directly on the target platform. It may require repackaging the existing android APK to some other form depending on the target VM environment like JAR. Permission to Google market support.
Emulation: Emulation is another kind of virtualization technology in which complete hardware architecture is
virtualized and will be created as a software component. This software will replace the functionality of a designated hardware processor and associated hardware systems. In this the guest OS may not have to be modified to run on an incompatible architecture. For example Android Device emulator comes as a part of the Android SDK.
B. RIM-Blackberry Playbook
RIM also support Android Applications on its upcoming QNX-based Playbook tablet with certain limitations. App Player: RIM will launch an optional "app player" that provide an application run-time environment for Android v2.3 apps. This new app player will allow users to download Android apps from BlackBerry App World and run them on their BlackBerry Playbook. This will be placed in a secure "sandbox" on the BlackBerry Playbook where the Android apps can be run. Android Apps: Android apps will not ran directly, some changes are required to make it run on Blackberry. Following the changes and steps required to make android app to compatible on blackberry. Repackaging Code signing Submit it to the BlackBerry App World Approved Distributed through BlackBerry App World.
C. Alien Dalvik
Myriad Alien Dalvik brings Android applications to non-Android devices, allowing OEMs, operators and application stores to leverage the Android eco-system across a much wider range of mobile devices. Following are the possible major components of the solution: Repackage: Android application need to be repackaged with Alien sdk. This repackaged Application will install on MeeGo device from OEM/Operator/3rd Party Apps Store. Re-Write: Applications which are device-dependent or do need to be modified then re-write the application natively for MeeGo with Alien SDK. Alien Dalvik runtime: This will provide runtime environment for an Android repackaged application to execute on MeeGo. This has been made possible through a very tight integration of the Android runtime and the use of Myriad Dalvik Turbo technology. Runtime alien Dalvik can be pre-installed or automatically downloaded with the first Android application.
4. Conclusion
As we discussed in the paper, technically it is possible to develop runtime environment to run an Android application on a device running on another OS. For this we have to develop or customize interpreter like JVM/DVM and use native OS services as much as possible. One more possibilities we use some standard open source services and bundle them in a single package so that it work on most of the platform OS available. It is clear that with any approach there are some limitation associated with it like development time, maintenance effort and frequency due to rapid change technology. Also there is need to modify Android application package according to our approach like convert it into JAR or any custom format so that developed runtime can understand it. This paper also briefly explore possible approach used by some different under development project going on.
5. Reference
Android developer guide <http://developer.android.com/guide/index.html> Alien Dalvik Solution <http://www.myriadgroup.com/Device-Manufacturers/Android-solutions/Alien-Dalvik.aspx> Mariad Alien Dalvik Demo <http://www.youtube.com/watch?v=mXWEyKjwk2g> Google Project <http://code.google.com/p/android-dalvik-vm-on-java> Goggle Projects: <http://code.google.com/p/android-dalvik-vm-on-java>, <http://code.google.com/p/dvk/> Ubuntu wiki <https://wiki.ubuntu.com/Specs/AndroidExecutionEnvironment> [7] IcedRobot <http://www.icedrobot.org >
[1] [2] [3] [4] [5] [6]