summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-12-02 23:00:06 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-12-02 23:00:06 +0000
commite580d6617f67a1db5eff7ffe5450684cfc7e1a2b (patch)
treec55e1a0c4cc7a2c22c4bb4dfa190a2fb38f6a3df
parent47a5cb122ab495e8420c46d8f324bddcd38920af (diff)
parente89a286541e242ad96705fcdd1fe2c6a9eafb4a0 (diff)
downloadframeworks_base-e580d6617f67a1db5eff7ffe5450684cfc7e1a2b.zip
frameworks_base-e580d6617f67a1db5eff7ffe5450684cfc7e1a2b.tar.gz
frameworks_base-e580d6617f67a1db5eff7ffe5450684cfc7e1a2b.tar.bz2
am e89a2865: Merge changes If2c7e09f,Ie21f227c
* commit 'e89a286541e242ad96705fcdd1fe2c6a9eafb4a0': RRO idmap: pad with 0xffffffff, not 0x00000000 RRO: reintroduce lost ResTable insert of assets
-rw-r--r--core/java/android/content/res/AssetManager.java16
-rw-r--r--core/jni/android_util_AssetManager.cpp2
-rw-r--r--libs/androidfw/AssetManager.cpp4
-rw-r--r--libs/androidfw/ResourceTypes.cpp10
4 files changed, 25 insertions, 7 deletions
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index e578822..72f24d3 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -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
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 744eefd..e5cdee0 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -2039,7 +2039,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 },
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index e5c5b10..6188edb 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -302,6 +302,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;
}
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 5a4c944..d66c4a5 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -6237,14 +6237,14 @@ status_t ResTable::createIdmap(const ResTable& overlay,
}
if (typeMap.entryOffset + typeMap.entryMap.size() < entryIndex) {
- // Resize to accomodate this entry and the 0's in between.
- if (typeMap.entryMap.resize((entryIndex - typeMap.entryOffset) + 1) < 0) {
+ // pad with 0xffffffff's (indicating non-existing entries) before adding this entry
+ size_t index = typeMap.entryMap.size();
+ size_t numItems = entryIndex - (typeMap.entryOffset + index);
+ if (typeMap.entryMap.insertAt(0xffffffff, index, numItems) < 0) {
return NO_MEMORY;
}
- typeMap.entryMap.editTop() = Res_GETENTRY(overlayResID);
- } else {
- typeMap.entryMap.add(Res_GETENTRY(overlayResID));
}
+ typeMap.entryMap.add(Res_GETENTRY(overlayResID));
}
if (!typeMap.entryMap.isEmpty()) {