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

Commit bf4d2e05 authored by Yasin Kilicdere's avatar Yasin Kilicdere
Browse files

Revert "Optimise loading wallpaper from disk to memory using chunks."

This reverts commit b90f1d3c.

Reason for revert: I found a better solution

Change-Id: If7b3836baee054480999b9737c9cbb2a2d212fd0
parent 99988dcd
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ import com.android.internal.R;
import libcore.io.IoUtils;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -745,8 +746,14 @@ public class WallpaperManager {
                Trace.endSection();

                if (pfd != null) {
                    try (InputStream is = new ParcelFileDescriptor.AutoCloseInputStream(pfd)) {
                        ImageDecoder.Source src = ImageDecoder.createSource(is.readAllBytes());
                    try (BufferedInputStream bis = new BufferedInputStream(
                            new ParcelFileDescriptor.AutoCloseInputStream(pfd))) {
                        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        int data;
                        while ((data = bis.read()) != -1) {
                            baos.write(data);
                        }
                        ImageDecoder.Source src = ImageDecoder.createSource(baos.toByteArray());
                        return ImageDecoder.decodeBitmap(src, ((decoder, info, source) -> {
                            // Mutable and hardware config can't be set at the same time.
                            decoder.setMutableRequired(!hardware);