Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c761d8b0 authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Zoran Jovanovic
Browse files

Build overlay packages just like regular packages.

Previously, building overlay packages required passing aapt its -o flag.
This commit decouples the idmap generation code from the effects of the
-o flag.

Since this commit renders the -o flag obsolete, support for the flag was
removed from aapt as well.

Change-Id: Ied2e0ab8cb800e49623f0a2044b06cd4935473d5
parent a081c7b8
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -9,6 +9,4 @@ LOCAL_SDK_VERSION := current

LOCAL_PACKAGE_NAME := com.android.overlaytest.overlay

LOCAL_AAPT_FLAGS := -o

include $(BUILD_PACKAGE)
+2 −3
Original line number Diff line number Diff line
@@ -4341,7 +4341,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui
        }
        Vector<uint32_t>& vector = map.editItemAt(mapIndex);
        for (size_t entryIndex = 0; entryIndex < typeConfigs->entryCount; ++entryIndex) {
            uint32_t resID = (0xff000000 & ((pkg->package->id)<<24))
            uint32_t resID = pkg_id
                | (0x00ff0000 & ((typeIndex+1)<<16))
                | (0x0000ffff & (entryIndex));
            resource_name resName;
@@ -4359,8 +4359,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui
                                                              overlayPackage.string(),
                                                              overlayPackage.size());
            if (overlayResID != 0) {
                // overlay package has package ID == 0, use original package's ID instead
                overlayResID |= pkg_id;
                overlayResID = pkg_id | (0x00ffffff & overlayResID);
            }
            vector.push(overlayResID);
            if (overlayResID != 0 && offset == -1) {
+0 −4
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ public:
          mWantUTF16(false), mValues(false),
          mCompressionMethod(0), mOutputAPKFile(NULL),
          mManifestPackageNameOverride(NULL), mInstrumentationPackageNameOverride(NULL),
          mIsOverlayPackage(false),
          mAutoAddOverlay(false), mGenDependencies(false),
          mAssetSourceDir(NULL), 
          mCrunchedOutputDir(NULL), mProguardFile(NULL),
@@ -96,8 +95,6 @@ public:
    void setManifestPackageNameOverride(const char * val) { mManifestPackageNameOverride = val; }
    const char* getInstrumentationPackageNameOverride() const { return mInstrumentationPackageNameOverride; }
    void setInstrumentationPackageNameOverride(const char * val) { mInstrumentationPackageNameOverride = val; }
    bool getIsOverlayPackage() const { return mIsOverlayPackage; }
    void setIsOverlayPackage(bool val) { mIsOverlayPackage = val; }
    bool getAutoAddOverlay() { return mAutoAddOverlay; }
    void setAutoAddOverlay(bool val) { mAutoAddOverlay = val; }
    bool getGenDependencies() { return mGenDependencies; }
@@ -235,7 +232,6 @@ private:
    const char* mOutputAPKFile;
    const char* mManifestPackageNameOverride;
    const char* mInstrumentationPackageNameOverride;
    bool        mIsOverlayPackage;
    bool        mAutoAddOverlay;
    bool        mGenDependencies;
    const char* mAssetSourceDir;
+0 −5
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ void usage(void)
        "        [-F apk-file] [-J R-file-dir] \\\n"
        "        [--product product1,product2,...] \\\n"
        "        [-c CONFIGS] [--preferred-configurations CONFIGS] \\\n"
        "        [-o] \\\n"
        "        [raw-files-dir [raw-files-dir] ...]\n"
        "\n"
        "   Package the android resources.  It will read assets and resources that are\n"
@@ -110,7 +109,6 @@ void usage(void)
        "   -j  specify a jar or zip file containing classes to include\n"
        "   -k  junk path of file(s) added\n"
        "   -m  make package directories under location specified by -J\n"
        "   -o  create overlay package (ie only resources; expects <overlay-package> in manifest)\n"
#if 0
        "   -p  pseudolocalize the default configuration\n"
#endif
@@ -292,9 +290,6 @@ int main(int argc, char* const argv[])
            case 'm':
                bundle.setMakePackageDirs(true);
                break;
            case 'o':
                bundle.setIsOverlayPackage(true);
                break;
#if 0
            case 'p':
                bundle.setPseudolocalize(true);
+1 −3
Original line number Diff line number Diff line
@@ -3609,9 +3609,7 @@ sp<ResourceTable::Package> ResourceTable::getPackage(const String16& package)
{
    sp<Package> p = mPackages.valueFor(package);
    if (p == NULL) {
        if (mBundle->getIsOverlayPackage()) {
            p = new Package(package, 0x00);
        } else if (mIsAppPackage) {
        if (mIsAppPackage) {
            if (mHaveAppPackage) {
                fprintf(stderr, "Adding multiple application package resources; only one is allowed.\n"
                                "Use -x to create extended resources.\n");