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

Toggle to prevent screenshots #56

Open
jcperil opened this issue Aug 13, 2023 · 2 comments
Open

Toggle to prevent screenshots #56

jcperil opened this issue Aug 13, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jcperil
Copy link

jcperil commented Aug 13, 2023

"Swipe three fingers to take a screenshot" is a feature that is very useful to me. So, I keep it enabled all the time. However, as you can imagine, when my cousin (1 yr old) plays PianOli, she often ends up taking screenshots of PianOli screen.

Can you please add a toggle in the settings so that we can disable screenshots inside the app? Thank you.

@juleskers
Copy link
Collaborator

(drive by input from another PianOli enthusiast)

I'd never considered this as a problem, but that seems like a very good use-case!

I wondered why my own two-year old never produced a screenshot yet, and it seems "Swipe three fingers to take a screenshot" is a Xiaomi- and OnePlus special, according to this list of ways to take screenshots on androids (Android Authority, beware of trackers)
Samsung also offers a "palm swipe"-option, so it seems the user-base for gesture-triggered screenshots is "very large"

I did some research into how other apps do this, and it seems the answer is to mark the window/screen/fragment as "LayoutParams.FLAG_SECURE".
I'm guessing this goes somewhere on the piano-screen, but is not needed for the (adult-only?) settings Activity.

in general, I only know "prevent screenshots" from privacy-sensitive apps such as banks or chat-apps (e.g. encrypted chats in signal don't render a preview).
As such, it would surprise me a little to see this security-related feature used in a baby-app, so some clarification may be useful under the option,e.g.

Prevent screenshots. Useful on devices with gesture-triggered screenshots. Marks the piano screen as "secure" to prevent accidental screenshots from flooding your gallery

A side effect of using this flag is that it will also prevent an app-preview in the application-switcher/most-recent-apps list.
This is good for apps with real privacy concerns (banks, etc), but overkill for PianOli.
It seems there is no way around this however, it's all-or-nothing.
Do note there seem some bugs in this, if an app has multiple screens/activities, and only some of them are secure, the app-preview will cache the most-recent non-secure view.
In pianoli's case, this would mean the preview always shows the settings screen. Not bad, but certainly not as colourful or recognisable/distinctive as the piano.

more details on StackOverflow:

@juleskers
Copy link
Collaborator

I'm labelling this as good first issue Good for newcomers , since I believe it can be done by a newcomer with a minor amount of experience in Android development.

I'm prepared to mentor this.

ToDo

  1. Add a settings toggle "disable screenshots"
  2. Translation strings (English only, WebLate will pitch in for other languages) for toggle-text and toggle description.
    • The screenshot in the opening post above is an excellent example we could copy as-is
  3. in PianoCanvas, add the "LayoutParams.FLAG_SECURE" if the settings-toggle is enabled.
  4. Test a debug-build on an actual device (I personally volunteer to do this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants