diff options
author | Dianne Hackborn <hackbod@android.com> | 2014-02-11 20:44:38 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-02-11 20:44:38 +0000 |
commit | 47b80be208fcc1d4824bc24959080233a44041db (patch) | |
tree | 2aacece40a95afd54ecd3e446c83fb0a7db4a448 /libs/androidfw | |
parent | 43750f19e74edf64c1f1332a2e39de0372845d38 (diff) | |
parent | be49403a0362c18edaeafe59ac09baac14294dee (diff) | |
download | frameworks_base-47b80be208fcc1d4824bc24959080233a44041db.zip frameworks_base-47b80be208fcc1d4824bc24959080233a44041db.tar.gz frameworks_base-47b80be208fcc1d4824bc24959080233a44041db.tar.bz2 |
am be49403a: am 0cd115e1: am 578087e3: Merge "New command line tool \'idmap\'"
* commit 'be49403a0362c18edaeafe59ac09baac14294dee':
New command line tool 'idmap'
Diffstat (limited to 'libs/androidfw')
-rw-r--r-- | libs/androidfw/AssetManager.cpp | 25 | ||||
-rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 9cea68c..aa69d2f 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -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@b@c.apk@idmap String8 idmapPathForPackagePath(const String8& pkgPath) @@ -239,6 +241,29 @@ bool AssetManager::addAssetPath(const String8& path, int32_t* 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) { diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 94d150a..be163c2 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -5570,7 +5570,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui | (0x00ff0000 & ((typeIndex+1)<<16)) | (0x0000ffff & (entryIndex)); resource_name resName; - if (!this->getResourceName(resID, true, &resName)) { + if (!this->getResourceName(resID, false, &resName)) { ALOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID); // add dummy value, or trimming leading/trailing zeroes later will fail vector.push(0); |