diff options
author | Kenny Root <kroot@google.com> | 2009-12-10 13:52:53 -0800 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2009-12-10 20:17:33 -0800 |
commit | b5ef7ee1644b099498ddd29c1d051e7ee26ccfd3 (patch) | |
tree | 5097c3ed0a1c60a75c93ccac7c43ae4c720f8e68 /tools/aapt/Bundle.h | |
parent | 05bbeb356286bfb6ddc26ac546cce03334e346dd (diff) | |
download | frameworks_base-b5ef7ee1644b099498ddd29c1d051e7ee26ccfd3.zip frameworks_base-b5ef7ee1644b099498ddd29c1d051e7ee26ccfd3.tar.gz frameworks_base-b5ef7ee1644b099498ddd29c1d051e7ee26ccfd3.tar.bz2 |
Default to UTF8 resources when packaging with aapt
This change makes it so with API level 7 and above all resources will be
packaged in UTF-8 format. Any minSdkVersion level that is named will also
have resources packaged in UTF-8, because it is assumed that previous
releases will only be rebuilt with their proper integer number and only
future releases will temporarily have names.
Change-Id: If5d1ee5e48fbaf31798816b068ac44b14a93121b
Diffstat (limited to 'tools/aapt/Bundle.h')
-rw-r--r-- | tools/aapt/Bundle.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h index 4737f84..a2c6a12 100644 --- a/tools/aapt/Bundle.h +++ b/tools/aapt/Bundle.h @@ -114,7 +114,10 @@ public: void addNoCompressExtension(const char* ext) { mNoCompressExtensions.add(ext); } const char* getMinSdkVersion() const { return mMinSdkVersion; } - void setMinSdkVersion(const char* val) { mMinSdkVersion = val; } + void setMinSdkVersion(const char* val) { + mMinSdkVersion = val; + setUTF8(isUTF8Available()); + } const char* getTargetSdkVersion() const { return mTargetSdkVersion; } void setTargetSdkVersion(const char* val) { mTargetSdkVersion = val; } const char* getMaxSdkVersion() const { return mMaxSdkVersion; } @@ -197,6 +200,20 @@ private: /* misc stuff */ int mPackageCount; #endif + + /* UTF-8 is only available on APIs 7 or above or + * SDK levels that have code names. + */ + bool isUTF8Available() { + char *end; + int minSdkNum = (int)strtol(mMinSdkVersion, &end, 0); + if (*end == '\0') { + if (minSdkNum < 7) { + return false; + } + } + return true; + } }; #endif // __BUNDLE_H |