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

Commit 0430c3ce authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Use ALLOCATOR_SOFTWARE with ImageDecoder"

parents 5cbb0ace 19ff0c57
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.graphics.ImageDecoder.Source;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.DeadObjectException;
@@ -3244,18 +3243,8 @@ public abstract class ContentResolver {
        Objects.requireNonNull(uri);
        Objects.requireNonNull(size);

        // Older apps might be relying on mutable results, so only consider
        // giving them hardware bitmaps once they target Q or higher. If modern
        // apps need mutable thumbnails, they can always roll their own logic.
        final int allocator;
        if (getTargetSdkVersion() >= Build.VERSION_CODES.Q) {
            allocator = ImageDecoder.ALLOCATOR_DEFAULT;
        } else {
            allocator = ImageDecoder.ALLOCATOR_SOFTWARE;
        }

        try (ContentProviderClient client = acquireContentProviderClient(uri)) {
            return loadThumbnail(client, uri, size, signal, allocator);
            return loadThumbnail(client, uri, size, signal, ImageDecoder.ALLOCATOR_SOFTWARE);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -1232,7 +1232,7 @@ public final class DocumentsContract {
    public static Bitmap getDocumentThumbnail(ContentProviderClient client, Uri documentUri,
            Point size, CancellationSignal signal) throws IOException {
        return ContentResolver.loadThumbnail(client, documentUri, Point.convert(size), signal,
                ImageDecoder.ALLOCATOR_DEFAULT);
                ImageDecoder.ALLOCATOR_SOFTWARE);
    }

    /**