From 40e8eefbedcafc51948945647d746daaee092f16 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Tue, 16 Sep 2014 14:43:29 -0700 Subject: First commit of split-select tool This tool emits a set of rules as JSON for when a Split APK should match a target device. Change-Id: I8bfbdfbdb51efcfc645889dd03e1961f16e39645 --- tools/aapt/AaptAssets.cpp | 5 +++-- tools/aapt/AaptAssets.h | 3 ++- tools/aapt/ConfigDescription.h | 3 +++ tools/aapt/ResourceIdCache.cpp | 6 ++---- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'tools/aapt') diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp index 117fc2435076..b7f64f63fdbc 100644 --- a/tools/aapt/AaptAssets.cpp +++ b/tools/aapt/AaptAssets.cpp @@ -1141,9 +1141,10 @@ bail: ssize_t AaptAssets::slurpFullTree(Bundle* bundle, const String8& srcDir, const AaptGroupEntry& kind, const String8& resType, - sp& fullResPaths) + sp& fullResPaths, + const bool overwrite) { - ssize_t res = AaptDir::slurpFullTree(bundle, srcDir, kind, resType, fullResPaths); + ssize_t res = AaptDir::slurpFullTree(bundle, srcDir, kind, resType, fullResPaths, overwrite); if (res > 0) { mGroupEntries.add(kind); } diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h index d809c5b3003c..7ae5368d80bd 100644 --- a/tools/aapt/AaptAssets.h +++ b/tools/aapt/AaptAssets.h @@ -591,7 +591,8 @@ private: const String8& srcDir, const AaptGroupEntry& kind, const String8& resType, - sp& fullResPaths); + sp& fullResPaths, + const bool overwrite=false); ssize_t slurpResourceTree(Bundle* bundle, const String8& srcDir); ssize_t slurpResourceZip(Bundle* bundle, const char* filename); diff --git a/tools/aapt/ConfigDescription.h b/tools/aapt/ConfigDescription.h index 779c423fce1a..4f999a2ff0c6 100644 --- a/tools/aapt/ConfigDescription.h +++ b/tools/aapt/ConfigDescription.h @@ -28,10 +28,12 @@ struct ConfigDescription : public android::ResTable_config { memset(this, 0, sizeof(*this)); size = sizeof(android::ResTable_config); } + ConfigDescription(const android::ResTable_config&o) { *static_cast(this) = o; size = sizeof(android::ResTable_config); } + ConfigDescription(const ConfigDescription&o) { *static_cast(this) = o; } @@ -41,6 +43,7 @@ struct ConfigDescription : public android::ResTable_config { size = sizeof(android::ResTable_config); return *this; } + ConfigDescription& operator=(const ConfigDescription& o) { *static_cast(this) = o; return *this; diff --git a/tools/aapt/ResourceIdCache.cpp b/tools/aapt/ResourceIdCache.cpp index d60a07fc243b..8835fb0130a3 100644 --- a/tools/aapt/ResourceIdCache.cpp +++ b/tools/aapt/ResourceIdCache.cpp @@ -9,8 +9,6 @@ #include #include "ResourceIdCache.h" #include -using namespace std; - static size_t mHits = 0; static size_t mMisses = 0; @@ -29,7 +27,7 @@ struct CacheEntry { CacheEntry(const android::String16& name, uint32_t resId) : hashedName(name), id(resId) { } }; -static map< uint32_t, CacheEntry > mIdMap; +static std::map< uint32_t, CacheEntry > mIdMap; // djb2; reasonable choice for strings when collisions aren't particularly important @@ -63,7 +61,7 @@ uint32_t ResourceIdCache::lookup(const android::String16& package, bool onlyPublic) { const String16 hashedName = makeHashableName(package, type, name, onlyPublic); const uint32_t hashcode = hash(hashedName); - map::iterator item = mIdMap.find(hashcode); + std::map::iterator item = mIdMap.find(hashcode); if (item == mIdMap.end()) { // cache miss mMisses++; -- cgit v1.2.3-59-g8ed1b