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

Hide app content when app is in background #2442

Closed
sosnovsky opened this issue Aug 30, 2023 · 6 comments · Fixed by #2444
Closed

Hide app content when app is in background #2442

sosnovsky opened this issue Aug 30, 2023 · 6 comments · Fixed by #2444
Assignees
Milestone

Comments

@sosnovsky
Copy link
Collaborator

details - https://github.com/FlowCrypt/flowcrypt-security/issues/264

@sosnovsky sosnovsky added this to the 1.4.7 milestone Aug 30, 2023
@DenBond7 DenBond7 modified the milestones: 1.4.7, 1.4.6 Aug 30, 2023
@DenBond7
Copy link
Collaborator

@sosnovsky I can add

window.setFlags(
            WindowManager.LayoutParams.FLAG_SECURE,
            WindowManager.LayoutParams.FLAG_SECURE
)

image

But this will disable making screenshots too. Do we need the ability to make screenshots in the app?

@DenBond7
Copy link
Collaborator

For history. ref https://issuetracker.google.com/issues/237190495

@sosnovsky
Copy link
Collaborator Author

Yes, I think taking screenshots should still be allowed in the app. Maybe it's possible to apply this flag only when app is in background, like described here - https://stackoverflow.com/a/49442984/3091318 ?

@sosnovsky
Copy link
Collaborator Author

Also there is setRecentsScreenshotEnabled property added in Android 12, we can use it for Android 12+, and View#onWindowFocusChanged(boolean) for older versions. What do you think, will it work?

@DenBond7
Copy link
Collaborator

Yes, I think taking screenshots should still be allowed in the app. Maybe it's possible to apply this flag only when app is in background, like described here - https://stackoverflow.com/a/49442984/3091318 ?

Yes, it's possible. Also, need to add that starting from Android 12 we have a little different behavior. Please look at the example
ezgif com-optimize
Content will be hidden after switching to other apps. (At this stage the app will have a paused state)

@sosnovsky
Copy link
Collaborator Author

Looks good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants