Move return values for Logger's proguard configuration into assumenosideeffects section

Chrome started hitting exceptions that should have been optimized away by proguard (crbug.com/992568). The issue is that R8 behavior is slightly different from proguard. This change adjusts configuration to get code optimized away by R8.

PiperOrigin-RevId: 264463690
Change-Id: I116cb95dd60c79a2da6bb321c12054397279172b
diff --git a/src/main/java/com/google/android/libraries/feed/buildtools/proguard/BUILD b/src/main/java/com/google/android/libraries/feed/buildtools/proguard/BUILD
index 80580e9..41060b6 100644
--- a/src/main/java/com/google/android/libraries/feed/buildtools/proguard/BUILD
+++ b/src/main/java/com/google/android/libraries/feed/buildtools/proguard/BUILD
@@ -2,4 +2,7 @@
 
 licenses(["notice"])  # Apache 2
 
-exports_files(["proguard_release.flags"])
+exports_files([
+    "proguard_release.flags",
+    "r8_release.flags",
+])
diff --git a/src/main/java/com/google/android/libraries/feed/buildtools/proguard/proguard_release.flags b/src/main/java/com/google/android/libraries/feed/buildtools/proguard/proguard_release.flags
index 77470eb..29a1a3c 100644
--- a/src/main/java/com/google/android/libraries/feed/buildtools/proguard/proguard_release.flags
+++ b/src/main/java/com/google/android/libraries/feed/buildtools/proguard/proguard_release.flags
@@ -16,8 +16,18 @@
 
   private static boolean shouldWtfCrash();
 }
+
+# The options that control replacing function invocation with constant
+# expression differ between proguard and R8 (crbug.com/992568). In proguard
+# function should be specified in assumevalues and assumenosideeffects. In R8
+# function should be listed in assumenosideeffects with "return <value>" clause.
+# This file specifies proguard options. Corresponding configuration for R8 is in
+# r8_release.flags. When modifying below entries make sure to make corresponding
+# changes in r8_release.flags.
+# LINT.IfChange
 -assumevalues class com.google.android.libraries.feed.common.logging.Logger {
   public static boolean isDebugEnabled(java.lang.String) return false;
   public static boolean isVerboseEnabled(java.lang.String) return false;
   private static boolean shouldWtfCrash() return false;
 }
+# LINT.ThenChange
diff --git a/src/main/java/com/google/android/libraries/feed/buildtools/proguard/r8_release.flags b/src/main/java/com/google/android/libraries/feed/buildtools/proguard/r8_release.flags
new file mode 100644
index 0000000..0d3c33e
--- /dev/null
+++ b/src/main/java/com/google/android/libraries/feed/buildtools/proguard/r8_release.flags
@@ -0,0 +1,20 @@
+# Feed proguard flags should only target and affect Feed classes. Any app-wide
+# specific flags should be added to each host's proguard specs and overall
+# should be avoided.
+
+-assumenosideeffects class com.google.android.libraries.feed.common.logging.Logger {
+  # LINT.IfChange
+  public static boolean isDebugEnabled(java.lang.String) return false;
+  public static boolean isVerboseEnabled(java.lang.String) return false;
+  private static boolean shouldWtfCrash() return false;
+  # LINT.ThenChange
+
+  public static void v(...);
+  public static void vWithStackTrace(...);
+  public static void d(...);
+  public static void dWithStackTrace(...);
+
+  # Protocol buffers are large. Only allow spamming a developer's device.
+  public static void debugLogRawProto(...);
+
+}