GVFS MTP uploaded images are not indexed by Android gallery
If image file are written to Android device via fuse mount point, they are not indexed correctly. They are not visible in Gallery and other apps, however file managers can see them. Then can also be selected directly, but not with Gallery. Some tricks with manual indexing/Rescan tools help. If image files are sent to Android phone via GUI (Nautilus), they immediately appear in Gallery and are visible for all apps.
The problem is caused by mtpfile->filetype = LIBMTP_FILETYPE_UNKNOWN in gvfs/daemon/gvfsbackendmtp.c, do_create() It prevents android indexer from handling new files correctly.
Correct indexing happens when sending via GUI (Nautilus) which use do_push() with explicitly specified mtpfile->filetype derived from mime type of source file.
Other tools those upload files correctly and examples in libmtp set mtpfile->filetype according to filename/extension. It would be great to implement such mechanism in GVFS MTP
adb logs:
09-29 14:44:41.838 19668 25267 D MtpServer: path: /storage/emulated/0/Download/DSCN1429.JPG parent: 17 storageID: 00010001
09-29 14:44:41.864 19668 25267 D skia : --- Failed to create image decoder with message 'unimplemented'
vs
09-29 14:49:25.575 19668 25267 D MtpServer: path: /storage/emulated/0/Download/DSCN1429.JPG parent: 17 storageID: 00010001
09-29 14:49:25.688 19668 25267 W ExifInterface: Skip the tag entry since tag number is not defined: 34864
09-29 14:49:25.688 19668 25267 W ExifInterface: Skip the tag entry since tag number is not defined: 2
09-29 14:49:25.688 19668 25267 W ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
09-29 14:49:25.689 19668 25267 I chatty : uid=10031(com.android.providers.media) MtpServer identical 2 lines
09-29 14:49:25.689 19668 25267 W ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0