Merge "Handle null assetFd like a FNF"
diff --git a/graphics/java/android/graphics/ImageDecoder.java b/graphics/java/android/graphics/ImageDecoder.java
index aecef8e..bcb313e 100644
--- a/graphics/java/android/graphics/ImageDecoder.java
+++ b/graphics/java/android/graphics/ImageDecoder.java
@@ -277,6 +277,10 @@
assetFd = mResolver.openAssetFileDescriptor(mUri, "r");
}
} catch (FileNotFoundException e) {
+ // Handled below, along with the case where assetFd was set to null.
+ }
+
+ if (assetFd == null) {
// Some images cannot be opened as AssetFileDescriptors (e.g.
// bmp, ico). Open them as InputStreams.
InputStream is = mResolver.openInputStream(mUri);
@@ -286,9 +290,7 @@
return createFromStream(is, true, preferAnimation, this);
}
- if (assetFd == null) {
- throw new FileNotFoundException(mUri.toString());
- }
+
return createFromAssetFileDescriptor(assetFd, preferAnimation, this);
}
}