[HostStubGen] Multiple improvements
1. Consolidate SubstituteAnd[Stub/Keep] into a single Substitute policy.
There is little reason to support SubstituteKeep, so make Substitute
implicitly Stub. In production, methods are never annotated with both
Stub/Keep + Substitute anyways.
2. Update ClassFilter to support nested classes.
3. Rewrite AnnotationFilter with the following improvements:
- Previously, when a method is annotated as Substitute, the method
itself will get the Remove policy, and the replacement method will
get the Stub/Keep policy. In the new implementation, the annotated
method will preserve its Substitute policy, which will not only be
useful for future improvements, but also be consistent with how
text policy filter is implemented.
- Process the entire class all at once and cache its results; the
previous implementation re-run the same operations multiple times.
- Previously, the annotation allowlist was not properly enforced when
Substitute annotation is used.
Bug: 292141694
Flag: EXEMPT host test change only
Test: atest hoststubgen-test-tiny-test
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh
Change-Id: Iee223c5d0814351eccdcfc884da64bc507af83b7
12 files changed