public static boolean isUriRequiresPermissions(@NonNull Context context, @NonNull Uri uri) {
    try {
      ContentResolver resolver = context.getContentResolver();
      InputStream stream = resolver.openInputStream(uri);
      if (stream != null) {
        stream.close();
      }
      return false;
    } catch (Exception e) {
      return true;
    }
  }
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.

@param context used to access Android APIs, like content resolve, it is your
    activity/fragment/widget.
@param uri the result URI of image pick.
core/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java