Wednesday, January 14, 2009

mBS for Android Updates

Today ProSyst released the updated (0.2) version of mBS for Android, the Android port of the leading embedded implementation of OSGi Framework and services. The updated version can now be run on Android SDK 1.0 R2 as well as on the T-Mobile G1 device. Just like the previous version, this release is free of charge for non-commercial use.

Release Content

The 0.2 version contains:
  • mbs.apk - the updated version of mBS for Android
  • - ProSyst mConsole remote management tool
  • - Bundles demonstrating the use of OSGi services on top of Android
  • readme.htm - Detailed installation instruction for the release and the demos
  • License_Eula_ProSyst.txt

The changes made to mBS for Android

Classloading Changes
The Android platform does not allow to define classes using ClassLoader.defineClass(byte[]). Therefore the classloading mechanisms in mBS for Android had to be updated.

The Android platform provides special utility class for loading classes from external DEX files, class name is dalvik.system.DexFile. For this purpose new Class Provider was implemented, which uses the Android DexFile utility. When we start the mBS for Android application the starting process goes through the following steps:

  1. The Android platform activates the main activity of the mBS Android application.
  2. The main activity loads /res/raw/ as resource and extracts it in the data directory of the application. The data directory is /data/data/
  3. When the mBS image is extracted in the file system of the Android platform the main activity creates special java.lang.ClassLoader, which uses the dalvik.system.DexFile for loading classes from the serverjvm15.jar.
  4. After the class loader is created the main activity loads the Start class of the mBedded Server and invokes its main(String[]) method in separated thread.
  5. The the main method call is finished the mBedded Server application is started on the Android platform and the main activity updates the status of the provided information, the startup time and the used memory.
For debug purposes the output of the mBS is redirected to /data/data/ file, which can be opened using the Android SDK tools.
Network Permissions
In the previous version of the mBS Android application there was no need to add any permissions to the application for its normal work. In Android v1.0 the mBS needs special permissions for opening any server sockets. Therefore the following line was added in the AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

Signed Application Package
In the previous version of mBS Android application its was allowed to install Android applications, which are not signed. In Android v1.0 it is not allowed to install such application. Therefore the new version of mBS Android application is signed.

Future Plans

ProSyst is working on additional demos and tools that help to leverage this technology. This release was created as a proof of concept to demonstrate the feasibility of using mBS on Android. However, ProSyst can productize this version if there is a significant interest in using this technology.