Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfc3f6aa authored by yingying's avatar yingying Committed by Gerrit - the friendly Code Review server
Browse files

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
parent caaba96f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
+4 −2
Original line number Diff line number Diff line
@@ -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;