Add property Optimize.Keep_runtime_invisible_annotations

This adds a new property Keep_runtime_invisible_annotations to Optimize that defaults to false.

Setting this property to true is equivalent to:
  -keepattributes RuntimeInvisibleAnnotations,
                  RuntimeInvisibleParameterAnnotations,
                  RuntimeInvisibleTypeAnnotations

This is only applicable when RELEASE_R8_ONLY_RUNTIME_VISIBLE_ANNOTATIONS is enabled and will be used to migrate away from keeping runtime invisible annotations (b/387958004 ).

It is not possible to branch on RELEASE_R8_ONLY_RUNTIME_VISIBLE_ANNOTATIONS in ProGuard configuration files. To migrate builds away from keeping runtime invisible annotations, this will remove any -keepattributes rules that retain runtime invisible annotations, and set the property Optimize.Keep_runtime_invisible_annotations. This way these builds continue to retain runtime invisible annotations when the feature flag RELEASE_R8_ONLY_RUNTIME_VISIBLE_ANNOTATIONS is not enabled.

Bug: 387958004
Test: existing
Change-Id: I2a2b9aba436c4f43533d3067f2abe319fadf78f1
diff --git a/android/config.go b/android/config.go
index e9cb2cd..da7382d 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2168,6 +2168,10 @@
 	return c.productVariables.GetBuildFlagBool("RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH")
 }
 
+func (c *config) UseR8OnlyRuntimeVisibleAnnotations() bool {
+	return c.productVariables.GetBuildFlagBool("RELEASE_R8_ONLY_RUNTIME_VISIBLE_ANNOTATIONS")
+}
+
 func (c *config) UseR8StoreStoreFenceConstructorInlining() bool {
 	return c.productVariables.GetBuildFlagBool("RELEASE_R8_STORE_STORE_FENCE_CONSTRUCTOR_INLINING")
 }