Skip to content

Commit

Permalink
Remove debug check for finding classes under other res directories
Browse files Browse the repository at this point in the history
Summary:
This method scans xml files for strings that could be possible Java class names. Long ago, a perf optimization was put in to limit the directories searched to exclude things that would be unlikely to reference dex code, like color or vector drawables.

In debug mode, there is an assert to run this logic twice, the second time with no directory filters and assert the size match. With the more broad searching done by D56372640, searching the drawable directory reports more strings.

These are not strings that are class names (strings like P1229962922 from P1229963360 are not classes) but nevertheless the assert was firing because at this level of the API, it doesn't check that these strings are actual types.

I think that we can get rid of this assert since D56372640 will put us in a better position to find more real class names anyways.

Reviewed By: jimmycFB

Differential Revision: D56961260

fbshipit-source-id: bc1920645da93f52162c8a4c5295445d6b52fb1a
  • Loading branch information
wsanville authored and facebook-github-bot committed May 6, 2024
1 parent 06a7d9d commit eb4ce8b
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions libredex/RedexResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,24 +303,6 @@ void AndroidResources::collect_layout_classes_and_attributes(
// Raw would not contain binary XML.
"raw",
});

if (slow_invariants_debug) {
TRACE(RES, 1,
"Checking collect_layout_classes_and_attributes filter assumption");
size_t out_classes_size = out_classes->size();
size_t out_attributes_size = out_attributes->size();

// Comparison is complicated, as out_attributes is a multi-map.
// Assume that the inputs were empty, for simplicity.
out_classes->clear();
out_attributes->clear();

collect_fn({});
size_t new_out_classes_size = out_classes->size();
size_t new_out_attributes_size = out_attributes->size();
redex_assert(out_classes_size == new_out_classes_size);
redex_assert(out_attributes_size == new_out_attributes_size);
}
}

void AndroidResources::collect_xml_attribute_string_values(
Expand Down

0 comments on commit eb4ce8b

Please sign in to comment.