getsentry / getsentry/sentry-java

Improve masking for PixelCopyStrategy unstable captures

Offen
#5,493 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Android Improvement Replays
Vorherrschende Sprache
Kotlin
Sterne
1.4k
Forks
478
Ø Merge
2 T. 23 Std.
Gemergte PRs (30 T.)
67

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.