diff options
author | yingying <yingying@codeaurora.org> | 2014-10-27 19:13:53 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-10-20 17:07:39 -0700 |
commit | dfc3f6aaeefceda4ff0337fa0e51eab83c0c820e (patch) | |
tree | 1ba4a38280cb332d47d06195c1c39a8a576bea03 | |
parent | caaba96fcb34849406e362759931ffa4340a89c5 (diff) | |
download | frameworks_base-dfc3f6aaeefceda4ff0337fa0e51eab83c0c820e.zip frameworks_base-dfc3f6aaeefceda4ff0337fa0e51eab83c0c820e.tar.gz frameworks_base-dfc3f6aaeefceda4ff0337fa0e51eab83c0c820e.tar.bz2 |
androidfw: Use the last package to create idmap.
Overlaid packages contain one or two package groups, the first one is
system package(android), and the second one is application package. So
it should use the last package group to create idmap.
When inspecting the idmap, similar as above.
Change-Id: I97e0179bc5b5acdcacbe6ec5b5b7c22af51d1d0b
-rw-r--r-- | cmds/idmap/inspect.cpp | 3 | ||||
-rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/cmds/idmap/inspect.cpp b/cmds/idmap/inspect.cpp index f6afc85..63756a5 100644 --- a/cmds/idmap/inspect.cpp +++ b/cmds/idmap/inspect.cpp @@ -223,7 +223,8 @@ namespace { } status_t parse_data(IdmapBuffer& buf, const AssetManager& am) { - const uint32_t packageId = am.getResources().getBasePackageId(0); + const ResTable& rt = am.getResources(); + const uint32_t packageId = rt.getBasePackageId(rt.getBasePackageCount() - 1); uint16_t data16; status_t err = buf.nextUint16(&data16); diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 62aabb1..585f4a2 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -6379,8 +6379,10 @@ status_t ResTable::createIdmap(const ResTable& overlay, KeyedVector<uint8_t, IdmapTypeMap> map; - // overlaid packages are assumed to contain only one package group - const PackageGroup* pg = mPackageGroups[0]; + // Overlaid packages are assumed to contain only one package group or two package group + // as one is "system package(android)", and another is "application package". So we need + // to use the last package group to create idmap. + const PackageGroup* pg = mPackageGroups[mPackageGroups.size() - 1]; // starting size is header *outSize = ResTable::IDMAP_HEADER_SIZE_BYTES; |