diff options
author | Yuichi Araki <yaraki@google.com> | 2017-01-18 20:42:17 +0900 |
---|---|---|
committer | Yuichi Araki <yaraki@google.com> | 2017-01-24 14:59:51 +0900 |
commit | 4d35cca96ce55eb29d1948086214f91ae94e9adb (patch) | |
tree | 2ddb5bd63163bf8806be9dc4773e66630b5c4712 /tools/aapt/ResourceTable.cpp | |
parent | 9727f22fc092fe7ccdbf2929d697126f2095d62e (diff) |
AAPT: Add --no-version-transitions flag
Add a new flag to disable versioning of Transition related XMLs.
Transition support library will use this to handle these XMLs on older
API levels.
Test: make libaapt_tests AaptTestAppOne
Bug: 34427868
Change-Id: I66e81cca049e71ef6704177b2ca21c9cdeaff78f
Diffstat (limited to 'tools/aapt/ResourceTable.cpp')
-rw-r--r-- | tools/aapt/ResourceTable.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index 661409e3d4bc..63498f7cef08 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -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]; |