diff --git a/embrace-android-sdk/embrace-proguard.cfg b/embrace-android-sdk/embrace-proguard.cfg index 3f7c56175e..582218dd5f 100644 --- a/embrace-android-sdk/embrace-proguard.cfg +++ b/embrace-android-sdk/embrace-proguard.cfg @@ -1,20 +1,38 @@ --keepattributes Exceptions, InnerClasses, Signature, LineNumberTable, SourceFile +-keepattributes LineNumberTable, SourceFile -## Proguard configuration for Embrace --keep class io.embrace.android.embracesdk.** { *; } --dontwarn io.embrace.android.embracesdk.** +## Keep classes used by hosted SDKs +-keep class io.embrace.android.embracesdk.Embrace { *; } +-keep class io.embrace.android.embracesdk.Embrace$AppFramework { *; } +-keep class io.embrace.android.embracesdk.Embrace$LastRunEndState { *; } +-keep class io.embrace.android.embracesdk.Severity { *; } +-keep public class * implements io.embrace.android.embracesdk.internal.EmbraceInternalInterface { *; } -## Proguard configuration for OkHTTP3 / Okio --dontwarn okhttp3.** --dontwarn okio.** +## Keep classes used from native code +-keep class io.embrace.android.embracesdk.payload.NativeThreadAnrSample { *; } +-keep class io.embrace.android.embracesdk.payload.NativeThreadAnrStackframe { *; } +-keep class io.embrace.android.embracesdk.anr.sigquit.SigquitDataSource { *; } -## Proguard configuration for Arrow --keep class java9.** { *; } --dontwarn java9.** +## Keep classes with JNI calls to native code +-keep class io.embrace.android.embracesdk.capture.cpu.EmbraceCpuInfoDelegate { *; } +-keep class io.embrace.android.embracesdk.anr.ndk.NativeThreadSamplerNdkDelegate { *; } +-keep class io.embrace.android.embracesdk.ndk.NdkDelegateImpl { *; } ## OpenTelemetry Java SDK -keep class io.opentelemetry.api.trace.StatusCode { *; } --dontwarn com.google.auto.value.AutoValue$CopyAnnotations -dontwarn com.google.auto.value.extension.memoized.Memoized + +## Keep OkHttp class so we can fetch the version correctly via reflection. +-keep class okhttp3.OkHttp { *; } +-keep class okhttp3.OkHttpClient { *; } + +## Annotations used by some dependencies (such as OTel, Protobuf and Moshi) at compile time. No need to keep them for runtime. -dontwarn com.google.auto.value.AutoValue --dontwarn com.google.errorprone.annotations.MustBeClosed \ No newline at end of file +-dontwarn com.google.auto.value.AutoValue$CopyAnnotations +-dontwarn com.google.errorprone.annotations.MustBeClosed + +## Keep swazzler hooks +-keep class io.embrace.android.embracesdk.okhttp3.** { *; } +-keep class io.embrace.android.embracesdk.ViewSwazzledHooks { *; } +-keep class io.embrace.android.embracesdk.WebViewClientSwazzledHooks { *; } +-keep class io.embrace.android.embracesdk.WebViewChromeClientSwazzledHooks { *; } +-keep class io.embrace.android.embracesdk.fcm.swazzle.callback.com.android.fcm.FirebaseSwazzledHooks { *; } diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EventType.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EventType.kt index 3d50bc55fb..f4e4b06a34 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EventType.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EventType.kt @@ -2,6 +2,7 @@ package io.embrace.android.embracesdk import android.annotation.SuppressLint import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import io.embrace.android.embracesdk.annotation.InternalApi /** @@ -9,6 +10,7 @@ import io.embrace.android.embracesdk.annotation.InternalApi */ @InternalApi @SuppressLint("EmbracePublicApiPackageRule") +@JsonClass(generateAdapter = false) internal enum class EventType( /** diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/capture/metadata/AppEnvironment.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/capture/metadata/AppEnvironment.kt index b289dc5d6c..254ca7e405 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/capture/metadata/AppEnvironment.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/capture/metadata/AppEnvironment.kt @@ -2,12 +2,14 @@ package io.embrace.android.embracesdk.capture.metadata import android.content.pm.ApplicationInfo import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass internal class AppEnvironment(appInfo: ApplicationInfo) { val isDebug: Boolean = with(appInfo) { flags and ApplicationInfo.FLAG_DEBUGGABLE != 0 } val environment: Environment = if (isDebug) Environment.DEV else Environment.PROD + @JsonClass(generateAdapter = false) internal enum class Environment(val value: String) { @Json(name = "dev") DEV("dev"), diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/EnvelopeResource.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/EnvelopeResource.kt index 818473f78d..11347e4d97 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/EnvelopeResource.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/EnvelopeResource.kt @@ -198,6 +198,7 @@ internal data class EnvelopeResource( * * Values: NATIVE,REACT_NATIVE,UNITY,FLUTTER */ + @JsonClass(generateAdapter = false) internal enum class AppFramework(val value: Int) { @Json(name = "1") NATIVE(1), diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/Span.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/Span.kt index e1316450a7..9b4d2d4ec6 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/Span.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/payload/Span.kt @@ -61,6 +61,7 @@ internal data class Span( * * Values: UNSET,ERROR,OK */ + @JsonClass(generateAdapter = false) internal enum class Status(val value: String) { @Json(name = "Unset") UNSET("Unset"), diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/LifeEventType.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/LifeEventType.kt index 0bfc3c7bb2..7195ccade6 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/LifeEventType.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/LifeEventType.kt @@ -1,10 +1,12 @@ package io.embrace.android.embracesdk.payload import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * Enum to discriminate the different ways a session can start / end */ +@JsonClass(generateAdapter = false) internal enum class LifeEventType { /* Session values */ diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/TapBreadcrumb.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/TapBreadcrumb.kt index df3e8770b4..174918ad25 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/TapBreadcrumb.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/TapBreadcrumb.kt @@ -50,6 +50,7 @@ internal class TapBreadcrumb( override fun getStartTime(): Long = timestamp + @JsonClass(generateAdapter = false) internal enum class TapBreadcrumbType(val value: String) { @Json(name = "s") TAP("tap"),