| 882 | } |
| 883 | |
| 884 | status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets) |
| 885 | { |
| 886 | // First, look for a package file to parse. This is required to |
| 887 | // be able to generate the resource information. |
| 888 | sp<AaptGroup> androidManifestFile = |
| 889 | assets->getFiles().valueFor(String8("AndroidManifest.xml")); |
| 890 | if (androidManifestFile == NULL) { |
| 891 | fprintf(stderr, "ERROR: No AndroidManifest.xml file found.\n"); |
| 892 | return UNKNOWN_ERROR; |
| 893 | } |
| 894 | |
| 895 | status_t err = parsePackage(bundle, assets, androidManifestFile); |
| 896 | if (err != NO_ERROR) { |
| 897 | return err; |
| 898 | } |
| 899 | |
| 900 | NOISY(printf("Creating resources for package %s\n", |
| 901 | assets->getPackage().string())); |
| 902 | |
| 903 | ResourceTable table(bundle, String16(assets->getPackage())); |
| 904 | err = table.addIncludedResources(bundle, assets); |
| 905 | if (err != NO_ERROR) { |
| 906 | return err; |
| 907 | } |
| 908 | |
| 909 | NOISY(printf("Found %d included resource packages\n", (int)table.size())); |
| 910 | |
| 911 | // Standard flags for compiled XML and optional UTF-8 encoding |
| 912 | int xmlFlags = XML_COMPILE_STANDARD_RESOURCE; |
| 913 | |
| 914 | /* Only enable UTF-8 if the caller of aapt didn't specifically |
| 915 | * request UTF-16 encoding and the parameters of this package |
| 916 | * allow UTF-8 to be used. |
| 917 | */ |
| 918 | if (!bundle->getUTF16StringsOption()) { |
| 919 | xmlFlags |= XML_COMPILE_UTF8; |
| 920 | } |
| 921 | |
| 922 | // -------------------------------------------------------------- |
| 923 | // First, gather all resource information. |
| 924 | // -------------------------------------------------------------- |
| 925 | |
| 926 | // resType -> leafName -> group |
| 927 | KeyedVector<String8, sp<ResourceTypeSet> > *resources = |
| 928 | new KeyedVector<String8, sp<ResourceTypeSet> >; |
| 929 | collect_files(assets, resources); |
| 930 | |
| 931 | sp<ResourceTypeSet> drawables; |
| 932 | sp<ResourceTypeSet> layouts; |
| 933 | sp<ResourceTypeSet> anims; |
| 934 | sp<ResourceTypeSet> animators; |
| 935 | sp<ResourceTypeSet> interpolators; |
| 936 | sp<ResourceTypeSet> transitions; |
| 937 | sp<ResourceTypeSet> xmls; |
| 938 | sp<ResourceTypeSet> raws; |
| 939 | sp<ResourceTypeSet> colors; |
| 940 | sp<ResourceTypeSet> menus; |
| 941 | sp<ResourceTypeSet> mipmaps; |
no test coverage detected