Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ae17a86
refactor: simplify bytecode instrumentation implementation
fractalwrench Apr 15, 2025
bb4d90c
refactor: alter logic for visiting classes
fractalwrench Apr 15, 2025
758a065
refactor: extract class visitor logic out of individual visitors
fractalwrench Apr 15, 2025
e0b5d47
Merge pull request #2095 from embrace-io/refactor-class-visit-logic
fractalwrench Apr 23, 2025
d7b0f14
Merge pull request #2096 from embrace-io/extract-class-visit
fractalwrench Apr 23, 2025
331c624
refactor: rename instrumentation hooks
fractalwrench Apr 23, 2025
cc48bd0
refactor: improve view instrumentation bytecode hooks
fractalwrench Apr 23, 2025
8217b22
remove unused hook
fractalwrench Apr 23, 2025
572089c
refactor: alter firebase push notification bytecode instrumentation h…
fractalwrench Apr 23, 2025
0fcb8e5
refactor: okhttp hooks
fractalwrench Apr 23, 2025
e7678b6
refactor: alter how operand stack indices are specified
fractalwrench Apr 24, 2025
e1581bf
Merge pull request #2106 from embrace-io/webview-instrumentation-hooks
fractalwrench Apr 24, 2025
c57df02
Merge pull request #2107 from embrace-io/view-instrumentation-hooks
fractalwrench Apr 24, 2025
556afdc
Merge pull request #2108 from embrace-io/remove-unused-hook
fractalwrench Apr 24, 2025
2b8eef0
Merge pull request #2109 from embrace-io/fcm-hooks
fractalwrench Apr 24, 2025
4ed7921
Merge pull request #2110 from embrace-io/okhttp-hooks
fractalwrench Apr 24, 2025
4e22472
Merge pull request #2115 from embrace-io/operand-stack-indices
fractalwrench Apr 24, 2025
3ff7f99
Merge branch 'main' into integration/simplify-bytecode-instrumentation
fractalwrench Apr 24, 2025
aed807b
refactor: reduce parameters in bytecode instrumentation
fractalwrench Apr 24, 2025
003eae0
refactor: create class visit strategy hierarchy
fractalwrench Apr 24, 2025
ec6b18f
refactor: extract bytecode instrumentation features
fractalwrench Apr 24, 2025
6b4930f
Merge pull request #2116 from embrace-io/reduce-params
fractalwrench Apr 24, 2025
e4f6113
Merge pull request #2118 from embrace-io/visit-strategy
fractalwrench Apr 24, 2025
f1e222f
Merge pull request #2119 from embrace-io/extract-features
fractalwrench Apr 24, 2025
67137e2
fix test assertion
fractalwrench Apr 24, 2025
b41b4e2
fix missing module from build script
fractalwrench Apr 25, 2025
c9fffdf
refactor: read bytecode instrumentation from config file
fractalwrench Apr 25, 2025
d2e530e
refactor: add examples for bytecode instrumentation
fractalwrench Apr 25, 2025
87c5fdf
Merge pull request #2122 from embrace-io/read-config-file
fractalwrench Apr 25, 2025
3215d70
Merge pull request #2123 from embrace-io/add-instrumentation-examples
fractalwrench Apr 25, 2025
d62e34f
refactor: drive webview instrumentation via config
fractalwrench Apr 25, 2025
a9f2c88
Merge pull request #2124 from embrace-io/webview-config
fractalwrench Apr 25, 2025
5682486
refactor: drive view click instrumentation via config
fractalwrench Apr 25, 2025
f39c44f
Merge pull request #2125 from embrace-io/view-click-config
fractalwrench Apr 28, 2025
bfb200a
refactor: standardise class visitor factory
fractalwrench Apr 28, 2025
cca424c
test: refactor bytecode instrumentation test
fractalwrench Apr 28, 2025
81fbdb0
refactor: setup override visitor
fractalwrench Apr 28, 2025
1629d96
Merge pull request #2128 from embrace-io/refactor-factory
fractalwrench Apr 29, 2025
6010e66
Merge pull request #2129 from embrace-io/refactor-bytecode-tests
fractalwrench Apr 29, 2025
fa3afdb
Merge pull request #2131 from embrace-io/setup-override-visitor
fractalwrench Apr 29, 2025
fc7fab3
Merge branch 'main' into integration/simplify-bytecode-instrumentation
fractalwrench Apr 29, 2025
1687a63
add push notification example
fractalwrench Apr 29, 2025
55064d0
Merge pull request #2138 from embrace-io/push-notification-example
fractalwrench Apr 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions embrace-android-core/lint-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
column="12"/>
</issue>

<issue
id="EmbracePublicApiPackageRule"
message="Don&apos;t put classes in the io.embrace.android.embracesdk package unless they&apos;re part of the public API. Please move the new class to an appropriate package or (if you&apos;re adding to the public API) suppress this error via the lint baseline file."
errorLine1="public final class WebViewChromeClientSwazzledHooks {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/embrace/android/embracesdk/WebViewChromeClientSwazzledHooks.java"
line="13"
column="20"/>
</issue>

