Throw FileNotFoundException when openLogoFile() fails
ContentProvider should throw the exception instead of returning null object.
Bug: 18335090
Change-Id: Iffa0370b6c1c901ce665ca21aac6c94239fa476f
diff --git a/src/com/android/providers/tv/TvProvider.java b/src/com/android/providers/tv/TvProvider.java
index ea8dca7..cd70ad1 100644
--- a/src/com/android/providers/tv/TvProvider.java
+++ b/src/com/android/providers/tv/TvProvider.java
@@ -858,7 +858,11 @@
if (mode.equals("r")) {
String sql = queryBuilder.buildQuery(new String[] { CHANNELS_COLUMN_LOGO },
params.getSelection(), null, null, null, null);
- return DatabaseUtils.blobFileDescriptorForQuery(db, sql, params.getSelectionArgs());
+ ParcelFileDescriptor fd = DatabaseUtils.blobFileDescriptorForQuery(db, sql, params.getSelectionArgs());
+ if (fd == null) {
+ throw new FileNotFoundException(uri.toString());
+ }
+ return fd;
} else {
try (Cursor cursor = queryBuilder.query(db, new String[] { Channels._ID },
params.getSelection(), params.getSelectionArgs(), null, null, null)) {