getsentry / getsentry/sentry-java

Improve masking for PixelCopyStrategy unstable captures

未关闭
#5,493 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
Android Improvement Replays
主要语言
Kotlin
星标
1.4k
派生
478
平均合并
2 天 23 小时
30 天内合并 PR
67

描述

### Description

from @0xadam-brown

> Not sure if we want the extra security, but we could also consider:
>
> increasing the mask size when recording unstable captures, or
> covering the view's entire range of possible positions during the unstable window, ie, the union of where it was (in the pixels, time T) and where the hierarchy thinks it is (T+delta).

I put this into codex, and this is its analysis:
```
Option 1, "increase mask size for unstable captures," is the only reasonably small one. Mechanically it's not huge: add an unstableMaskPaddingPx or similar parameter to
MaskRenderer.renderMasks(...), inflate mask rects when changedDuringCapture == true, clamp them, and update debug overlay/tests. The tricky part is picking a padding that actually helps
without making replay look over-masked. A fixed 8-16dp helps slow movement, but won't cover fast animations, scrolling, shared-element transitions, keyboard movement, etc.

Option 2, "union where it was and where hierarchy thinks it is," is a much bigger lift. We don't currently have a hierarchy snapshot at PixelCopy's exact copy time. To approximate it,
we'd need to capture hierarchy before PixelCopy and after PixelCopy, then match nodes across snapshots. That gets messy for Compose nodes, text line masks, list recycling, visibility
changes, and any node without stable identity. It also adds more main-thread traversal work, which works against the ANR/perf goal.
```

so this probably needs some refinement/further brainstorming

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。