summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2013-09-09 16:37:57 -0700
committerJohn Reck <jreck@google.com>2013-09-09 23:41:20 +0000
commit5835157d762a5b6bffe3d892c588ebc475bccb44 (patch)
tree2540b1359dc480b22094e81544a4dd84fdd333ed /graphics
parent23ae1461d2cf0ac3f1da71200544381a8d8a4957 (diff)
downloadframeworks_base-5835157d762a5b6bffe3d892c588ebc475bccb44.zip
frameworks_base-5835157d762a5b6bffe3d892c588ebc475bccb44.tar.gz
frameworks_base-5835157d762a5b6bffe3d892c588ebc475bccb44.tar.bz2
Remove FD optimization case for decodeStream
Bug: 10677727 The problem is that the FileInputStream may be wrapping a pipe or AssetFileDescriptor which fails if handed to decodeFileDescriptor. The problem is that AFDs can start in the middle of a file, whereas decodeFileDescriptor assumes it can mmap() the FD and start at the beginning. Change-Id: I98a3c5f789865145e25a99b32d205e290808c1cf
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java16
1 files changed, 1 insertions, 15 deletions
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index e3adc59..23606a1 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -565,24 +565,10 @@ public class BitmapFactory {
Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeBitmap");
try {
- boolean decodeGenericStream = true;
if (is instanceof AssetManager.AssetInputStream) {
final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
bm = nativeDecodeAsset(asset, outPadding, opts);
- // Do not follow the normal case.
- decodeGenericStream = false;
- } else if (is instanceof FileInputStream) {
- try {
- FileDescriptor fd = ((FileInputStream) is).getFD();
- // decodeFileDescriptor will take care of throwing the IAE and
- // calling setDensityFromOptions.
- return decodeFileDescriptor(fd, outPadding, opts);
- } catch (IOException e) {
- // Fall through to nativeDecodeStream.
- }
- }
-
- if (decodeGenericStream) {
+ } else {
byte [] tempStorage = null;
if (opts != null) tempStorage = opts.inTempStorage;
if (tempStorage == null) tempStorage = new byte[DECODE_BUFFER_SIZE];