When using the picker introduced with Android 13 via ActivityResultContracts.PickVisualMedia a Uri is returned (representing the selected media item):
content://media/picker/0/com.android.providers.media.photopicker/media/1000000198
If I use the content resolver and interrogate the cursor I get something like:
duration = 38003
orientation = 0
height = 2336
_display_name = 1000000198.mp4
datetaken = 1681826421000
mime_type = video/mp4
_data = /sdcard/.transforms/synthetic/picker/0/com.android.providers.media.photopicker/media/1000000198.mp4
_size = 9920806
width = 1072
The column usually used for the filename is OpenableColumns.DISPLAY_NAME (_display_name). However as you can tell the values here are just some garbage number filename and not the actual filename that was selected. This is NOT the actual filename of the selected video.
Is there any way to use this Android 13 photo/video picker and get the actual filename of the file the user selected and not this garbage number filename?
From my personal research I don't think it's possible to get the file/display name from the Photo Picker.
This is an open issue (at the time of writing) and Google hasn't responded to the request yet.
The only options I see at the moment are either accepting that we don't get the filename and hoping for a fix in the future or implementing your own file/photo picker (which then of course needs extra permissions because it's not a system app)