-keep class org.webrtc.** { *; }
-keep class live.hms.** { *; }
# protobuf
-assumevalues class com.google.protobuf.Android { static boolean ASSUME_ANDROID return true; }

-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
  <fields>;
}

# MediaPipe.

# Keep public members of our public interfaces. This also prevents the
# obfuscation of the corresponding methods in classes implementing them,
# such as implementations of PacketCallback#process.
-keep class com.effectssdk.** { *;}

# MediaPipe.

# Keep public members of our public interfaces. This also prevents the
# obfuscation of the corresponding methods in classes implementing them,
# such as implementations of PacketCallback#process.
-keep class com.google.mediapipe.** { *;}
-keep class live.hms.video.virtualbackground.** { *;}

# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep interface com.effectssdk.tsvb.**

-keep interface com.google.mediapipe.framework.**
-keep class com.google.mediapipe.framework.**

-keepclasseswithmembers class com.effectssdk.tsvb.** {
    native <methods>;
}

-keepclassmembers class com.google.mediapipe.framework.** {
    native <methods>;
}

-keep public class com.google.mediapipe.framework.Packet {
  public static *** create(***);
  public long getNativeHandle();
  public void release();
}

-keep public class com.google.mediapipe.framework.PacketCreator {
  *** releaseWithSyncToken(...);
}

-keep public class com.google.mediapipe.framework.MediaPipeException {
  <init>(int, byte[]);
}

-keep class com.google.mediapipe.framework.ProtoUtil$SerializedMessage { *; }


-dontwarn com.google.android.material.**
-dontnote com.google.android.material.**

-dontwarn androidx.**
-keep class androidx.** { *; }
-keep interface androidx.** { *; }

-keep class live.hms.video.virtualbackground.** { *;}
-keep class com.effectssdk.** { *; }
-keep class com.google.mediapipe.** { *; }

# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep interface com.effectssdk.tsvb.**
-keep class com.google.mediapipe.** { *;}

-keepclasseswithmembers class com.effectssdk.tsvb.** {
    native <methods>;
}

-keepclassmembers class com.google.mediapipe.** {
    native <methods>;
}

-keep public class com.google.mediapipe.framework.Packet {
  public static *** create(***);
  public long getNativeHandle();
  public void release();
}

-keep public class com.google.mediapipe.framework.PacketCreator {
  *** releaseWithSyncToken(...);
}

-keep public class com.google.mediapipe.framework.MediaPipeException {
  <init>(int, byte[]);
}

-keep class com.google.mediapipe.framework.ProtoUtil$SerializedMessage { *; }


-dontwarn com.google.android.material.**
-dontnote com.google.android.material.**

-dontwarn androidx.**
-keep class androidx.** { *; }
-keep interface androidx.** { *; }

# protobuf
-assumevalues class com.google.protobuf.Android { static boolean ASSUME_ANDROID return true; }

-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
  <fields>;
}

-dontwarn javax.lang.model.element.Modifier

# Note: We intentionally don't add the flags we'd need to make Enums work.
# That's because the Proguard configuration required to make it work on
# optimized code would preclude lots of optimization, like converting enums
# into ints.

# Throwables uses internal APIs for lazy stack trace resolution
-dontnote sun.misc.SharedSecrets
-keep class sun.misc.SharedSecrets {
  *** getJavaLangAccess(...);
}
-dontnote sun.misc.JavaLangAccess
-keep class sun.misc.JavaLangAccess {
  *** getStackTraceElement(...);
  *** getStackTraceDepth(...);
}

# FinalizableReferenceQueue calls this reflectively
# Proguard is intelligent enough to spot the use of reflection onto this, so we
# only need to keep the names, and allow it to be stripped out if
# FinalizableReferenceQueue is unused.
-keepnames class com.google.common.base.internal.Finalizer {
  *** startFinalizer(...);
}
# However, it cannot "spot" that this method needs to be kept IF the class is.
-keepclassmembers class com.google.common.base.internal.Finalizer {
  *** startFinalizer(...);
}
-keepnames class com.google.common.base.FinalizableReference {
  void finalizeReferent();
}
-keepclassmembers class com.google.common.base.FinalizableReference {
  void finalizeReferent();
}

