summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/androidfw/AssetManager.h35
-rw-r--r--include/androidfw/ResourceTypes.h24
2 files changed, 48 insertions, 11 deletions
diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h
index 0cfd2b1..9ba855f 100644
--- a/include/androidfw/AssetManager.h
+++ b/include/androidfw/AssetManager.h
@@ -75,6 +75,7 @@ public:
static const char* TARGET_PACKAGE_NAME;
static const char* TARGET_APK_PATH;
static const char* IDMAP_DIR;
+ static const char* APK_EXTENSION;
typedef enum CacheMode {
CACHE_UNKNOWN = 0,
@@ -100,7 +101,14 @@ public:
* newly-added asset source.
*/
bool addAssetPath(const String8& path, int32_t* cookie);
- bool addOverlayPath(const String8& path, int32_t* cookie);
+ bool addOverlayPath(const String8& path, int32_t* cookie,
+ const String8& resApkPath, const String8& targetPkgPath,
+ const String8& prefixPath);
+ bool addCommonOverlayPath(const String8& path, int32_t* cookie,
+ const String8& resApkPath, const String8& prefixPath);
+ bool addIconPath(const String8& path, int32_t* cookie,
+ const String8& resApkPath, const String8& prefixPath, uint32_t pkgIdOverride);
+ bool removeOverlayPath(const String8& path, int32_t cookie);
/*
* Convenience for adding the standard system assets. Uses the
@@ -231,21 +239,32 @@ public:
* corresponding overlay package.
*/
bool createIdmap(const char* targetApkPath, const char* overlayApkPath,
- uint32_t targetCrc, uint32_t overlayCrc, uint32_t** outData, size_t* outSize);
+ uint32_t targetCrc, uint32_t overlayCrc,
+ time_t targetMtime, time_t overlayMtime,
+ uint32_t** outData, size_t* outSize);
+
+ String8 getBasePackageName(uint32_t index);
private:
struct asset_path
{
- asset_path() : path(""), type(kFileTypeRegular), idmap(""), isSystemOverlay(false) {}
+ asset_path() : path(""), type(kFileTypeRegular), idmap(""), isSystemOverlay(false),
+ pkgIdOverride(0) {}
String8 path;
FileType type;
String8 idmap;
bool isSystemOverlay;
+ String8 prefixPath;
+ String8 resfilePath;
+ String8 resApkPath;
+ uint32_t pkgIdOverride;
};
Asset* openInPathLocked(const char* fileName, AccessMode mode,
const asset_path& path);
Asset* openNonAssetInPathLocked(const char* fileName, AccessMode mode,
+ const asset_path& path, bool usePrefix = true);
+ Asset* openNonAssetInExactPathLocked(const char* fileName, AccessMode mode,
const asset_path& path);
Asset* openInLocaleVendorLocked(const char* fileName, AccessMode mode,
const asset_path& path, const char* locale, const char* vendor);
@@ -256,6 +275,7 @@ private:
const String8& dirName, const String8& fileName);
ZipFileRO* getZipFileLocked(const asset_path& path);
+ ZipFileRO* getZipFileLocked(const String8& path);
Asset* openAssetFromFileLocked(const String8& fileName, AccessMode mode);
Asset* openAssetFromZipLocked(const ZipFileRO* pZipFile,
const ZipEntryRO entry, AccessMode mode, const String8& entryName);
@@ -280,13 +300,17 @@ private:
const ResTable* getResTable(bool required = true) const;
void setLocaleLocked(const char* locale);
void updateResourceParamsLocked() const;
- bool appendPathToResTable(const asset_path& ap) const;
+ bool appendPathToResTable(const asset_path& ap, size_t* entryIdx) const;
Asset* openIdmapLocked(const struct asset_path& ap) const;
void addSystemOverlays(const char* pathOverlaysList, const String8& targetPackagePath,
ResTable* sharedRes, size_t offset) const;
+ String8 getPkgName(const char *apkPath);
+
+ String8 getOverlayResPath(const char* targetApkPath, const char* overlayApkPath);
+
class SharedZip : public RefBase {
public:
static sp<SharedZip> get(const String8& path, bool createIfNotPresent = true);
@@ -376,6 +400,9 @@ private:
mutable ResTable* mResources;
ResTable_config* mConfig;
+ String8 mBasePackageName;
+ uint32_t mBasePackageIndex;
+
/*
* Cached data for "loose" files. This lets us avoid poking at the
* filesystem when searching for loose assets. Each entry is the
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
index 5130e6c..ae955c6 100644
--- a/include/androidfw/ResourceTypes.h
+++ b/include/androidfw/ResourceTypes.h
@@ -1547,10 +1547,11 @@ public:
status_t add(const void* data, size_t size, const int32_t cookie=-1, bool copyData=false);
status_t add(const void* data, size_t size, const void* idmapData, size_t idmapDataSize,
- const int32_t cookie=-1, bool copyData=false);
+ const int32_t cookie=-1, bool copyData=false, const uint32_t pkgIdOverride=0);
status_t add(Asset* asset, const int32_t cookie=-1, bool copyData=false);
- status_t add(Asset* asset, Asset* idmapAsset, const int32_t cookie=-1, bool copyData=false);
+ status_t add(Asset* asset, Asset* idmapAsset, const int32_t cookie=-1, bool copyData=false,
+ const uint32_t pkgIdOverride=0);
status_t add(ResTable* src);
status_t addEmpty(const int32_t cookie);
@@ -1637,7 +1638,7 @@ public:
void lock() const;
ssize_t getBagLocked(uint32_t resID, const bag_entry** outBag,
- uint32_t* outTypeSpecFlags=NULL) const;
+ uint32_t* outTypeSpecFlags=NULL, bool performMapping=true) const;
void unlock() const;
@@ -1830,10 +1831,11 @@ public:
// NO_ERROR; the caller should not free outData.
status_t createIdmap(const ResTable& overlay,
uint32_t targetCrc, uint32_t overlayCrc,
+ time_t targetMtime, time_t overlayMtime,
const char* targetPath, const char* overlayPath,
void** outData, size_t* outSize) const;
- static const size_t IDMAP_HEADER_SIZE_BYTES = 4 * sizeof(uint32_t) + 2 * 256;
+ static const size_t IDMAP_HEADER_SIZE_BYTES = 6 * sizeof(uint32_t) + 2 * 256;
// Retrieve idmap meta-data.
//
@@ -1844,6 +1846,8 @@ public:
uint32_t* pTargetCrc, uint32_t* pOverlayCrc,
String8* pTargetPath, String8* pOverlayPath);
+ void removeAssetsByCookie(const String8 &packageName, int32_t cookie);
+
void print(bool inclValues) const;
static String8 normalizeForOutput(const char* input);
@@ -1857,20 +1861,26 @@ private:
typedef Vector<Type*> TypeList;
status_t addInternal(const void* data, size_t size, const void* idmapData, size_t idmapDataSize,
- const int32_t cookie, bool copyData);
+ const int32_t cookie, bool copyData, const uint32_t pkgIdOverride);
ssize_t getResourcePackageIndex(uint32_t resID) const;
status_t getEntry(
const PackageGroup* packageGroup, int typeIndex, int entryIndex,
const ResTable_config* config,
- Entry* outEntry) const;
+ Entry* outEntry, const bool performMapping=true) const;
uint32_t findEntry(const PackageGroup* group, ssize_t typeIndex, const char16_t* name,
size_t nameLen, uint32_t* outTypeSpecFlags) const;
status_t parsePackage(
- const ResTable_package* const pkg, const Header* const header);
+ const ResTable_package* const pkg, const Header* const header,
+ const uint32_t pkgIdOverride);
+
+ bool isResTypeAllowed(const char* type) const;
+ bool isDynamicPackageId(const uint32_t pkgId) const;
+ bool isProtectedAttr(uint32_t resID) const;
+ status_t removeIdmappedTypesFromPackageGroup(PackageGroup* packageGroup) const;
void print_value(const Package* pkg, const Res_value& value) const;