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/screenshot masking during changes #2553

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

vaind
Copy link
Collaborator

@vaind vaind commented Jan 7, 2025

📜 Description

We're facing an issue: the tree walked with visitChildElements() is out of sync to what is currently rendered by RenderRepaintBoundary.toImage(), even though there's no async gap between these two. This causes masks to be off during repaints, e.g. when scrolling a view or when text is rendered in different places between two screens. This is most easily reproducible when there's no animation between the two screens.

For example, Spotube's Search vs Library (2nd and 3rd bottom bar buttons). The following composition of three subsequent frames shows the transition. Note the special mode of rendering which prints masks (in the color that the text was in the original button) and then writes the text that is being masked in bright green. This way you can see that the masks move over to their new position (about 30 px higher then before) when the screen changes, but the captured image still renders the previous version of the screen. I've added a red guideline to make this change easier to see.

image

I've created an issue upstream to try and get this resolved "properly". As an interim solution, we're taking two subsequent screenshots (two frames) and only actually capture a screenshot for replay if the two are exactly the same.

💡 Motivation and Context

💚 How did you test it?

manually as I could not reproduce the masking issue programatically

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

Copy link
Contributor

github-actions bot commented Jan 7, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • flutter/lib/src/screenshot/recorder.dart

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 95.74468% with 6 lines in your changes missing coverage. Please review.

Project coverage is 92.45%. Comparing base (0c08054) to head (134b015).

Files with missing lines Patch % Lines
flutter/lib/src/screenshot/stabilizer.dart 88.09% 5 Missing ⚠️
flutter/lib/src/screenshot/screenshot.dart 97.14% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2553      +/-   ##
==========================================
+ Coverage   87.15%   92.45%   +5.29%     
==========================================
  Files         266       92     -174     
  Lines        9447     3180    -6267     
==========================================
- Hits         8234     2940    -5294     
+ Misses       1213      240     -973     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Jan 7, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1242.35 ms 1261.10 ms 18.76 ms
Size 8.42 MiB 9.89 MiB 1.46 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
c732386 1233.20 ms 1252.08 ms 18.88 ms
934f10e 1245.18 ms 1263.77 ms 18.59 ms
dd933d4 1238.73 ms 1252.43 ms 13.70 ms
e3d9076 1203.68 ms 1230.65 ms 26.97 ms
1b0c8a3 1259.30 ms 1282.78 ms 23.48 ms
02661eb 1244.45 ms 1252.37 ms 7.92 ms
1a93825 1257.25 ms 1261.55 ms 4.30 ms
00236a7 1250.06 ms 1274.00 ms 23.94 ms
8a10ab7 1226.49 ms 1250.52 ms 24.03 ms
3f23617 1261.93 ms 1286.10 ms 24.17 ms

App size

Revision Plain With Sentry Diff
c732386 8.28 MiB 9.33 MiB 1.05 MiB
934f10e 8.38 MiB 9.77 MiB 1.39 MiB
dd933d4 8.33 MiB 9.64 MiB 1.31 MiB
e3d9076 8.33 MiB 9.40 MiB 1.07 MiB
1b0c8a3 8.38 MiB 9.75 MiB 1.37 MiB
02661eb 8.42 MiB 9.86 MiB 1.44 MiB
1a93825 8.28 MiB 9.34 MiB 1.05 MiB
00236a7 8.38 MiB 9.77 MiB 1.39 MiB
8a10ab7 8.28 MiB 9.34 MiB 1.06 MiB
3f23617 8.16 MiB 9.17 MiB 1.01 MiB

Previous results on branch: fix/screenshot-masking-during-changes

Startup times

Revision Plain With Sentry Diff
e7ab100 1247.94 ms 1269.72 ms 21.78 ms
46acddd 1260.54 ms 1269.52 ms 8.98 ms
d0c6c01 1238.92 ms 1250.12 ms 11.20 ms
f64b602 1259.35 ms 1276.78 ms 17.43 ms
9d4a3f9 1246.96 ms 1257.80 ms 10.84 ms
9bedc01 1238.04 ms 1267.28 ms 29.24 ms
0418629 1246.12 ms 1256.69 ms 10.57 ms
4439231 1253.86 ms 1273.80 ms 19.94 ms

