-
-
Notifications
You must be signed in to change notification settings - Fork 371
fix(session-replay): Include layer background color when checking if a view is opaque #6629
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
Conversation
Added expectations to verify the animation state during redaction, ensuring the position of the masked region is within the expected range during animation. This improves the robustness of the edge case tests for UI redaction.
…se tests Updated the animation duration and expectations in the edge case tests for UI redaction. The assertions now verify that the position of the masked region is approximately at the midpoint of the animation, enhancing the accuracy of the tests.
❌ 1 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9cbff30 | 1236.33 ms | 1254.35 ms | 18.03 ms |
| 52603c5 | 1229.35 ms | 1251.82 ms | 22.47 ms |
| b57ee62 | 1218.21 ms | 1248.94 ms | 30.73 ms |
| ea5a59b | 1222.87 ms | 1253.47 ms | 30.60 ms |
| 449d185 | 1216.31 ms | 1251.94 ms | 35.62 ms |
| a9fac2e | 1212.45 ms | 1219.67 ms | 7.22 ms |
| f5d202b | 1237.90 ms | 1259.49 ms | 21.59 ms |
| 884b224 | 1233.41 ms | 1259.50 ms | 26.09 ms |
| 7cc23cf | 1203.15 ms | 1232.11 ms | 28.96 ms |
| 4e3915a | 1230.02 ms | 1258.90 ms | 28.88 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9cbff30 | 23.75 KiB | 928.15 KiB | 904.40 KiB |
| 52603c5 | 23.75 KiB | 969.66 KiB | 945.92 KiB |
| b57ee62 | 23.75 KiB | 912.47 KiB | 888.72 KiB |
| ea5a59b | 23.75 KiB | 874.46 KiB | 850.71 KiB |
| 449d185 | 23.75 KiB | 980.81 KiB | 957.06 KiB |
| a9fac2e | 23.75 KiB | 879.53 KiB | 855.78 KiB |
| f5d202b | 23.75 KiB | 904.53 KiB | 880.78 KiB |
| 884b224 | 23.75 KiB | 879.60 KiB | 855.86 KiB |
| 7cc23cf | 23.75 KiB | 913.62 KiB | 889.87 KiB |
| 4e3915a | 23.75 KiB | 858.69 KiB | 834.94 KiB |
Previous results on branch: itay/improve_opaque_logic
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8858a16 | 1225.98 ms | 1255.96 ms | 29.98 ms |
| 6b1198e | 1212.35 ms | 1245.35 ms | 32.99 ms |
| 27fdaa1 | 1232.08 ms | 1265.20 ms | 33.11 ms |
| 65af6ea | 1219.83 ms | 1250.20 ms | 30.37 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8858a16 | 23.75 KiB | 1.01 MiB | 1016.01 KiB |
| 6b1198e | 23.75 KiB | 1023.93 KiB | 1000.19 KiB |
| 27fdaa1 | 23.75 KiB | 1.02 MiB | 1019.46 KiB |
| 65af6ea | 23.75 KiB | 1.02 MiB | 1016.57 KiB |
|
I followed up the investigation and confirm the issue and the fix:
let popup = PopupDialog(
title: "THIS IS THE DIALOG TITLE",
message: "This is the message section of the popup dialog default view",
)
let overlayAppearance = PopupDialogOverlayView.appearance()
overlayAppearance.color = .red
overlayAppearance.blurEnabled = false
overlayAppearance.liveBlurEnabled = false
overlayAppearance.opacity = 0.2
self.present(popup, animated: true) {
print(self.view.window!.value(forKey: "recursiveDescription")!)
}
|
|
The changes of this PR will also need to be released as a hotfix in v8 |
|
Converting back to draft because the sample did not properly mask. |
|
I made masking stricter to stop semi‑transparent overlays from unmasking things underneath. Some overlays (like PopupDialog) add a see‑through tint as a child view on top of a clear container. Our old check could think the container was “opaque” and clear redactions behind it. Now, a view only clears what’s behind it if it’s truly opaque:
This protects privacy and worst case we do a bit less “clip‑out” optimization, leaving more masking in than necessary. I also updated tests to explicitly set opaque props when they expect clip‑out. Next Step:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an improvement, but I can still think of edge cases. For example what if you use UIColor(patternImage: ) I don't know what the opacity of this will be, but you could use an image that has some transparent regions. I wonder why we even need this, what if we just went ahead and masked on top of things even if they were covered by another view. I don't think that would hurt performance or anything a noticeable amount. IMO our long term strategy should be to do some simplifying things like that, rather than adding more edge cases
We might need another unit test for that, but I would actually limit the scope on this PR for now so we can get it merged.
AFAIK the clipping is also necessary for modal views. If we do not use clipping to remove regions covered by an opaque view, presenting a modal would use the regions underneath it, hiding more information than necessary, therefore hiding actual UI.
At some point we could consider not doing selective masking and just (safely) blur the entire screen. Replay users would see a rough idea of the screen and no details, but also no leaks |
|
I tested masking the sample app and it seems to mostly work: I found one more masking issue at 00:24 which needs to be investigated. EDIT: |

📜 Description
Improve check for view opaqueness
💡 Motivation and Context
User's (or libraries) can override UIView's
backgroundColorand report a report different value (example).Since UIView are wrappers around
CALayer. we should consider using the actual layers properties too.This is draft because I have to verify this actually works
💚 How did you test it?
Run the app with Session Replay enabled and view the output.
Still needs more tests with popups and custom views
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.Closes #6634