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

Commit 08b64b26 authored by Daniel Jacob Chittoor's avatar Daniel Jacob Chittoor Committed by Mohammed Althaf T
Browse files

CameraController2: Add FP6 specific characteristic for high res

* Extend dbd8d1bb

 for FP6

Co-authored-by: Rohit Sekhar's avatarRohit Sekhar <merothh@e.email>
parent fb3a64c7
Loading
Loading
Loading
Loading
+27 −17
Original line number Diff line number Diff line
@@ -3076,24 +3076,34 @@ public class CameraController2 extends CameraController {
        }

        if (is_fairphone && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            CameraCharacteristics.Key<int[]> qcfaDimensionKey =
                    new CameraCharacteristics.Key<>("org.codeaurora.qcamera3.quadra_cfa.qcfa_dimension", int[].class);
            CameraCharacteristics.Key<int[]>[] customDimensionKeys = new CameraCharacteristics.Key[] {
                    new CameraCharacteristics.Key<>("org.codeaurora.qcamera3.quadra_cfa.qcfa_dimension", int[].class),
                    new CameraCharacteristics.Key<>("com.fp.device.capabilities.sensor.highresolution", int[].class)
            };

            String[] keyLabels = new String[] {
                    "QCFA size (legacy)",
                    "High-resolution size"
            };

            for (int i = 0; i < customDimensionKeys.length; i++) {
                try {
                int[] qcfaDimension = characteristics.get(qcfaDimensionKey);
                if (qcfaDimension != null && qcfaDimension.length == 2) {
                    int qcfaWidth = qcfaDimension[0];
                    int qcfaHeight = qcfaDimension[1];
                    Size qcfaSize = new Size(qcfaWidth, qcfaHeight);
                    if (!camera_features.picture_sizes.contains(qcfaSize)) {
                        if (MyDebug.LOG)
                            Log.d(TAG, "Adding QCFA size: " + qcfaWidth + " x " + qcfaHeight);
                        camera_features.picture_sizes.add(qcfaSize);
                    int[] dimension = characteristics.get(customDimensionKeys[i]);
                    if (dimension != null && dimension.length == 2) {
                        int width = dimension[0];
                        int height = dimension[1];
                        Size size = new Size(width, height);
                        if (!camera_features.picture_sizes.contains(size)) {
                            if (MyDebug.LOG)
                                Log.d(TAG, "Adding " + keyLabels[i] + ": " + width + " x " + height);
                            camera_features.picture_sizes.add(size);
                        }
                    }
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                }
            }
        }

        // sizes are usually already sorted from high to low, but sort just in case
        // note some devices do have sizes in a not fully sorted order (e.g., Nokia 8)