You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add window flags for the payment form and CVV component for payment UI - #305
Add a shared helper that manages window flags for the payment form and CVV component while they are shown. It resolves the hosting window (Activity, Fragment, dialog or bottom sheet), shares state between components on the same window, and restores the host app's settings afterwards.
Add unit tests and a README note.
Issue
Issue ticket number and link.
Proposed changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
Test Steps
If there's any functionality change, please list a step by step guide of how to verify the changes, and/or upload a screen recording for any visible changes.
For instance:
Go to the main screen
Tap on primary button
Verify the image is shown on the screen
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
Reviewers assigned
I have performed a self-review of my code and manual testing
Lint and unit tests pass locally with my changes
I have added tests that prove my fix is effective or that my feature works
I have added necessary documentation (if applicable)
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you choose the solution you did and what alternatives you considered, etc...
Add a shared helper that manages window flags for the payment form and
CVV component while they are shown. It resolves the hosting window
(Activity, Fragment, dialog or bottom sheet), shares state between
components on the same window, and restores the host app's settings
afterwards.
Add unit tests and a README note.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical lifecycle, dialog-window, and reference-counting defects can leave visible payment data without screenshot protection or keep an old window blocked after the UI is removed.
Adds shared screenshot and screen-capture protection for the payment form and CVV component, with per-window tracking intended to preserve the host app’s existing security settings.
Changes:
Introduces window resolution, secure-flag management, and shared reference counting.
Integrates protection into both payment UI entry points.
Adds registry unit tests and documents capture protection.
File
Description
README.md
Documents capture protection and flag restoration.
- Follow view attach and detach, so the setting moves with the view.
- Key all window types on the root view, so components share one count.
- Prefer the owning Window for Activity, Compose dialog and
DialogFragment hosts, and read current layout params on each update.
- Reapply the setting before each frame if the host resets it.
- Fix a JVM signature clash in the unit test and add tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The pre-draw callback can allow sensitive content to render before FLAG_SECURE takes effect, while hidden payment fragments can keep the flag set instead of restoring the host setting.
- Release while the view is hidden and reacquire before it is drawn
again, so hidden fragments restore the host's window settings.
- Wrap the window callback for reachable windows, so attribute updates
keep the setting before they reach the window manager.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Two lifecycle issues can leave screenshot blocking enabled after the payment UI is hidden or removed: clearing the wrong target and a stale pre-draw watcher reapplying FLAG_SECURE.
If a WindowSecureTarget acquires first and a RootViewSecureTarget for the same decor view releases last, restoration uses the wrong target. When the root's layout parameters are a separate copy, the final clear leaves Window.attributes secure, so a later window attribute update re-enables screenshot blocking after both components are gone. Retain the acquiring target in Entry and use it for the final clear.
- Make the pre-draw watcher a no-op once stopped, since an in-progress
dispatch still calls removed listeners.
- Clear the flag through the target that acquired the window.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re the previously missed issue in the latest review (restoring through the acquiring target): fixed in dc19a11. The registry entry keeps the target that acquired the window and uses it for the final clear. Added a unit test.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Screenshot protection depends on Android callback and rendering timing across Activity and dialog hosts, requiring device-level validation of capture prevention and lifecycle restoration beyond the registry-only JVM tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a shared helper that manages window flags for the payment form and CVV component while they are shown. It resolves the hosting window (Activity, Fragment, dialog or bottom sheet), shares state between components on the same window, and restores the host app's settings afterwards.
Add unit tests and a README note.
Issue
Issue ticket number and link.
Proposed changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
Test Steps
If there's any functionality change, please list a step by step guide of how to verify the changes, and/or upload a screen recording for any visible changes.
Checklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you choose the solution you did and what alternatives you considered, etc...