chromium/chrome/android/proguard/main.flags

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Every fragment must have an empty constructor, so it can be instantiated when
# restoring its activity's state.
-keep public class org.chromium.** extends androidx.fragment.app.Fragment {
  public <init>();
}

# Let proguard know CastMediaOptions in CastOptions is always null, so it can
# trim unused MediaNotificationService methods. This saves about 170 methods in
# the dex file. https://crbug.com/855081
-assumenosideeffects class com.google.android.gms.cast.framework.CastOptions {
  *** getCastMediaOptions() return null;
}

# Also, because CastOptions creates a default CastMediaOptions object upon
# construction, we need to trim out the its builder as well, so we are truly
# assuming there's no CastMediaOptions instances anywhere. This is to avoid
# CastMediaOptions to reference resources upon construction.
-assumenosideeffects class com.google.android.gms.cast.framework.media.CastMediaOptions$Builder {
  public <init>();
  public <clinit>();
  *** build() return null;
}

# Keep implementation classes needed for split compat. These will be accessed by
# reflection.
-keep,allowobfuscation public class ** extends org.chromium.chrome.browser.base.SplitCompat*$Impl {
  public <init>();
}

# To fix crbug/1017396. This is because AppBarLayout$ScrollingViewBehavior
# is instantiated via java.lang.reflect.Constructor in CoordinatorLayout.java.
# Note that AppBarLayout$Behavior is needed to keep the scrolling behavior.
-keep class com.google.android.material.appbar.AppBarLayout$Behavior {
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>();
}
-keep class com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior {
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>();
}