X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/d81652a8a555152c6524211dd1c34ea59d5d9181..7ae4e725c7a3a2fd92f3389184c93e87778f9477:/AaptAssets.h diff --git a/AaptAssets.h b/AaptAssets.h index c5a397c..5cfa913 100644 --- a/AaptAssets.h +++ b/AaptAssets.h @@ -7,14 +7,14 @@ #define __AAPT_ASSETS_H #include -#include +#include +#include #include -#include -#include +#include #include #include +#include #include -#include #include "ZipFile.h" #include "Bundle.h" @@ -22,6 +22,10 @@ using namespace android; + +extern const char * const gDefaultIgnoreAssets; +extern const char * gUserIgnoreAssets; + bool valid_symbol_name(const String8& str); class AaptAssets; @@ -47,6 +51,7 @@ enum { AXIS_SMALLESTSCREENWIDTHDP, AXIS_SCREENWIDTHDP, AXIS_SCREENHEIGHTDP, + AXIS_LAYOUTDIR, AXIS_VERSION, AXIS_START = AXIS_MCC, @@ -91,6 +96,7 @@ public: static bool getSmallestScreenWidthDpName(const char* name, ResTable_config* out = NULL); static bool getScreenWidthDpName(const char* name, ResTable_config* out = NULL); static bool getScreenHeightDpName(const char* name, ResTable_config* out = NULL); + static bool getLayoutDirectionName(const char* name, ResTable_config* out = NULL); static bool getVersionName(const char* name, ResTable_config* out = NULL); int compare(const AaptGroupEntry& o) const; @@ -129,6 +135,7 @@ private: String8 navHidden; String8 navigation; String8 screenSize; + String8 layoutDirection; String8 version; mutable bool mParamsChanged; @@ -315,16 +322,16 @@ class AaptSymbolEntry { public: AaptSymbolEntry() - : isPublic(false), typeCode(TYPE_UNKNOWN) + : isPublic(false), isJavaSymbol(false), typeCode(TYPE_UNKNOWN) { } AaptSymbolEntry(const String8& _name) - : name(_name), isPublic(false), typeCode(TYPE_UNKNOWN) + : name(_name), isPublic(false), isJavaSymbol(false), typeCode(TYPE_UNKNOWN) { } AaptSymbolEntry(const AaptSymbolEntry& o) : name(o.name), sourcePos(o.sourcePos), isPublic(o.isPublic) - , comment(o.comment), typeComment(o.typeComment) + , isJavaSymbol(o.isJavaSymbol), comment(o.comment), typeComment(o.typeComment) , typeCode(o.typeCode), int32Val(o.int32Val), stringVal(o.stringVal) { } @@ -332,6 +339,7 @@ public: { sourcePos = o.sourcePos; isPublic = o.isPublic; + isJavaSymbol = o.isJavaSymbol; comment = o.comment; typeComment = o.typeComment; typeCode = o.typeCode; @@ -344,6 +352,7 @@ public: SourcePos sourcePos; bool isPublic; + bool isJavaSymbol; String16 comment; String16 typeComment; @@ -401,6 +410,15 @@ public: return NO_ERROR; } + status_t makeSymbolJavaSymbol(const String8& name, const SourcePos& pos) { + if (!check_valid_symbol_name(name, pos, "symbol")) { + return BAD_VALUE; + } + AaptSymbolEntry& sym = edit_symbol(name, &pos); + sym.isJavaSymbol = true; + return NO_ERROR; + } + void appendComment(const String8& name, const String16& comment, const SourcePos& pos) { if (comment.size() <= 0) { return; @@ -441,6 +459,8 @@ public: return sym; } + status_t applyJavaSymbols(const sp& javaSymbols); + const KeyedVector& getSymbols() const { return mSymbols; } const DefaultKeyedVector >& getNestedSymbols() const @@ -509,7 +529,11 @@ public: virtual ~AaptAssets() { delete mRes; } const String8& getPackage() const { return mPackage; } - void setPackage(const String8& package) { mPackage = package; mSymbolsPrivatePackage = package; } + void setPackage(const String8& package) { + mPackage = package; + mSymbolsPrivatePackage = package; + mHavePrivateSymbols = false; + } const SortedVector& getGroupEntries() const; @@ -532,11 +556,22 @@ public: sp getSymbolsFor(const String8& name); + sp getJavaSymbolsFor(const String8& name); + + status_t applyJavaSymbols(); + const DefaultKeyedVector >& getSymbols() const { return mSymbols; } String8 getSymbolsPrivatePackage() const { return mSymbolsPrivatePackage; } - void setSymbolsPrivatePackage(const String8& pkg) { mSymbolsPrivatePackage = pkg; } - + void setSymbolsPrivatePackage(const String8& pkg) { + mSymbolsPrivatePackage = pkg; + mHavePrivateSymbols = mSymbolsPrivatePackage != mPackage; + } + + bool havePrivateSymbols() const { return mHavePrivateSymbols; } + + bool isJavaSymbol(const AaptSymbolEntry& sym, bool includePrivate) const; + status_t buildIncludedResources(Bundle* bundle); status_t addIncludedResources(const sp& file); const ResTable& getIncludedResources() const; @@ -576,7 +611,9 @@ private: String8 mPackage; SortedVector mGroupEntries; DefaultKeyedVector > mSymbols; + DefaultKeyedVector > mJavaSymbols; String8 mSymbolsPrivatePackage; + bool mHavePrivateSymbols; Vector > mResDirs;