# Striped64, LittleEndianByteArray, UnsignedBytes, AbstractFuture
-dontwarn sun.misc.Unsafe

# Striped64 appears to make some assumptions about object layout that
# really might not be safe. This should be investigated.
-keepclassmembers class com.google.common.cache.Striped64 {
  *** base;
  *** busy;
}
-keepclassmembers class com.google.common.cache.Striped64$Cell {
  <fields>;
}

-dontwarn java.lang.SafeVarargs

-keep class java.lang.Throwable {
  *** addSuppressed(...);
}

# Futures.getChecked, in both of its variants, is incompatible with proguard.

# Used by AtomicReferenceFieldUpdater and sun.misc.Unsafe
-keepclassmembers class com.google.common.util.concurrent.AbstractFuture** {
  *** waiters;
  *** value;
  *** listeners;
  *** thread;
  *** next;
}
-keepclassmembers class com.google.common.util.concurrent.AtomicDouble {
  *** value;
}
-keepclassmembers class com.google.common.util.concurrent.AggregateFutureState {
  *** remaining;
  *** seenExceptions;
}

# Since Unsafe is using the field offsets of these inner classes, we don't want
# to have class merging or similar tricks applied to these classes and their
# fields. It's safe to allow obfuscation, since the by-name references are
# already preserved in the -keep statement above.
-keep,allowshrinking,allowobfuscation class com.google.common.util.concurrent.AbstractFuture** {
  <fields>;
}

# Futures.getChecked (which often won't work with Proguard anyway) uses this. It
# has a fallback, but again, don't use Futures.getChecked on Android regardless.
-dontwarn java.lang.ClassValue

# MoreExecutors references AppEngine
-dontnote com.google.appengine.api.ThreadManager
-keep class com.google.appengine.api.ThreadManager {
  static *** currentRequestThreadFactory(...);
}
-dontnote com.google.apphosting.api.ApiProxy
-keep class com.google.apphosting.api.ApiProxy {
  static *** getCurrentEnvironment (...);
}
-keep class com.google.common.flogger.**
-keep class com.google.mediapipe.components.**

# Required for gradle 8.0.0

-dontwarn com.google.mediapipe.proto.CalculatorOptionsProto$CalculatorOptions$Builder
-dontwarn com.google.mediapipe.proto.CalculatorOptionsProto$CalculatorOptions
-dontwarn com.google.mediapipe.proto.CalculatorProfileProto$CalculatorProfile
-dontwarn com.google.mediapipe.proto.GraphTemplateProto$CalculatorGraphTemplate
-dontwarn com.google.mediapipe.proto.MediaPipeOptionsProto$MediaPipeOptions$Builder
-dontwarn com.google.mediapipe.proto.MediaPipeOptionsProto$MediaPipeOptions
-dontwarn com.google.mediapipe.proto.StreamHandlerProto$InputStreamHandlerConfig$Builder
-dontwarn com.google.mediapipe.proto.StreamHandlerProto$InputStreamHandlerConfig
-dontwarn com.google.mediapipe.proto.StreamHandlerProto$OutputStreamHandlerConfig$Builder
-dontwarn com.google.mediapipe.proto.StreamHandlerProto$OutputStreamHandlerConfig
-dontwarn mediapipe.PacketFactory$PacketFactoryConfig$Builder
-dontwarn mediapipe.PacketFactory$PacketFactoryConfig
-dontwarn mediapipe.PacketFactory$PacketFactoryConfigOrBuilder
-dontwarn mediapipe.PacketGenerator$PacketGeneratorConfig$Builder
-dontwarn mediapipe.PacketGenerator$PacketGeneratorConfig
-dontwarn mediapipe.PacketGenerator$PacketGeneratorConfigOrBuilder
-dontwarn mediapipe.StatusHandler$StatusHandlerConfig$Builder
-dontwarn mediapipe.StatusHandler$StatusHandlerConfig
-dontwarn mediapipe.StatusHandler$StatusHandlerConfigOrBuilder
