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
however, if I switch back, the window does secure
In both cases, switching to or from, the window secures on Android 11, but not on Android 12. Any idea why?