X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/1eb15b505ba1d7ea5a18363c4b7b137f2e9f6d01..d9b0ea9f5bc75180ed375bf5d9542328e2e32db2:/Bundle.h?ds=sidebyside diff --git a/Bundle.h b/Bundle.h index 4737f84..c53f7f1 100644 --- a/Bundle.h +++ b/Bundle.h @@ -37,7 +37,7 @@ public: mForce(false), mGrayscaleTolerance(0), mMakePackageDirs(false), mUpdate(false), mExtending(false), mRequireLocalization(false), mPseudolocalize(false), - mUTF8(false), mValues(false), + mUTF8(false), mEncodingSpecified(false), mValues(false), mCompressionMethod(0), mOutputAPKFile(NULL), mAssetSourceDir(NULL), mProguardFile(NULL), mAndroidManifestFile(NULL), mPublicOutputFile(NULL), @@ -78,6 +78,8 @@ public: void setPseudolocalize(bool val) { mPseudolocalize = val; } bool getUTF8(void) const { return mUTF8; } void setUTF8(bool val) { mUTF8 = val; } + bool getEncodingSpecified(void) const { return mEncodingSpecified; } + void setEncodingSpecified(bool val) { mEncodingSpecified = val; } bool getValues(void) const { return mValues; } void setValues(bool val) { mValues = val; } int getCompressionMethod(void) const { return mCompressionMethod; } @@ -114,7 +116,12 @@ 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; + if (!mEncodingSpecified) { + setUTF8(isUTF8Available()); + } + } const char* getTargetSdkVersion() const { return mTargetSdkVersion; } void setTargetSdkVersion(const char* val) { mTargetSdkVersion = val; } const char* getMaxSdkVersion() const { return mMaxSdkVersion; } @@ -166,6 +173,7 @@ private: bool mRequireLocalization; bool mPseudolocalize; bool mUTF8; + bool mEncodingSpecified; bool mValues; int mCompressionMethod; bool mJunkPath; @@ -197,6 +205,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