diff options
| author | 2017-12-06 11:51:59 -0800 | |
|---|---|---|
| committer | 2017-12-06 14:24:49 -0800 | |
| commit | 5364be50cd0431c3b323fd8a3725df5146d01e99 (patch) | |
| tree | 379823ce960e903a2ba0313591c947ee2d595cf7 /tools/aapt2/ResourceTable.cpp | |
| parent | 8ab47567b2140da30257bc4e3b70495c8f17281e (diff) | |
| parent | 592f539419226f5d8652c434b34885b93fda0f8d (diff) | |
DO NOT MERGE: Merge Oreo MR1 into master
Exempt-From-Owner-Approval: Changes already landed internally
Change-Id: I727a014df2fb05a4b13cb67b1fcb760a8b387523
Diffstat (limited to 'tools/aapt2/ResourceTable.cpp')
| -rw-r--r-- | tools/aapt2/ResourceTable.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp index 168004f0b721..ab59560d33a3 100644 --- a/tools/aapt2/ResourceTable.cpp +++ b/tools/aapt2/ResourceTable.cpp @@ -15,20 +15,24 @@ */ #include "ResourceTable.h" -#include "ConfigDescription.h" -#include "NameMangler.h" -#include "ResourceValues.h" -#include "ValueVisitor.h" -#include "util/Util.h" -#include <android-base/logging.h> -#include <androidfw/ResourceTypes.h> #include <algorithm> #include <memory> #include <string> #include <tuple> -using android::StringPiece; +#include "android-base/logging.h" +#include "androidfw/ResourceTypes.h" + +#include "ConfigDescription.h" +#include "NameMangler.h" +#include "ResourceValues.h" +#include "ValueVisitor.h" +#include "text/Unicode.h" +#include "util/Util.h" + +using ::aapt::text::IsValidResourceEntryName; +using ::android::StringPiece; namespace aapt { @@ -283,12 +287,9 @@ ResourceTable::CollisionResult ResourceTable::ResolveValueCollision(Value* exist return CollisionResult::kConflict; } -static constexpr const char* kValidNameChars = "._-"; - static StringPiece ValidateName(const StringPiece& name) { - auto iter = util::FindNonAlphaNumericAndNotInSet(name, kValidNameChars); - if (iter != name.end()) { - return StringPiece(iter, 1); + if (!IsValidResourceEntryName(name)) { + return name; } return {}; } |