Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
- Fix unregister `SystemEventsBroadcastReceiver` when entering background ([#4338](https://github.com/getsentry/sentry-java/pull/4338))
- This should reduce ANRs seen with this class in the stack trace for Android 14 and above

### Improvements

- Make user interaction tracing faster and do fewer allocations ([#4347](https://github.com/getsentry/sentry-java/pull/4347))

## 8.8.0

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.sentry.internal.gestures.GestureTargetLocator;
import io.sentry.internal.gestures.UiElement;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -60,6 +61,7 @@ private static boolean touchWithinBounds(
final float y,
final UiElement.Type targetType) {

final List<GestureTargetLocator> locators = options.getGestureTargetLocators();
final Queue<View> queue = new LinkedList<>();
queue.add(decorView);

Expand All @@ -79,7 +81,8 @@ private static boolean touchWithinBounds(
}
}

for (GestureTargetLocator locator : options.getGestureTargetLocators()) {
for (int i = 0; i < locators.size(); i++) {
final GestureTargetLocator locator = locators.get(i);
final @Nullable UiElement newTarget = locator.locate(view, x, y, targetType);
if (newTarget != null) {
if (targetType == UiElement.Type.CLICKABLE) {
Expand Down
2 changes: 1 addition & 1 deletion sentry-compose/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
-keepnames class androidx.compose.foundation.CombinedClickableElement
-keepnames class androidx.compose.foundation.ScrollingLayoutElement
-keepnames class androidx.compose.ui.platform.TestTagElement { *; }
-keepnames class io.sentry.compose.SentryModifier.SentryTagModifierNodeElement { *; }
-keepnames class io.sentry.compose.SentryModifier$SentryTagModifierNodeElement { *; }

# R8 will warn about missing classes if people don't have androidx.compose-navigation on their
# classpath, but this is fine, these classes are used in an internal class which is only used when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ internal class SentryComposeHelper(logger: ILogger) {
loadField(logger, "androidx.compose.ui.platform.TestTagElement", "tag")

private val sentryTagElementField: Field? =
loadField(logger, "io.sentry.compose.SentryModifier.SentryTagModifierNodeElement", "tag")
loadField(logger, "io.sentry.compose.SentryModifier${'$'}SentryTagModifierNodeElement", "tag")

fun extractTag(modifier: Modifier): String? {
val type = modifier.javaClass.canonicalName
val type = modifier.javaClass.name
// Newer Jetpack Compose uses TestTagElement as node elements
// See
// https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TestTag.kt;l=34;drc=dcaa116fbfda77e64a319e1668056ce3b032469f
Expand All @@ -31,7 +31,7 @@ internal class SentryComposeHelper(logger: ILogger) {
) {
val value = testTagElementField.get(modifier)
return value as String?
} else if ("io.sentry.compose.SentryModifier.SentryTagModifierNodeElement" == type &&
} else if ("io.sentry.compose.SentryModifier${'$'}SentryTagModifierNodeElement" == type &&
sentryTagElementField != null
) {
val value = sentryTagElementField.get(modifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT
var isScrollable = false

val modifiers = node.getModifierInfo()
for (modifierInfo in modifiers) {
for (index in modifiers.indices) {
val modifierInfo = modifiers[index]
val tag = composeHelper!!.extractTag(modifierInfo.modifier)
if (tag != null) {
lastKnownTag = tag
Expand All @@ -93,7 +94,7 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT
} else {
val modifier = modifierInfo.modifier
// Newer Jetpack Compose 1.5 uses Node modifiers for clicks/scrolls
val type = modifier.javaClass.canonicalName
val type = modifier.javaClass.name
if ("androidx.compose.foundation.ClickableElement" == type ||
"androidx.compose.foundation.CombinedClickableElement" == type
) {
Expand Down
Loading