Throwing this out for discussion here...

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. 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.

I ran into this because I've re-implemented most of my AppWidgets to use 
file:// URIs for their imagery, rather than passing the bitmap directly 
through RemoteViews. [This was done as a workaround for 
http://code.google.com/p/android/issues/detail?id=17509.] And it works fine 
unless you enable the READ_EXTERNAL_STORAGE check on JB hardware, at which 
point the images fail to load due to a permission failure from Launcher.

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.

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.

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?

Or is this by design, platform team? If so, I think it really needs to be 
publicized.

Comments?

String

-- 
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