RRO: reintroduce lost ResTable insert of assets

With the recent introduction of AssetManager::appendPathToResTable,
overlay packages were not properly added to the AssetManager, and once
added, were not properly inserted into the ResTable.

Bug: 17765434
Change-Id: Ie21f227c654c98730f74a687d0e16ee2b80e747e
This commit is contained in:
Mårten Kongstad
2014-11-07 10:52:17 +01:00
committed by Zoran Jovanovic
parent 840796a3c2
commit 30113131fb
3 changed files with 20 additions and 2 deletions

View File

@@ -627,7 +627,21 @@ public final class AssetManager implements AutoCloseable {
*
* {@hide}
*/
public native final int addOverlayPath(String idmapPath);
public final int addOverlayPath(String idmapPath) {
synchronized (this) {
int res = addOverlayPathNative(idmapPath);
makeStringBlocks(mStringBlocks);
return res;
}
}
/**
* See addOverlayPath.
*
* {@hide}
*/
public native final int addOverlayPathNative(String idmapPath);
/**
* Add multiple sets of assets to the asset manager at once. See

View File

@@ -2001,7 +2001,7 @@ static JNINativeMethod gAssetManagerMethods[] = {
(void*) android_content_AssetManager_getAssetRemainingLength },
{ "addAssetPathNative", "(Ljava/lang/String;)I",
(void*) android_content_AssetManager_addAssetPath },
{ "addOverlayPath", "(Ljava/lang/String;)I",
{ "addOverlayPathNative", "(Ljava/lang/String;)I",
(void*) android_content_AssetManager_addOverlayPath },
{ "isUpToDate", "()Z",
(void*) android_content_AssetManager_isUpToDate },

View File

@@ -296,6 +296,10 @@ bool AssetManager::addOverlayPath(const String8& packagePath, int32_t* cookie)
mAssetPaths.add(oap);
*cookie = static_cast<int32_t>(mAssetPaths.size());
if (mResources != NULL) {
appendPathToResTable(oap);
}
return true;
}