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

Commit 7e2249ea authored by yingying's avatar yingying Committed by Steve Kondik
Browse files

androidfw: Init the items which are not present in the idmap as 0xffffffff.

When creating the idmap, if the entry is not present in the idmap, need to init
the item as 0xffffffff.

Change-Id: Iae4a968599e97b29c8b1e1de6a6c1d2639ba240a
parent 06f26dde
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -6081,9 +6081,16 @@ 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.
                const size_t oldSize = typeMap.entryMap.size();
                if (typeMap.entryMap.resize((entryIndex - typeMap.entryOffset) + 1) < 0) {
                    return NO_MEMORY;
                }
                const size_t newSize = typeMap.entryMap.size();
                for (size_t i = oldSize; i < newSize; ++i) {
                    // As this entry is not present in this idmap, so init the item as 0xffffffff.
                    // Please refer to the function IdmapEntries.lookup().
                    typeMap.entryMap.editItemAt(i) = 0xffffffff;
                }
                typeMap.entryMap.editTop() = Res_GETENTRY(overlayResID);
            } else {
                typeMap.entryMap.add(Res_GETENTRY(overlayResID));