Conversations icon indicating copy to clipboard operation
Conversations copied to clipboard

Image upload is sometimes extremly slow

Open iNPUTmice opened this issue 3 years ago • 2 comments

Sometimes it takes a noticeable amount of time to attach an image. There is no pattern to it. Here is a log. Notice the 30 seconds between reading bitmap with sample size 1 and send file message

01-17 07:50:40.297  7263  7263 D conversations: guessMimeTypeFromUriAndMime content://com.android.providers.media.documents/document/image%3A2619 and mime=image/jpeg
01-17 07:50:40.337  7263  7263 D conversations: attachImage: type=1
01-17 07:50:40.338  7263 17843 D conversations: copy image (content://com.android.providers.media.documents/document/image%3A2619) to private storage /storage/emulated/0/Conversations/Media/Conversations Images/3515b1dd-8b99-4413-9a93-c2912f01379a.jpg
01-17 07:50:40.392  7263  7263 D conversations: received uri permission for content://com.android.providers.media.documents/document/image%3A2619
01-17 07:50:40.419  7263 17843 D conversations: reading bitmap with sample size 1
01-17 07:51:11.149  7263 17843 D conversations: send file message
01-17 07:51:11.153  7263 17843 D conversations: using 12-byte IV for file transmission
01-17 07:51:11.219  7263   756 D conversations: uploading file to https://***/daniel/***.jpg?v=***
01-17 07:51:11.646  7263 19175 D conversations: finished uploading file

iNPUTmice avatar Jan 17 '22 07:01 iNPUTmice

I blame SAF for that.

Eg. Since targetsdk 30 apps are more and more limited on what paths they can access on storage.

licaon-kter avatar Jan 17 '22 09:01 licaon-kter

I've added some more detailed logs and it seems that the compress+write operation is slowing things down (rather than the image read); Which matches the observation that the pre send thumbnail is displayed instantly.

01-18 09:28:22.576 23578 24228 D conversations: copy image (content://com.android.providers.media.documents/document/image%3A2629) to private storage /storage/emulated/0/Conversations/Media/Conversations Images/6dca80fa-584e-4028-b0dc-ec0b136d3c30.jpg
01-18 09:28:22.625 23578 23578 D conversations: received uri permission for content://com.android.providers.media.documents/document/image%3A2629
01-18 09:28:22.647 23578 24228 D conversations: reading bitmap with sample size 1
01-18 09:28:22.812 23578 24228 D conversations: compressing image with quality 75
…
01-18 09:28:48.605 23578 24228 D conversations: achieved file size of 250022
01-18 09:28:48.628 23578 24228 D conversations: send file message
01-18 09:28:48.633 23578 24228 D conversations: using 12-byte IV for file transmission
01-18 09:28:48.723 23578 22106 D conversations: uploading file to https://***/daniel/***.jpg?v=***
01-18 09:28:49.246 23578 13516 D conversations: finished uploading file

iNPUTmice avatar Jan 18 '22 08:01 iNPUTmice