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

Commit 3adf18dc authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Camera2 Legacy: Set a default thumbnail size

Generally, JPEGs are better with thumbnails, and the default parameters
typically set a basic thumbnail size. In legacy, include a default size in the
templates.

This also works around issues with some devices not producing valid images with no
thumbnail.

Bug: 17724701
Change-Id: I2ad1449fc8c6d1fdec609af55f53db7491abbb92
parent b5140130
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1350,6 +1350,14 @@ public class LegacyMetadataMapper {
        m.set(CaptureRequest.LENS_FOCAL_LENGTH,
                c.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS)[0]);

        /*
         * jpeg.*
         */

        // jpeg.thumbnailSize - set smallest non-zero size if possible
        Size[] sizes = c.get(CameraCharacteristics.JPEG_AVAILABLE_THUMBNAIL_SIZES);
        m.set(CaptureRequest.JPEG_THUMBNAIL_SIZE, (sizes.length > 1) ? sizes[1] : sizes[0]);

        // TODO: map other request template values
        return m;
    }