diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-08-07 21:26:53 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-08-14 19:29:47 +0000 |
commit | 6240840387335632fdc92d5d168f924e2f414dda (patch) | |
tree | c6e61afb94092c457c16c1c2c31b8cbb7277e4bf | |
parent | d7c1fae12ef0b31c225ef130e6b06445b5af53a9 (diff) | |
download | frameworks_base-6240840387335632fdc92d5d168f924e2f414dda.zip frameworks_base-6240840387335632fdc92d5d168f924e2f414dda.tar.gz frameworks_base-6240840387335632fdc92d5d168f924e2f414dda.tar.bz2 |
Ensure that split names are valid
Generate valid split names for resource splits.
Validate split names for features.
Change-Id: I3040438af0156778c2bd66ddeffdf62fe9dcc9fc
-rw-r--r-- | tools/aapt/ApkBuilder.cpp | 13 | ||||
-rw-r--r-- | tools/aapt/ApkBuilder.h | 5 | ||||
-rw-r--r-- | tools/aapt/Resource.cpp | 4 |
3 files changed, 20 insertions, 2 deletions
diff --git a/tools/aapt/ApkBuilder.cpp b/tools/aapt/ApkBuilder.cpp index 12f6040..01e02e2 100644 --- a/tools/aapt/ApkBuilder.cpp +++ b/tools/aapt/ApkBuilder.cpp @@ -85,11 +85,24 @@ ApkSplit::ApkSplit(const std::set<ConfigDescription>& configs, const sp<Resource if (mName.size() > 0) { mName.append(","); mDirName.append("_"); + mPackageSafeName.append("."); } String8 configStr = iter->toString(); + String8 packageConfigStr(configStr); + size_t len = packageConfigStr.length(); + if (len > 0) { + char* buf = packageConfigStr.lockBuffer(len); + for (char* end = buf + len; buf < end; ++buf) { + if (*buf == '-') { + *buf = '_'; + } + } + packageConfigStr.unlockBuffer(len); + } mName.append(configStr); mDirName.append(configStr); + mPackageSafeName.append(packageConfigStr); } } diff --git a/tools/aapt/ApkBuilder.h b/tools/aapt/ApkBuilder.h index db23c84..0d7f06b 100644 --- a/tools/aapt/ApkBuilder.h +++ b/tools/aapt/ApkBuilder.h @@ -95,6 +95,10 @@ public: return mDirName; } + const android::String8& getPackageSafeName() const { + return mPackageSafeName; + } + bool isBase() const { return mIsBase; } @@ -111,6 +115,7 @@ private: const bool mIsBase; String8 mName; String8 mDirName; + String8 mPackageSafeName; std::set<OutputEntry> mFiles; }; diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 2401b3a..010d59b 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -937,8 +937,8 @@ status_t generateAndroidManifestForSplit(Bundle* bundle, const sp<AaptAssets>& a } // Add the 'split' attribute which describes the configurations included. - String8 splitName("config_"); - splitName.append(split->getDirectorySafeName()); + String8 splitName("config."); + splitName.append(split->getPackageSafeName()); manifest->addAttribute(String16(), String16("split"), String16(splitName)); // Build an empty <application> tag (required). |