(This rolls forward part of a previous change, now that jarjar was fixed
to not get very slow when the number of rules increases).
Jarjar rules are hard to keep in sync with code, and hard to maintain
manually as the distinction between what should and should not be
jarjared is not always clear. This results in unsafe binaries that are
manually maintained, and developer frustration when something fails due
to incorrect jarjar rules.
Add utility to autogenerate jarjar rules, which can be run at build time
time (via a genrule) instead. The generator scans pre-jarjar
intermediate artifacts, and outputs jarjar rules for every class to put
it in a package specific to the module. The only exceptions are:
- Classes that are API (module-lib API is the largest API surface of
the module, so module-lib API stubs would typically be used)
- Classes that have unsupportedappusage symbols
- Classes that are excluded manually (for example, because they have
hardcoded external references, like for
ConnectivityServiceInitializer in SystemServer).
Bug: 217129444
Test: atest jarjar-rules-generator-test;
Change-Id: I3493957e39a661b6c2e330944e7c3023b8f3203e