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

Commit c0fa2b95 authored by Leon Scroggins III's avatar Leon Scroggins III Committed by Leon Scroggins
Browse files

Make Drawable#createFrom* support incomplete images

Bug: 120786924
Test: I18463379d8e3d354ffafd006abd79c0a7918b500

Prior to P, createFrom* supported incomplete images, but this
regressed in P with the switch to ImageDecoder, which does not succeed
on incomplete images by default. Add a PartialImageListener, so that
incomplete images succeed.

Change-Id: Icb57d5857e1dcf6a347bb198f49284ac1975b54b
parent 2c135398
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1245,6 +1245,9 @@ public abstract class Drawable {


            return ImageDecoder.decodeDrawable(source, (decoder, info, src) -> {
            return ImageDecoder.decodeDrawable(source, (decoder, info, src) -> {
                decoder.setAllocator(ImageDecoder.ALLOCATOR_SOFTWARE);
                decoder.setAllocator(ImageDecoder.ALLOCATOR_SOFTWARE);
                decoder.setOnPartialImageListener((e) -> {
                    return e.getError() == ImageDecoder.DecodeException.SOURCE_INCOMPLETE;
                });
            });
            });
        } catch (IOException e) {
        } catch (IOException e) {
            /*  do nothing.
            /*  do nothing.