Glide: SecurityException when loading thumbnail on some devices

Created on 28 Jan 2019  Â·  11Comments  Â·  Source: bumptech/glide

Glide: 4.8.0
Integration: irrelevant (local image)
Device: some samsungs

We use glide to load preview from image selected using system picker. On some samsungs, it causes SecurityException, as apparently app does not have access to thumbnail of an image.
Actual resource uri is accessible, as we are still able to upload it.

We've migrated from picasso recently. We've had same issues with Picasso. Glide seemed to work ok, but apparently not on all devices.

How can we skip request for thumbnail?
Is it configurable?

bug

All 11 comments

Show exception log may help to solve the problem.

Sure, here it is:

E/DatabaseUtils: Writing exception to parcel
    java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/thumbnails from pid=16105, uid=10259 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
        at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:641)
        at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:507)
        at android.content.ContentProvider$Transport.query(ContentProvider.java:218)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:102)
        at android.os.Binder.execTransact(Binder.java:682)
2019-01-28 11:37:28.453 16105-21839/com.hidden.app E/LocalConsoleLoggingManager: Not uploading exceptions encountered in debug builds:
    java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/thumbnails from pid=16105, uid=10259 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
        at android.os.Parcel.readException(Parcel.java:1967)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
        at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
        at android.content.ContentResolver.query(ContentResolver.java:760)
        at android.content.ContentResolver.query(ContentResolver.java:710)
        at android.content.ContentResolver.query(ContentResolver.java:668)
        at com.bumptech.glide.load.data.mediastore.ThumbFetcher$ImageThumbnailQuery.query(ThumbFetcher.java:158)
        at com.bumptech.glide.load.data.mediastore.ThumbnailStreamOpener.getPath(ThumbnailStreamOpener.java:93)
        at com.bumptech.glide.load.data.mediastore.ThumbnailStreamOpener.open(ThumbnailStreamOpener.java:71)
        at com.bumptech.glide.load.data.mediastore.ThumbFetcher.openThumbInputStream(ThumbFetcher.java:71)
        at com.bumptech.glide.load.data.mediastore.ThumbFetcher.loadData(ThumbFetcher.java:58)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:62)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:272)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

I have the same problem

I think (and tests confirm that) everyone without 'storage read' permission
is affected on one device or another. I'll look around for a workaround
when I have some time in the coming weeks.

On Tue, 12 Feb 2019, 12:22 krsoaiheim, notifications@github.com wrote:

I have the same problem

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/bumptech/glide/issues/3504#issuecomment-462721803,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGV5GRRvDy0NAn9mCC5M8Q1CHtadKqG4ks5vMqPvgaJpZM4aVqNE
.

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

You'll need to get the read storage permission for your app to load images from media store. How would you like Glide to help you here?

That's not true @sjudd because I'm granted temporary access by picker activity ('We use glide to load preview from image selected using system picker') which is confirmed as I can access resource directly ('Actual resource uri is accessible, as we are still able to upload it'). Only glide attempts to load thumbnail that apparently has system-specific bugs.

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

Got it thanks for clarifying.

So you have Uri permissions for content://media/external/images/media/ but accessing the equivalent thumbnail with content://media/external/images/thumbnails/ fails.

Internal issue is b/126712454, but we can work around this in Glide without a framework change.

Was this page helpful?
0 / 5 - 0 ratings