Fixed
Status Update
Comments
se...@google.com <se...@google.com>
ke...@google.com <ke...@google.com>
ke...@google.com <ke...@google.com>
ke...@google.com <ke...@google.com>
pr...@google.com <pr...@google.com> #3
Thanks for the report!
Description
Jetpack Compose version: 1.5.0
Jetpack Compose component used: material3: 1.1.1
Android Studio Build: Android Studio Giraffe | 2022.3.1
Kotlin version: 1.9.0
In our scenario, we open a ModalBottomSheet in order to edit or submit payment card details. We need to prevent the contents of the sheet from being screenshot, recorded, etc. For that purpose we typically set WindowManager.LayoutParams.FLAG_SECURE flag on a parent's activity's window. This work fine for regular composables, but not for bottomSheets.
Steps to Reproduce or Code Sample to Reproduce:
I suspect that the responsible code resides in ModalBottomSheetWindow class and it's params that are not considering the parent activity's flags and/or does not allow to specify the flags. Also,
type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL
might play some role, as the panel is AFAIK placed in a different window above the application.I was able to prevent screenshots/recording from happening by adding another view to the WindowManager in a similar manner to what ModalBottomSheetWindow is doing in it's show() function, only with the proper flag being set and making a sub_panel, to be placed above the bottomSheet.