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

Commit 65267255 authored by Mark Harman's avatar Mark Harman Committed by Mohammed Althaf T
Browse files

Guard against device specific crashes with vendor extension APIs.

parent aa652f1d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@
<pre>
Version 1.53 (Work in progress)

FIXED   Device specific crashes when starting with Camera2 API (related to camera vendor
        extensions).
FIXED   If force destroyed when in settings, the camera would be incorrectly opened when application
        was recreated (camera should only be reopened when leaving settings).
ADDED   Camera vendor extensions show percentage progress on supported Android 14 devices.
+76 −59
Original line number Diff line number Diff line
@@ -3033,7 +3033,15 @@ public class CameraController2 extends CameraController {
        }

        if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
            List<Integer> extensions = extension_characteristics.getSupportedExtensions();
            List<Integer> extensions = null;
            try {
                extensions = extension_characteristics.getSupportedExtensions();
            }
            catch(Exception e) {
                // have IllegalArgumentException at least from Google Play crashes
                if( MyDebug.LOG )
                    Log.e(TAG, "exception from getSupportedExtensions");
            }
            if( extensions != null ) {
                camera_features.supported_extensions = new ArrayList<>();
                camera_features.supported_extensions_zoom = new ArrayList<>();
@@ -3041,6 +3049,7 @@ public class CameraController2 extends CameraController {
                    if( MyDebug.LOG )
                        Log.d(TAG, "vendor extension: " + extension);

                    try {
                        // we assume that the allowed extension sizes are a subset of the full sizes - makes things easier to manage

                        List<android.util.Size> extension_picture_sizes = extension_characteristics.getExtensionSupportedSizes(extension, ImageFormat.JPEG);
@@ -3114,6 +3123,14 @@ public class CameraController2 extends CameraController {
                            }
                        }
                    }
                    catch(Exception exception) {
                        // have IllegalArgumentException from getExtensionSupportedSizes() and getAvailableCaptureRequestKeys() at least from Google Play crashes
                        if( MyDebug.LOG )
                            Log.e(TAG, "exception trying to query extension: " + extension);
                        camera_features.supported_extensions.remove(extension);
                        camera_features.supported_extensions_zoom.remove(extension);
                    }
                }
            }
        }
        // save to local fields: