More improvements for benchmark proguard rules
Bug: 329126308
Bug: 339085669
Relnote: "Additional workaround rules added to microbench proguard
rules, including support for listener rules and other observed
warnings / errors."
Test: ./gradlew benchmark:benchmark-benchmark:installRelease && adb shell am instrument -w -r -e debug false -e newRunListenerMode true -e class 'androidx.benchmark.benchmark.TrivialJavaBenchmark' -e androidx.benchmark.output.enable true -e listener androidx.benchmark.junit4.InstrumentationResultsRunListener androidx.benchmark.benchmark.test/androidx.benchmark.junit4.AndroidBenchmarkRunner # after enabling R8 in the project
Change-Id: I14d8fe36a73ce04076da29eb792679651e895601
diff --git a/benchmark/benchmark-junit4/proguard-rules.pro b/benchmark/benchmark-junit4/proguard-rules.pro
index 507b097..cbc8983 100644
--- a/benchmark/benchmark-junit4/proguard-rules.pro
+++ b/benchmark/benchmark-junit4/proguard-rules.pro
@@ -5,6 +5,7 @@
-keepclasseswithmembers class org.junit.** { *; }
-keepclasseswithmembers class junit.** { *; }
-dontwarn com.google.errorprone.annotations.MustBeClosed
+-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
## keep test classes
-keepclasseswithmembers @org.junit.runner.RunWith class * { *; }
@@ -12,7 +13,13 @@
## needed for org.junit.Test annotation to be discoverable by reflection
-keepattributes *Annotation*
+## needed for listeners instantiated by reflection (e.g. InstrumentationResultsRunListener)
+-keepclasseswithmembers class * extends androidx.test.internal.runner.listener.InstrumentationRunListener { *; }
+
## Needed due to b/328649293 - shouldn't be needed since they're ref'd by manifest
## May need to leave these in place long term to account for old gradle versions
-keepclasseswithmembers class androidx.benchmark.junit4.AndroidBenchmarkRunner { *; }
-keepclasseswithmembers class androidx.benchmark.IsolationActivity { *; }
+
+## Needed due to b/339085669 - shouldn't be needed as they're referenced by code
+-keepclasseswithmembers class androidx.benchmark.json.BenchmarkData$TestResult$ProfilerOutput$Type { *; }
\ No newline at end of file