Friday, July 8, 2011

Re: [android-developers] Re: Android and OSGi/Apache Felix

On 7 July 2011 23:07, Jesse <gotosleep@gmail.com> wrote:
> I have looked at that, but the EZDroid community hasn't been updated since
> 2009 and there is practically no content on their site. This makes me think
> it is completely abandoned. They do link to some code which was presented at
> a conference a few years
> back: https://opensource.luminis.net/wiki/display/SITE/Apache+Felix+on+Androids
>  The code is extremely basic though and it doesn't address any of my
> concerns. In their example projects, they create all views through code.
> They don't reference any Android resources, such as layout files. There is
> no discussion on what happens to the view created by the bundle if the
> bundle needs to be updated or removed.
> Also, there is the fact that it is impossible to add an activity or service
> to an application without modifying the Android manifest.
>

Jesse,

That presentation that you linked shows few things that might be of help:
- Android does not allow apps to dynamically load classes, but there
are workarounds (app has root or all access allowed to
/data/dalvik-cache
- Apache Felix is portable (no crazy dependencies), so you can keep
porting newer versions as you need to Android

What I understand is that you can achieve OSGI on a servce/business logic layer
Resources (layouts, strings, graphics, ...) in Android are
pre-packaged and pre-compiled into binary bundle and then statically
referenced through R class, so here things get complicated.

I don't think that by dropping a new class or a set of classes
(bundle), which is what OSGI enables, you could swap binary resources
files into an application and R class with it.

In other words OSGI allows dynamic deployment of classes and services,
rather than dynamic deployment of arbitrary files.

This means that you would have to expose your layouts through the
service. In other words have your layouts defined in code, rather than
XML files and your activities would have to use the coded layouts
served by the OSGI service running as a part of your app.

Your layouts would have to come with their resources and you would be
loading those resources using your custom code rather than Android
APIs.

You could have service exposed and managed through OSGI to retrieve
activities, which the Apache Felix presentation shows. That would
essentially be, what you need.

Only thing that I am not sure about is the security and implications
of such setup... Apps need digital signing, activities and services
need upfront declaring through the manifest file. The presentations
asks Google for dynamic class loading and dynamic security policies,
which suggests that they have had some troubles. It is not clear
whether they have managed to work around these.

If you are in charge of the device, there might be a way around such
limitation, say by installing your certificate as trusted one, so that
provisioned code signed with your key would be trusted. Again this is
a question to a platform engineer.

Luminis website [*] certainly has some demo code next to that
presentation, so give it a go and see what can and cannot be achieved.

Good Luck and if possible, please share your findings.

Daniel

[*] https://opensource.luminis.net/wiki/display/SITE/Apache+Felix+on+Androids

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment