Skip to content

FLAG_SECURE not working on Google Pixel devices #2132

Description

@Uzair-Jamal

Is there an existing issue for this?

  • I have searched the existing issues

Is there a StackOverflow question about this issue?

  • I have searched StackOverflow

What happened?

I am developing an Android application using the View/XML approach and need to prevent screenshots and screen recordings. To achieve this, I have enabled FLAG_SECURE using:

window?.addFlags(WindowManager.LayoutParams.FLAG_SECURE)

window?.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
This works as expected on most devices, where screenshots and screen recordings are blocked successfully.

However, I have observed different behavior on Google Pixel devices (tested on Pixel 4 and Pixel 9). When a video is played in fullscreen mode using JW Player, users are still able to capture the screen, suggesting that FLAG_SECURE is not being enforced for the fullscreen video view.

Am I missing any additional configuration or implementation step for fullscreen video playback with JW Player? Does JW Player create a separate window/activity that requires FLAG_SECURE to be applied separately?

Additional details:

UI framework: View/XML (not Compose)

Video player: JW Player

Devices tested: Google Pixel 4 and Pixel 9

Android versions: 16 & 13

No errors or crashes are observed; the issue is only that screen capture is not blocked during fullscreen playback.

What could be causing FLAG_SECURE to be ineffective in this specific fullscreen video scenario on Pixel devices?

Relevant logcat output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions