Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Session Replay: Fix `VerifyError` in Compose masking under DexGuard/R8 obfuscation ([#5507](https://github.com/getsentry/sentry-java/pull/5507))

## 8.43.1

### Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

package io.sentry.android.replay.util

import android.graphics.Rect
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorProducer
import androidx.compose.ui.graphics.painter.Painter
Expand Down Expand Up @@ -173,10 +173,10 @@
val boundsLeft = bounds.left.fastCoerceIn(0f, rootWidth)
val boundsTop = bounds.top.fastCoerceIn(0f, rootHeight)
val boundsRight = bounds.right.fastCoerceIn(0f, rootWidth)
val boundsBottom = bounds.bottom.fastCoerceIn(0f, rootHeight)

Check warning on line 176 in sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt

View check run for this annotation

@sentry/warden / warden: check-code-attribution

โš ๏ธ Missing THIRD_PARTY_NOTICES.md entry for vendored AndroidX code

**sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt** โ€” The `boundsInWindow` function is explicitly marked "A faster copy of" the AndroidX `LayoutCoordinates.boundsInWindow` (Apache 2.0, AOSP). No corresponding entry exists in `THIRD_PARTY_NOTICES.md`. Add an entry with Source URL, License name (Apache 2.0), Copyright (The Android Open Source Project), Scope, and the full Apache 2.0 license text.
Comment thread
sentry-warden[bot] marked this conversation as resolved.

if (boundsLeft == boundsRight || boundsTop == boundsBottom) {
return Rect()
return Rect(0.0f, 0.0f, 0.0f, 0.0f)
}

val topLeft = root.localToWindow(Offset(boundsLeft, boundsTop))
Expand All @@ -200,5 +200,9 @@
val top = fastMinOf(topLeftY, topRightY, bottomLeftY, bottomRightY)
Comment thread
sentry-warden[bot] marked this conversation as resolved.
val bottom = fastMaxOf(topLeftY, topRightY, bottomLeftY, bottomRightY)

return Rect(left.toInt(), top.toInt(), right.toInt(), bottom.toInt())
return Rect(left, top, right, bottom)
}

internal fun Rect.toRect(): android.graphics.Rect {
return android.graphics.Rect(left.toInt(), top.toInt(), right.toInt(), bottom.toInt())
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import io.sentry.android.replay.util.findPainter
import io.sentry.android.replay.util.findTextColor
import io.sentry.android.replay.util.isMaskable
import io.sentry.android.replay.util.toOpaque
import io.sentry.android.replay.util.toRect
import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.GenericViewHierarchyNode
import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode
import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode
Expand Down Expand Up @@ -150,8 +151,8 @@ internal object ComposeViewHierarchyNode {
// If we're unable to retrieve the semantics configuration
// we should play safe and mask the whole node.
return GenericViewHierarchyNode(
x = visibleRect.left.toFloat(),
y = visibleRect.top.toFloat(),
x = visibleRect.left,
y = visibleRect.top,
width = node.width,
height = node.height,
elevation = (parent?.elevation ?: 0f),
Expand All @@ -161,17 +162,17 @@ internal object ComposeViewHierarchyNode {
isImportantForContentCapture = false, // will be set by children
isVisible =
!SentryLayoutNodeHelper.isTransparent(node) &&
visibleRect.height() > 0 &&
visibleRect.width() > 0,
visibleRect = visibleRect,
visibleRect.height > 0 &&
visibleRect.width > 0,
visibleRect = visibleRect.toRect(),
)
}

val isVisible =
!SentryLayoutNodeHelper.isTransparent(node) &&
(semantics == null || !semantics.contains(SemanticsProperties.InvisibleToUser)) &&
visibleRect.height() > 0 &&
visibleRect.width() > 0
visibleRect.height > 0 &&
visibleRect.width > 0
Comment thread
cursor[bot] marked this conversation as resolved.
val isEditable =
semantics?.contains(SemanticsActions.SetText) == true ||
semantics?.contains(SemanticsProperties.EditableText) == true
Expand Down Expand Up @@ -206,8 +207,8 @@ internal object ComposeViewHierarchyNode {
null
},
dominantColor = textColor?.toArgb()?.toOpaque(),
x = visibleRect.left.toFloat(),
y = visibleRect.top.toFloat(),
x = visibleRect.left,
y = visibleRect.top,
width = node.width,
height = node.height,
elevation = (parent?.elevation ?: 0f),
Expand All @@ -216,7 +217,7 @@ internal object ComposeViewHierarchyNode {
shouldMask = shouldMask,
isImportantForContentCapture = true,
isVisible = isVisible,
visibleRect = visibleRect,
visibleRect = visibleRect.toRect(),
)
}
else -> {
Expand All @@ -226,8 +227,8 @@ internal object ComposeViewHierarchyNode {

parent?.setImportantForCaptureToAncestors(true)
ImageViewHierarchyNode(
x = visibleRect.left.toFloat(),
y = visibleRect.top.toFloat(),
x = visibleRect.left,
y = visibleRect.top,
width = node.width,
height = node.height,
elevation = (parent?.elevation ?: 0f),
Expand All @@ -236,7 +237,7 @@ internal object ComposeViewHierarchyNode {
isVisible = isVisible,
isImportantForContentCapture = true,
shouldMask = shouldMask && painter.isMaskable(),
visibleRect = visibleRect,
visibleRect = visibleRect.toRect(),
)
} else {
val shouldMask = isVisible && semantics.shouldMask(isImage = false, options)
Expand All @@ -245,8 +246,8 @@ internal object ComposeViewHierarchyNode {
// TODO: traverse the ViewHierarchyNode here again. For now we can recommend
// TODO: using custom modifiers to obscure the entire node if it's sensitive
GenericViewHierarchyNode(
x = visibleRect.left.toFloat(),
y = visibleRect.top.toFloat(),
x = visibleRect.left,
y = visibleRect.top,
width = node.width,
height = node.height,
elevation = (parent?.elevation ?: 0f),
Expand All @@ -255,7 +256,7 @@ internal object ComposeViewHierarchyNode {
shouldMask = shouldMask,
isImportantForContentCapture = false, // will be set by children
isVisible = isVisible,
visibleRect = visibleRect,
visibleRect = visibleRect.toRect(),
)
}
}
Expand Down
Loading