<issue
id="UnclosedTrace"
message="The `beginSection()` call is not always closed with a matching `endSection()` because the code in between may return early"
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions embrace-android-fcm/api/embrace-android-fcm.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public final class io/embrace/android/embracesdk/fcm/swazzle/callback/com/android/fcm/FirebaseSwazzledHooks {
public static fun _onMessageReceived (Lcom/google/firebase/messaging/RemoteMessage;)V
public final class io/embrace/android/embracesdk/internal/instrumentation/bytecode/FcmBytecodeEntrypoint {
public static final fun onMessageReceived (Lcom/google/firebase/messaging/RemoteMessage;)V
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.embrace.android.embracesdk.internal.instrumentation.bytecode

import androidx.annotation.Keep
import com.google.firebase.messaging.RemoteMessage
import io.embrace.android.embracesdk.Embrace
import io.embrace.android.embracesdk.internal.EmbraceInternalApi

@Keep
object FcmBytecodeEntrypoint {

@JvmStatic
@Keep
fun onMessageReceived(message: RemoteMessage) {
if (!Embrace.getInstance().isStarted) {
return
}
try {
val notification: RemoteMessage.Notification? = message.notification

Embrace.getInstance().logPushNotification(
notification?.title,
notification?.body,
message.from,
message.messageId,
notification?.notificationPriority,
message.priority,
notification != null,
message.data.isNotEmpty()
)
} catch (e: Exception) {
EmbraceInternalApi.getInstance().internalInterface.logInternalError(e)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class PushNotificationCaptureService(
// whenever we come through this flow of push notification, we know certainly that it has
// notification block. This is because if the push notification is data only
// (w/o notification block), then it wouldn't come through this flow, but through
// FirebaseSwazzledHooks._onMessageReceived instead. Now it is a matter of determining if
// FcmBytecodeEntrypoint.onMessageReceived instead. Now it is a matter of determining if
// it's a notification only or notification + data.
return if (hasData) {
PushNotificationBreadcrumb.NotificationType.NOTIFICATION_AND_DATA
Expand Down
25 changes: 0 additions & 25 deletions embrace-android-okhttp3/api/embrace-android-okhttp3.api

This file was deleted.

1 change: 1 addition & 0 deletions embrace-android-okhttp3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ dependencies {
testImplementation(project(":embrace-android-infra"))
testImplementation(project(":embrace-android-sdk"))
testImplementation(project(":embrace-internal-api"))
implementation(libs.lifecycle.runtime)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package io.embrace.android.embracesdk.internal.instrumentation.bytecode

import androidx.annotation.Keep
import io.embrace.android.embracesdk.Embrace
import io.embrace.android.embracesdk.internal.EmbraceInternalApi
import io.embrace.android.embracesdk.okhttp3.EmbraceOkHttp3ApplicationInterceptor
import io.embrace.android.embracesdk.okhttp3.EmbraceOkHttp3NetworkInterceptor
import okhttp3.Interceptor
import okhttp3.OkHttpClient

/**
* @hide
*/
@Keep
object OkHttpBytecodeEntrypoint {

/**
* As there was a way to clear the injected interceptors during the OkHttpClient
* initialization using the builder, we are hooking the build method as well, instead of
* just the Builder constructor.
*
* Once the build method is called, OkHTTP mushes everything and returns the OkHttpClient
* instance, where the developer has no way to alter any of the interceptors during or
* after this point, without having to rebuild the client.
*/
@Keep
@JvmStatic
fun build(thiz: OkHttpClient.Builder) {
addEmbraceInterceptors(thiz)
}

/**
* Adds embrace interceptors if they don't exist already to the OkHTTPClient provided.
*
* @param thiz the OkHttpClient builder in matter.
*/
private fun addEmbraceInterceptors(thiz: OkHttpClient.Builder) {
val internalApi = EmbraceInternalApi.getInstance()
try {
val embrace = Embrace.getInstance()
addInterceptor(
thiz.interceptors(),
EmbraceOkHttp3ApplicationInterceptor(embrace, internalApi)
)
addInterceptor(
thiz.networkInterceptors(),
EmbraceOkHttp3NetworkInterceptor(embrace, internalApi)
)
} catch (error: Throwable) {
internalApi.internalInterface.logInternalError(error)
}
}

/**
* Adds the interceptor to the interceptors list if it doesn't exist already.
*/
private fun addInterceptor(
interceptors: MutableList<Interceptor>?,
interceptor: Interceptor,
) {
if (interceptors != null && !interceptors.any { interceptor.javaClass.isInstance(it) }) {
interceptors.add(0, interceptor)
}
}
}

This file was deleted.

Loading