App size

Revision Plain With Sentry Diff
e7ab100 8.42 MiB 9.89 MiB 1.46 MiB
46acddd 8.42 MiB 9.89 MiB 1.46 MiB
d0c6c01 8.42 MiB 9.88 MiB 1.46 MiB
f64b602 8.42 MiB 9.89 MiB 1.46 MiB
9d4a3f9 8.42 MiB 9.88 MiB 1.46 MiB
9bedc01 8.42 MiB 9.88 MiB 1.46 MiB
0418629 8.42 MiB 9.89 MiB 1.46 MiB
4439231 8.42 MiB 9.88 MiB 1.46 MiB

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 454.72 ms 543.52 ms 88.80 ms
Size 6.46 MiB 7.48 MiB 1.02 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
4b943a1 348.17 ms 437.15 ms 88.98 ms
1596141 300.92 ms 368.94 ms 68.02 ms
afa6e2a 349.73 ms 428.48 ms 78.75 ms
9e7630d 449.43 ms 475.82 ms 26.39 ms
ee0ca56 355.35 ms 421.13 ms 65.78 ms
07cd9e8 427.71 ms 461.23 ms 33.52 ms
2e93bab 515.33 ms 558.79 ms 43.46 ms
9a5040f 490.15 ms 563.98 ms 73.83 ms
f735167 404.38 ms 412.57 ms 8.19 ms
3adbea9 395.16 ms 447.88 ms 52.71 ms

App size

Revision Plain With Sentry Diff
4b943a1 6.34 MiB 7.28 MiB 968.41 KiB
1596141 6.16 MiB 7.14 MiB 1003.98 KiB
afa6e2a 6.27 MiB 7.20 MiB 955.69 KiB
9e7630d 6.49 MiB 7.56 MiB 1.07 MiB
ee0ca56 6.33 MiB 7.30 MiB 992.52 KiB
07cd9e8 6.49 MiB 7.56 MiB 1.07 MiB
2e93bab 6.49 MiB 7.55 MiB 1.07 MiB
9a5040f 6.46 MiB 7.48 MiB 1.01 MiB
f735167 6.46 MiB 7.48 MiB 1.01 MiB
3adbea9 6.52 MiB 7.61 MiB 1.09 MiB

Previous results on branch: fix/screenshot-masking-during-changes

Startup times

Revision Plain With Sentry Diff
622d859 461.53 ms 541.56 ms 80.03 ms
46acddd 453.18 ms 518.50 ms 65.32 ms
d0c6c01 483.34 ms 564.12 ms 80.78 ms
9d4a3f9 442.54 ms 510.83 ms 68.29 ms
f64b602 472.37 ms 562.30 ms 89.93 ms
9bedc01 454.42 ms 500.27 ms 45.84 ms
0418629 463.96 ms 507.52 ms 43.57 ms
e7ab100 423.96 ms 480.76 ms 56.80 ms
4439231 456.56 ms 554.10 ms 97.54 ms

App size

Revision Plain With Sentry Diff
622d859 6.46 MiB 7.48 MiB 1.02 MiB
46acddd 6.46 MiB 7.48 MiB 1.02 MiB
d0c6c01 6.46 MiB 7.48 MiB 1.01 MiB
9d4a3f9 6.46 MiB 7.48 MiB 1.02 MiB
f64b602 6.46 MiB 7.48 MiB 1.02 MiB
9bedc01 6.46 MiB 7.48 MiB 1.02 MiB
0418629 6.46 MiB 7.48 MiB 1.02 MiB
e7ab100 6.46 MiB 7.48 MiB 1.02 MiB
4439231 6.46 MiB 7.48 MiB 1.02 MiB

@vaind vaind force-pushed the fix/screenshot-masking-during-changes branch from f64b602 to f62e5ee Compare January 10, 2025 11:05
@vaind vaind marked this pull request as ready for review January 11, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant