Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Compose widgets are not being correctly identified #3209

Merged
merged 2 commits into from
Feb 16, 2024
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 @@ -7,6 +7,10 @@
- Add new threshold parameters to monitor config ([#3181](https://github.com/getsentry/sentry-java/pull/3181))
- Report process init time as a span for app start performance ([#3159](https://github.com/getsentry/sentry-java/pull/3159))

## Fixes

- Fix Jetpack Compose widgets are not being correctly identified for user interaction tracing ([#3209](https://github.com/getsentry/sentry-java/pull/3209))

## 7.3.0

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ public ComposeGestureTargetLocator(final @NotNull ILogger logger) {
}
}

@Nullable String targetTag = null;

if (!(root instanceof Owner)) {
return null;
}

final @NotNull Queue<LayoutNode> queue = new LinkedList<>();
queue.add(((Owner) root).getRoot());

// the final tag to return
@Nullable String targetTag = null;

// the last known tag when iterating the node tree
@Nullable String lastKnownTag = null;
while (!queue.isEmpty()) {
final @Nullable LayoutNode node = queue.poll();
if (node == null) {
Expand All @@ -66,7 +69,6 @@ public ComposeGestureTargetLocator(final @NotNull ILogger logger) {
if (node.isPlaced() && layoutNodeBoundsContain(composeHelper, node, x, y)) {
boolean isClickable = false;
boolean isScrollable = false;
@Nullable String testTag = null;

final List<ModifierInfo> modifiers = node.getModifierInfo();
for (ModifierInfo modifierInfo : modifiers) {
Expand All @@ -83,7 +85,7 @@ public ComposeGestureTargetLocator(final @NotNull ILogger logger) {
isClickable = true;
} else if ("SentryTag".equals(key) || "TestTag".equals(key)) {
if (entry.getValue() instanceof String) {
testTag = (String) entry.getValue();
lastKnownTag = (String) entry.getValue();
}
}
}
Expand All @@ -100,10 +102,10 @@ public ComposeGestureTargetLocator(final @NotNull ILogger logger) {
}

if (isClickable && targetType == UiElement.Type.CLICKABLE) {
targetTag = testTag;
targetTag = lastKnownTag;
}
if (isScrollable && targetType == UiElement.Type.SCROLLABLE) {
targetTag = testTag;
targetTag = lastKnownTag;
// skip any children for scrollable targets
break;
}
Expand Down
Loading