what’s the best way for OEM to organize it’s own resources?

http://groups.google.com/group/android-framework/browse_thread/thread/e9974bd5a42af10a/61dc12b2bd0eadde

make their own resource apk like "framework-res.apk", it can
separate their own resources from android's original res,  but i don't
kown how to implements it, and i don't kown whether it is feasible.

This would be best, but currently we don't support shared libraries with
resources so you can't really do it.

In cupcake you can define PRODUCT_PACKAGE_OVERLAYS in your product makefile
to specify one or more directories that will be merged in with the base
platform directories.  For example:

PRODUCT_PACKAGE_OVERLAYS := vendor/mycompany/prod_overlay
vendor/mycompany/base_overlay

Now you can replace or add framework resources by putting them in either of
these:

vendor/mycompany/base_overlay/frameworks/base/core/res/res/
vendor/mycompany/prod_overlay/frameworks/base/core/res/res/

You can use this to replace any resource in the tree, both in the framework
and in specific packages, by just putting them in a directory corresponding
to the same path where you find them in the platform tree.

Also when adding new resources to the frameworks that you want to use in
your own apps that are built into the system image, you can use the magic
syntax "@*android:type/name" to reference them without having to make them
public.  You can likewise find private resources in Java at
com.android.internal.R.

Glad to see this overlay mechanism.  Very nice.
How can I test this?
I created a vendor/mycompany/mycompany.mk
————
PRODUCT_PACKAGES := \
    VoiceDialer

# Try adding a product with VoiceDialer

# Superclass
$(call inherit-product, build/target/product/generic.mk)

# Overrides
PRODUCT_BRAND := mybrand
PRODUCT_NAME := myproduct
PRODUCT_DEVICE := mydevice
PRODUCT_MANUFACTURER := me
————

and a AndroidProducts.mk at the same location
————

PRODUCT_MAKEFILES := \
    $(LOCAL_DIR)/mycompany.mk
————

But before adding overlays, I tried to do a build but I am not sure
whats the correct target.

make myproduct
make PRODUCT-myproduct-eng

all fails with msg: "No rule to make target"

Is there an example product makefile?
documents/pointers/tips would help.

thanks
Jey

i find that attrs.xml files can not be overlayed
it will make an error
attrs.xml  error atribute "direction" has already benn difiend.

i test the overlay on Launcher app
any other file types can be overlayed successfully.

i define the overlay path in my own product file
and copy the original Launcher app to the corresponding overlay path
the attrs.xml file failed,
delete the attrs.xml file it works.

i want to know if the attrs.xml files can be overlayed?

You are redefining the direction attribute, which is already defined by the
base framework.  You need to use a different name.

 and another problem

i put some res files in the framework res overlay dir
vendor/mycompany/base/frameworks/base/core/res/res/

when i make the framework-res module on the command line , it faild
"make: [out/target/common/obj/apps/framework-res_intermediates/pachage-
export.apk] segmentation fault"

the framework res  can not be overlayed???

————————————————————————————
hi Nik
just like Dianne Hackborn reply to my first post
i make a dir for my overlay res under the android source root dir
the path looks like:
android_root/vendor/mycompany/base
android_root/vendor/mycompany/product

and just for test we define PRODUCT_PACKAGE_OVERLAYS := vendor/
mycompany/base vendor/mycompany/product
in the build/target/product/generic.mk

if you test Launcher app
put the Launcher app under
vendor/mycompany/base/packages/apps/
on the command line >make Launcher

if you test framework res
put the overlay res under rvendor/mycompany/base/frameworks/base/core/
res/res/ path
>make framework-res

but it faild

——————————————————————-
hi Dianne Hackborn
the  direction attribute is defined is not defined by framework
it is defined by the original Laucnher app which under pachages/apps/
Laucher
and i copy the Launcher app to my overlay path
you said it will replace the original files, it is that?
i find that, image files will be replaced, but attrs.xml file will be
merged not replace, is it?

Yes it can be overlayed, we use that for doing different builds for
different devices, such as setting up default configurations for hard vs.
soft keyboard devices.  The aapt shouldn't outright crash, so somebody will
need to debug that — if you want, just change the build system to run it
with "gdb" and you can get a stack crawl to see what happened.  (Look for
$(APPT) in build/core/definitions.mk for the place where it is invoked.)

Posted via email from feinan’s posterous

Previous How to Create or Edit Themes Next Call For Papers, Data Compression Conference, Mar 29-31 2011, Snowbird, UT

Leave a Reply

You must be logged in to post a comment.