Any way for OEM add-on to provide access to private resources?

28 views
Skip to first unread message

Todd Lee

unread,
Apr 26, 2016, 11:56:01 AM4/26/16
to android-platform

We build Android for a wearable platform. In aiming to support third party development, I've prepared an SharedLibrary (system) APK which encapsulates our API (includes facility to provide some theme elements based on custom attributes). I've also created an SDK add-on (with stubbed jar) based on the shared library APK to provide developers access to the API. The problem I'm running up against though is giving our developers access to the custom attributes that they need in order to specify their themes.

A simplified example:

- 3rd party app implements a service (based on our API base class)
- defines a 'theme' based on AOSP theme (e.g. device default)

i.e. app res/values/styles.xml includes:

<style name="Custom.Theme" parent="android:Theme.DeviceDefault">
    ...
    <item name="myCustomAttribute">...</item>
    ...
</style>

- our framework gets the meta data for the service, and uses the defined theme from the 3rd party package resources to do some stuff, based on the custom attributes.

Now the problem is that we can't expose the 'myCustomAttribute' attr resource for use in the app's XML. 

Note using the name-space with 'res-auto' doesn't work because this isn't a library project (add-on is a JAR, so even though I can provide an R.java for symbolic reference, I can't provide the actual resources...).

Also note, the other option obviously would be to go with an AAR distro which would allow us to package code + resources, but we'd like to retain the dynamic behaviour (e.g. runtime linking with the shared library APK, which can be updated as required) rather than settling for static inclusion if at all possible.

Any suggestions are most welcome - thanks!
Reply all
Reply to author
Forward
0 new messages