X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/9c885e91ecbae47dcae47f71fa0eea7e50793e22..483bf9fcbadc82d390fe91ebf23cd9bf898940a5:/AaptAssets.h diff --git a/AaptAssets.h b/AaptAssets.h index 2ef0347..82dfd71 100644 --- a/AaptAssets.h +++ b/AaptAssets.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include "ZipFile.h" #include "Bundle.h" #include "SourcePos.h" @@ -30,16 +30,34 @@ enum { AXIS_MNC, AXIS_LANGUAGE, AXIS_REGION, + AXIS_SCREENLAYOUTSIZE, + AXIS_SCREENLAYOUTLONG, AXIS_ORIENTATION, + AXIS_UIMODETYPE, + AXIS_UIMODENIGHT, AXIS_DENSITY, AXIS_TOUCHSCREEN, AXIS_KEYSHIDDEN, AXIS_KEYBOARD, + AXIS_NAVHIDDEN, AXIS_NAVIGATION, AXIS_SCREENSIZE, + AXIS_SMALLESTSCREENWIDTHDP, + AXIS_SCREENWIDTHDP, + AXIS_SCREENHEIGHTDP, AXIS_VERSION }; +enum { + SDK_CUPCAKE = 3, + SDK_DONUT = 4, + SDK_ECLAIR = 5, + SDK_ECLAIR_0_1 = 6, + SDK_MR1 = 7, + SDK_FROYO = 8, + SDK_HONEYCOMB_MR2 = 13, +}; + /** * This structure contains a specific variation of a single file out * of all the variations it can have that we can have. @@ -55,11 +73,19 @@ public: String8 mnc; String8 locale; String8 vendor; + String8 smallestScreenWidthDp; + String8 screenWidthDp; + String8 screenHeightDp; + String8 screenLayoutSize; + String8 screenLayoutLong; String8 orientation; + String8 uiModeType; + String8 uiModeNight; String8 density; String8 touchscreen; String8 keysHidden; String8 keyboard; + String8 navHidden; String8 navigation; String8 screenSize; String8 version; @@ -71,13 +97,21 @@ public: static bool getMccName(const char* name, ResTable_config* out = NULL); static bool getMncName(const char* name, ResTable_config* out = NULL); static bool getLocaleName(const char* name, ResTable_config* out = NULL); + static bool getScreenLayoutSizeName(const char* name, ResTable_config* out = NULL); + static bool getScreenLayoutLongName(const char* name, ResTable_config* out = NULL); static bool getOrientationName(const char* name, ResTable_config* out = NULL); + static bool getUiModeTypeName(const char* name, ResTable_config* out = NULL); + static bool getUiModeNightName(const char* name, ResTable_config* out = NULL); static bool getDensityName(const char* name, ResTable_config* out = NULL); static bool getTouchscreenName(const char* name, ResTable_config* out = NULL); static bool getKeysHiddenName(const char* name, ResTable_config* out = NULL); static bool getKeyboardName(const char* name, ResTable_config* out = NULL); static bool getNavigationName(const char* name, ResTable_config* out = NULL); + static bool getNavHiddenName(const char* name, ResTable_config* out = NULL); static bool getScreenSizeName(const char* name, ResTable_config* out = NULL); + 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 getVersionName(const char* name, ResTable_config* out = NULL); int compare(const AaptGroupEntry& o) const; @@ -106,6 +140,7 @@ inline int strictly_order_type(const AaptGroupEntry& lhs, const AaptGroupEntry& } class AaptGroup; +class FilePathStore; /** * A single asset file we know about. @@ -235,7 +270,8 @@ public: virtual ssize_t slurpFullTree(Bundle* bundle, const String8& srcDir, const AaptGroupEntry& kind, - const String8& resType); + const String8& resType, + sp& fullResPaths); /* * Perform some sanity checks on the names of files and directories here. @@ -450,6 +486,14 @@ public: ResourceTypeSet(); }; +// Storage for lists of fully qualified paths for +// resources encountered during slurping. +class FilePathStore : public RefBase, + public Vector +{ +public: + FilePathStore(); +}; /** * Asset hierarchy being operated on. @@ -476,12 +520,15 @@ public: const sp& file, const String8& resType); + void addGroupEntry(const AaptGroupEntry& entry) { mGroupEntries.add(entry); } + ssize_t slurpFromArgs(Bundle* bundle); virtual ssize_t slurpFullTree(Bundle* bundle, const String8& srcDir, const AaptGroupEntry& kind, - const String8& resType); + const String8& resType, + sp& fullResPaths); ssize_t slurpResourceTree(Bundle* bundle, const String8& srcDir); ssize_t slurpResourceZip(Bundle* bundle, const char* filename); @@ -500,6 +547,7 @@ public: void print() const; inline const Vector >& resDirs() { return mDirs; } + sp resDir(const String8& name); inline sp getOverlay() { return mOverlay; } inline void setOverlay(sp& overlay) { mOverlay = overlay; } @@ -508,6 +556,14 @@ public: inline void setResources(KeyedVector >* res) { delete mRes; mRes = res; } + inline sp& getFullResPaths() { return mFullResPaths; } + inline void + setFullResPaths(sp& res) { mFullResPaths = res; } + + inline sp& getFullAssetPaths() { return mFullAssetPaths; } + inline void + setFullAssetPaths(sp& res) { mFullAssetPaths = res; } + private: String8 mPackage; SortedVector mGroupEntries; @@ -521,6 +577,9 @@ private: sp mOverlay; KeyedVector >* mRes; + + sp mFullResPaths; + sp mFullAssetPaths; }; #endif // __AAPT_ASSETS_H