Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b289d441 authored by Chih-Chung Chang's avatar Chih-Chung Chang
Browse files

Fix 5398768: Add requestCreateBitmapRegionDecoder for InputStream.

Change-Id: Ied273ffbabc134fdd930e6415fc175a6221eb662
parent 85bc435c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.os.ParcelFileDescriptor;

import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.InputStream;

public class DecodeUtils {
    private static final String TAG = "DecodeService";
@@ -191,6 +192,18 @@ public class DecodeUtils {
        }
    }

    public static BitmapRegionDecoder requestCreateBitmapRegionDecoder(
            JobContext jc, InputStream is, boolean shareable) {
        try {
            return BitmapRegionDecoder.newInstance(is, shareable);
        } catch (Throwable t)  {
            // We often cancel the creating of bitmap region decoder,
            // so just log one line.
            Log.w(TAG, "requestCreateBitmapRegionDecoder: " + t);
            return null;
        }
    }

    public static BitmapRegionDecoder requestCreateBitmapRegionDecoder(
            JobContext jc, Uri uri, ContentResolver resolver,
            boolean shareable) {