diff options
author | MÃ¥rten Kongstad <marten.kongstad@sonyericsson.com> | 2011-03-17 14:13:41 +0100 |
---|---|---|
committer | Kenneth Andersson <kenneth.andersson@sonyericsson.com> | 2011-04-01 14:12:10 +0200 |
commit | 57f4b77c89bafedf9468f9a636561c0c193405c9 (patch) | |
tree | 9e73065411411858c9c6ae350c5ee8ffe14598c3 /include | |
parent | c6b22e2727bd3730edd5ad72831a9bb4670d00f3 (diff) | |
download | frameworks_base-57f4b77c89bafedf9468f9a636561c0c193405c9.zip frameworks_base-57f4b77c89bafedf9468f9a636561c0c193405c9.tar.gz frameworks_base-57f4b77c89bafedf9468f9a636561c0c193405c9.tar.bz2 |
Runtime resource overlay, iteration 1.
Runtime resource overlay allows unmodified applications to appear
as if they had been compiled with additional resources defined. See
libs/utils/README for more information.
This commit is the first iteration of runtime resource overlay. It
provides the actual overlay modifications and loading of trusted overlay
packages (ie residing in /vendor) targeting framework-res.apk.
This commit loads exactly one overlay package. The overlay,
if present, must target framework-res.apk and be located at
/vendor/overlay/framework/framework-res.apk.
Change-Id: If26ee7754813004a96c043dba37fbe99fa3919db
Diffstat (limited to 'include')
-rw-r--r-- | include/utils/AssetManager.h | 11 | ||||
-rw-r--r-- | include/utils/ResourceTypes.h | 26 |
2 files changed, 33 insertions, 4 deletions
diff --git a/include/utils/AssetManager.h b/include/utils/AssetManager.h index 9e2bf37..a8c7ddb 100644 --- a/include/utils/AssetManager.h +++ b/include/utils/AssetManager.h @@ -222,6 +222,7 @@ private: { String8 path; FileType type; + String8 idmap; }; Asset* openInPathLocked(const char* fileName, AccessMode mode, @@ -262,6 +263,16 @@ private: void setLocaleLocked(const char* locale); void updateResourceParamsLocked() const; + bool createIdmapFileLocked(const String8& originalPath, const String8& overlayPath, + const String8& idmapPath); + + bool isIdmapStaleLocked(const String8& originalPath, const String8& overlayPath, + const String8& idmapPath); + + Asset* openIdmapLocked(const struct asset_path& ap) const; + + bool getZipEntryCrcLocked(const String8& zipPath, const char* entryFilename, uint32_t* pCrc); + class SharedZip : public RefBase { public: static sp<SharedZip> get(const String8& path); diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index ab7b973..10baa11 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -1735,9 +1735,9 @@ public: ~ResTable(); status_t add(const void* data, size_t size, void* cookie, - bool copyData=false); + bool copyData=false, const void* idmap = NULL); status_t add(Asset* asset, void* cookie, - bool copyData=false); + bool copyData=false, const void* idmap = NULL); status_t add(ResTable* src); status_t getError() const; @@ -1981,6 +1981,24 @@ public: void getLocales(Vector<String8>* locales) const; + // Generate an idmap. + // + // 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, + void** outData, size_t* outSize) const; + + enum { + IDMAP_HEADER_SIZE_BYTES = 3 * sizeof(uint32_t), + }; + // Retrieve idmap meta-data. + // + // 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); + #ifndef HAVE_ANDROID_OS void print(bool inclValues) const; static String8 normalizeForOutput(const char* input); @@ -1994,7 +2012,7 @@ private: struct bag_set; status_t add(const void* data, size_t size, void* cookie, - Asset* asset, bool copyData); + Asset* asset, bool copyData, const Asset* idmap); ssize_t getResourcePackageIndex(uint32_t resID) const; ssize_t getEntry( @@ -2003,7 +2021,7 @@ private: const ResTable_type** outType, const ResTable_entry** outEntry, const Type** outTypeClass) const; status_t parsePackage( - const ResTable_package* const pkg, const Header* const header); + const ResTable_package* const pkg, const Header* const header, uint32_t idmap_id); void print_value(const Package* pkg, const Res_value& value) const; |