-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a new tool 'idmap' to handle generation and verification of idmap files. The tool is modelled on 'dexopt', and is intended to be used similarly, notably by 'installd'. See cmds/idmap/idmap.cpp for further documentation on 'idmap'. Note: this commit is interdependent on a commit in project build/ to add 'idmap' to PRODUCT_PACKAGES. Note: the changes to androidfw are only stubs. The actual implementation will be provided in Runtime resource overlay, iteration 2. Change-Id: I7131b74ece1e46c8a9c0a31d103e686aa07da2bb
- Loading branch information
1 parent
f7d605d
commit e38348c
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,8 @@ static Asset* const kExcludedAsset = (Asset*) 0xd000000d; | |
|
||
static volatile int32_t gCount = 0; | ||
|
||
const char* AssetManager::RESOURCES_FILENAME = "resources.arsc"; | ||
|
||
namespace { | ||
// Transform string /a/b/c.apk to /data/resource-cache/a@[email protected]@idmap | ||
String8 idmapPathForPackagePath(const String8& pkgPath) | ||
|
@@ -239,6 +241,29 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) | |
return true; | ||
} | ||
|
||
bool AssetManager::createIdmap(const char* targetApkPath, const char* overlayApkPath, | ||
uint32_t targetCrc, uint32_t overlayCrc, uint32_t** outData, uint32_t* outSize) | ||
{ | ||
AutoMutex _l(mLock); | ||
const String8 paths[2] = { String8(targetApkPath), String8(overlayApkPath) }; | ||
ResTable tables[2]; | ||
|
||
for (int i = 0; i < 2; ++i) { | ||
asset_path ap; | ||
ap.type = kFileTypeRegular; | ||
ap.path = paths[i]; | ||
Asset* ass = openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap); | ||
if (ass == NULL) { | ||
ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); | ||
return false; | ||
} | ||
tables[i].add(ass, (void*)1, false); | ||
} | ||
|
||
return tables[0].createIdmap(tables[1], targetCrc, overlayCrc, | ||
targetApkPath, overlayApkPath, (void**)outData, outSize) == NO_ERROR; | ||
} | ||
|
||
bool AssetManager::isIdmapStaleLocked(const String8& originalPath, const String8& overlayPath, | ||
const String8& idmapPath) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters