1

On Android 12, if I create an simple app with WindowManager.LayoutParams.FLAG_SECURE

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        window.setFlags(
            WindowManager.LayoutParams.FLAG_SECURE,
            WindowManager.LayoutParams.FLAG_SECURE
        )
        setContentView(R.layout.activity_main)
    }
}

the window does not secure if I try to switch apps

enter image description here

however, if I switch back, the window does secure

enter image description here

In both cases, switching to or from, the window secures on Android 11, but not on Android 12. Any idea why?

the_prole
  • 7,471
  • 14
  • 64
  • 141
  • Check this link https://stackoverflow.com/questions/28606689/how-to-prevent-screen-capture-in-android Hope this helps. – rasfarrf5 May 05 '22 at 08:17

0 Answers0