On Tue, Jul 17, 2012 at 12:21 PM, String <[email protected]> wrote:
> Now that I have a JB device in-hand, I've found a sneaky little problem with
> the new READ_EXTERNAL_STORAGE permission. Specifically, if you pass another
> app a URI - say via a ContentProvider - that uses the "file://" protocol,
> then the receiving app NEEDS the new permission in order to read from that
> URI.

If the file:// URI is pointing to external storage, that is not
terribly surprising.

> Thus, the new permission has the (presumably unintended) potential to
> break an unknown number of existing apps when it enters production: their
> ContentProviders will suddenly cease to work.

It's more that anyone using URI values from third-party sources need
to add the permission, if there is a chance that such URI values point
to external storage. They would already need WRITE_EXTERNAL_STORAGE if
they would try writing to such URIs, though admittedly that is less
common.

> One solution would obviously be to report this as a bug in Launcher, and for
> the appropriate team at Google to add READ_EXTERNAL_STORAGE to its
> permissions. Not a great solution, though, because it only fixes this single
> case. All other homescreen-replacement apps, from everyone from OEMs to
> indie devs, would need to make the same change. And I can promise you some
> won't.

Which means you can't reliably use your workaround anymore.

> Another possible solution would be for me to keep these images in internal
> storage, making them world-readable so the URI recipient can read them. I
> haven't tested this to see if it'll work, but even assuming it does, it's a
> change that anyone who generates a file:// URI would need to make. And
> probably, some of them are generating URIs to files that can't reasonably be
> moved to internal storage. So we're back in the business of breaking
> existing apps.

Which is why we need to publicize this more. I have been holding off
doing so until I have JB hardware, which I will next week.

> I don't know the internals well enough, but is it possible that there's a
> solution that could be implemented at the platform level? That whatever
> platform mechanism fulfills file:// URIs would bypass the
> READ_EXTERNAL_STORAGE permission check?

That would pretty much eliminate the purpose of the permission.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to