OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

Post on 06-May-2015

1.970 views 3 download

Transcript of OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

MUSIC, OSGi & AndroidJorge Lorenzo (jorgelg@tid.es)

Telefónica I+D

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

2Table of contents

• Situation• Android• OSGi & Android• MUSIC• MUSIC & Android• Conclusions• References

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

3

• Poor support of mobile devices by MUSIC:– Only Windows Mobile

• Android comes on the scene:– Rich features– Many applications– Open source

• What about conquer Android?

Situation

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

4

AndroidWhat is Android?

“Android is a software stack for mobile devices that includes an operating system, middleware

and key applications”

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

5

• Open platform for mobile devices

– Apache v2 and GPL v2

• Supported by Google and Open Handset Alliance

• Powered by the Linux kernel

• Run Java applications– Over Dalvik VM

AndroidFeatures

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

6

AndroidOpen Handset Alliance

• Mission statement:– Building a better phone for consumers– Promote openness in the mobile ecosystem

Mobileoperators

Handsetmanufacturers

Semiconductorcompanies

Softwarecompanies

Commercializationcompanies

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

7

AndroidArchitecture

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

8

AndroidApplication building blocks

ActivityActivity

UI screen (typically)

ServiceService

Task that runs in the background

IntentReceiveIntentReceive

Components for broadcast notifications/alarms

ContentProviderContentProvider

Sharing of data across applications

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

9

OSGi & AndroidComparison

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

10

OSGi & AndroidWhich benefits does OSGi provide to Android?

• Lack of class-sharing and versioning• Expensive inter-process communication• No device management

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

11

OSGi & AndroidPorting OSGi to Android

• Basic process (no GUI):– Install Android SDK– Convert JAR bundles to DEX files– Prepare the OSGi framework structure– Create an Android Virtual Device– Push the OSGi framework structure– Open a shell– Launch OSGi

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

12

OSGi & AndroidOSGi frameworks under test

OSGicore

OSGiconfiguration

admin

OSGideclarative

services

EquinoxEquinoxv3.4.2v3.4.2

FelixFelixv1.8.0v1.8.0

KnopflerfishKnopflerfishv2.3.1v2.3.1

*

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

13

OSGi & AndroidWhich benefits does MUSIC provide to Android?

• Self-adaptive applications• Distributed context-awareness applications• SOA and SLA• Ubiquitous computing• Portability

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

14

Provide methods, tools and runtime support for developing, deploying and maintaining context-aware, self-adaptive applications aiming for mobile and pervasive computing

environments

• Vision:

MUSICOverview

• FP6 project• Open source: LGPLv2.1

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

15

MUSICAdaptation process

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

16

MUSICArchitecture

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

17

MUSICApplication variability

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

18

MUSIC & AndroidArchitecture (I)

music.apk

MusicActivity

OSGiService

framework.jar

/data/osgi

Android Virtual DeviceAndroid Virtual Device

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

19

MUSIC & AndroidArchitecture (II)

MusicActivity

KnopflerfishService

MUSIC GUIfor Android

Show progress screen

Start OSGi service

Read configuration

Launch Knopflerfish

Register OSGi service

Start bundle

Activate GUI manager

Update screen

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

20

MUSIC & AndroidFeatures

• Android service for OSGi life cycle:– Background– Started only once

• No modification in the MUSIC mw:– Except GUI

• MUSIC applications share the same Android activity

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

21

MUSIC & AndroidDemo (I)

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

22

MUSIC & AndroidDemo (II)

«mApplication»HelloWorldApp

«mUtil i tyFunction»Utility

«mAtomicRealization»HelloWorldLandscape

+ HelloWorldLandscape

«mAtomicRealization»HelloWorldPortrait

+ HelloWorldPortrait

«mPropertyType»Context::landscape

«mValueRange»- VR: boolean

«mPropertyType»landscapeProv ided

«mValueRange»- VR: boolean

«mPseudoCode»

uti l i ty = 1.0; if landscape == landscapeProvided = 0.0, otherwise

refers_ to_eval

refers_to_context

«realize» «realize»

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

23

MUSIC & AndroidProblems

• Write permissions required:– /data/osgi/fwdir

• OSGi cache• Feasible

– /data/dalvik-cache• Dalvik cache for DEX files• Unfeasible• To be solved with the classloading API of the

Android SDK 1.5

• Workaround: chmod 777

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

24

Conclusions

• Successful porting to Android– Some fixes still required for deployment on real

devices– Some tricks for valid dexification

• Acceptable performance and stability• Mutual benefit

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

25

References

• Google. What is Android?• Gábor Pécsy:

– A comparison of OSGi and Android– OSGi on top of Android

• Android SDK• Development with Android SDK• MUSIC:

– Site– Wikipedia

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

26