FLAG_SECURE not working on Google Pixel devices


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?

1
Jun 19 at 4:05 PM
User AvatarSyed Uzair Jamal
#android#debug-symbols

No answer found for this question yet.