xamarin/Xamarin.Mobile — pull request #24 by bjdodson (2013-12-20 18:26:41+00:00)
Title: better support for non-standard ContentProviders

Sorry, here's another attempt to keep the formatting cleaner. The diff is still a little complicated because I had to flatten the main "else" case and refactor the ContentProvider query. In summary,

* Try/catch the query to the ContentProvider. A ContentProvider may support GetInputStream without supporting Query. For example, Google+'s Photos app does not support queries for some remotely hosted images.

* Given the above, always try to copy the file if we fail to query the ContentProvider.

* When copying the file, catch all exceptions rather than just Java.IO.FileNotFound. For example, The Google+ Photos ContentProvider will throw a SecurityException for some remotely hosted media.