OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

26
16 June 2009 MUSIC, OSGi & Android Jorge Lorenzo ([email protected]) Telefónica I+D

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

Page 1: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

MUSIC, OSGi & AndroidJorge Lorenzo ([email protected])

Telefónica I+D

Page 2: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

2Table of contents

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

Page 3: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 4: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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”

Page 5: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 6: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 7: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

7

AndroidArchitecture

Page 8: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 9: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

9

OSGi & AndroidComparison

Page 10: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 11: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 12: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

*

Page 13: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 14: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 15: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

15

MUSICAdaptation process

Page 16: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

16

MUSICArchitecture

Page 17: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

17

MUSICApplication variability

Page 18: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 19: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 20: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 21: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

21

MUSIC & AndroidDemo (I)

Page 22: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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»

Page 23: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 24: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 25: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

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

Page 26: OSGi, MUSIC and Android - MUSIC Project — MUSIC Project

16 June 2009

Jorge Lorenzo: MUSIC, OSGi & Android

26