summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/androidfw/AssetManager.h8
-rw-r--r--include/androidfw/ResourceTypes.h38
2 files changed, 37 insertions, 9 deletions
diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h
index a010957..e0c6183 100644
--- a/include/androidfw/AssetManager.h
+++ b/include/androidfw/AssetManager.h
@@ -69,6 +69,7 @@ struct ResTable_config;
*/
class AssetManager : public AAssetManager {
public:
+ static const char* RESOURCES_FILENAME;
typedef enum CacheMode {
CACHE_UNKNOWN = 0,
CACHE_OFF, // don't try to cache file locations
@@ -218,6 +219,13 @@ public:
*/
void getLocales(Vector<String8>* locales) const;
+ /**
+ * Generate idmap data to translate resources IDs between a package and a
+ * corresponding overlay package.
+ */
+ bool createIdmap(const char* targetApkPath, const char* overlayApkPath,
+ uint32_t targetCrc, uint32_t overlayCrc, uint32_t** outData, uint32_t* outSize);
+
private:
struct asset_path
{
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
index 5151b06..7779f7f 100644
--- a/include/androidfw/ResourceTypes.h
+++ b/include/androidfw/ResourceTypes.h
@@ -1279,14 +1279,13 @@ class ResTable
{
public:
ResTable();
- ResTable(const void* data, size_t size, void* cookie,
+ ResTable(const void* data, size_t size, const int32_t cookie,
bool copyData=false);
~ResTable();
- status_t add(const void* data, size_t size, void* cookie,
- bool copyData=false, const void* idmap = NULL);
- status_t add(Asset* asset, void* cookie,
- bool copyData=false, const void* idmap = NULL);
+ status_t add(Asset* asset, const int32_t cookie, bool copyData,
+ const void* idmap);
+ status_t add(const void *data, size_t size);
status_t add(ResTable* src);
status_t getError() const;
@@ -1534,7 +1533,7 @@ public:
// but not the names their entries or types.
const ResStringPool* getTableStringBlock(size_t index) const;
// Return unique cookie identifier for the given resource table.
- void* getTableCookie(size_t index) const;
+ int32_t getTableCookie(size_t index) const;
// Return the configurations (ResTable_config) that we know about
void getConfigurations(Vector<ResTable_config>* configs) const;
@@ -1546,9 +1545,19 @@ public:
// Return value: on success: NO_ERROR; caller is responsible for free-ing
// outData (using free(3)). On failure, any status_t value other than
// NO_ERROR; the caller should not free outData.
- status_t createIdmap(const ResTable& overlay, uint32_t originalCrc, uint32_t overlayCrc,
+ status_t createIdmap(const ResTable& overlay, uint32_t targetCrc, uint32_t overlayCrc,
void** outData, size_t* outSize) const;
+ status_t createIdmap(const ResTable& overlay,
+ uint32_t targetCrc, uint32_t overlayCrc,
+ const char* targetPath, const char* overlayPath,
+ void** outData, uint32_t* outSize) const
+ {
+ (void)targetPath;
+ (void)overlayPath;
+ return createIdmap(overlay, targetCrc, overlayCrc, outData, outSize);
+ }
+
enum {
IDMAP_HEADER_SIZE_BYTES = 3 * sizeof(uint32_t),
};
@@ -1557,7 +1566,18 @@ public:
// This function only requires the idmap header (the first
// IDMAP_HEADER_SIZE_BYTES) bytes of an idmap file.
static bool getIdmapInfo(const void* idmap, size_t size,
- uint32_t* pOriginalCrc, uint32_t* pOverlayCrc);
+ uint32_t* pTargetCrc, uint32_t* pOverlayCrc);
+
+ static bool getIdmapInfo(const void* idmap, size_t size,
+ uint32_t* pTargetCrc, uint32_t* pOverlayCrc,
+ String8* pTargetPath, String8* pOverlayPath)
+ {
+ if (*pTargetPath)
+ *pTargetPath = String8();
+ if (*pOverlayPath)
+ *pOverlayPath = String8();
+ return getIdmapInfo(idmap, size, pTargetCrc, pOverlayCrc);
+ }
void print(bool inclValues) const;
static String8 normalizeForOutput(const char* input);
@@ -1569,7 +1589,7 @@ private:
struct PackageGroup;
struct bag_set;
- status_t add(const void* data, size_t size, void* cookie,
+ status_t addInternal(const void* data, size_t size, const int32_t cookie,
Asset* asset, bool copyData, const Asset* idmap);
ssize_t getResourcePackageIndex(uint32_t resID) const;