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

Commit b0865576 authored by Yuichi Araki's avatar Yuichi Araki Committed by Android (Google) Code Review
Browse files

Merge "AAPT: Add --no-version-transitions flag"

parents f32d909d 4d35cca9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ public:
          mCompressionMethod(0), mJunkPath(false), mOutputAPKFile(NULL),
          mManifestPackageNameOverride(NULL), mInstrumentationPackageNameOverride(NULL),
          mAutoAddOverlay(false), mGenDependencies(false), mNoVersionVectors(false),
          mNoVersionTransitions(false),
          mCrunchedOutputDir(NULL), mProguardFile(NULL), mMainDexProguardFile(NULL),
          mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
          mRClassDir(NULL), mResourceIntermediatesDir(NULL), mManifestMinSdkVersion(NULL),
@@ -219,6 +220,8 @@ public:
    void setBuildAppAsSharedLibrary(bool val) { mBuildAppAsSharedLibrary = val; }
    void setNoVersionVectors(bool val) { mNoVersionVectors = val; }
    bool getNoVersionVectors() const { return mNoVersionVectors; }
    void setNoVersionTransitions(bool val) { mNoVersionTransitions = val; }
    bool getNoVersionTransitions() const { return mNoVersionTransitions; }

    /*
     * Set and get the file specification.
@@ -299,6 +302,7 @@ private:
    bool        mAutoAddOverlay;
    bool        mGenDependencies;
    bool        mNoVersionVectors;
    bool        mNoVersionTransitions;
    const char* mCrunchedOutputDir;
    const char* mProguardFile;
    const char* mMainDexProguardFile;
+4 −0
Original line number Diff line number Diff line
@@ -223,6 +223,8 @@ void usage(void)
        "       localization\n"
        "   --no-version-vectors\n"
        "       Do not automatically generate versioned copies of vector XML resources.\n"
        "   --no-version-transitions\n"
        "       Do not automatically generate versioned copies of transition XML resources.\n"
        "   --private-symbols\n"
        "       Java package name to use when generating R.java for private resources.\n",
        gDefaultIgnoreAssets);
@@ -704,6 +706,8 @@ int main(int argc, char* const argv[])
                    bundle.setPseudolocalize(PSEUDO_ACCENTED | PSEUDO_BIDI);
                } else if (strcmp(cp, "-no-version-vectors") == 0) {
                    bundle.setNoVersionVectors(true);
                } else if (strcmp(cp, "-no-version-transitions") == 0) {
                    bundle.setNoVersionTransitions(true);
                } else if (strcmp(cp, "-private-symbols") == 0) {
                    argc--;
                    argv++;
+31 −0
Original line number Diff line number Diff line
@@ -4730,6 +4730,32 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle) {
    return NO_ERROR;
}

const String16 kTransitionElements[] = {
    String16("fade"),
    String16("changeBounds"),
    String16("slide"),
    String16("explode"),
    String16("changeImageTransform"),
    String16("changeTransform"),
    String16("changeClipBounds"),
    String16("autoTransition"),
    String16("recolor"),
    String16("changeScroll"),
    String16("transitionSet"),
    String16("transition"),
    String16("transitionManager"),
};

static bool IsTransitionElement(const String16& name) {
    for (int i = 0, size = sizeof(kTransitionElements) / sizeof(kTransitionElements[0]);
         i < size; ++i) {
        if (name == kTransitionElements[i]) {
            return true;
        }
    }
    return false;
}

status_t ResourceTable::modifyForCompat(const Bundle* bundle,
                                        const String16& resourceName,
                                        const sp<AaptFile>& target,
@@ -4766,6 +4792,11 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle,
            continue;
        }

        if (bundle->getNoVersionTransitions() && (IsTransitionElement(node->getElementName()))) {
            // We were told not to version transition tags, so skip the children here.
            continue;
        }

        const Vector<XMLNode::attribute_entry>& attrs = node->getAttributes();
        for (size_t i = 0; i < attrs.size(); i++) {
            const XMLNode::attribute_entry& attr = attrs[i];
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ namespace aapt {
static const char* sMajorVersion = "2";

// Update minor version whenever a feature or flag is added.
static const char* sMinorVersion = "4";
static const char* sMinorVersion = "5";

int PrintVersion() {
  std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "."
+1 −1
Original line number Diff line number Diff line
@@ -24,5 +24,5 @@ LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_STATIC_ANDROID_LIBRARIES := \
    AaptTestStaticLibOne \
    AaptTestStaticLibTwo
LOCAL_AAPT_FLAGS := --no-version-vectors
LOCAL_AAPT_FLAGS := --no-version-vectors --no-version-transitions
include $(BUILD_PACKAGE)
Loading