question: public static boolean isUriRequiresPermissions ( @ NonNull Context context , @ NonNull Uri uri ) { try { ContentResolver resolver = context . getContentResolver ( ) ; InputStream stream = resolver . openInputStream ( uri ) ; stream . close ( ) ; return false ; } catch ( Exception e ) { return true ; } }
target:  Test if we can open the given Android URI to test if permission required error is thrown.<br> Only relevant for API version 23 and above.