Catch focus timeout and negative value errs #21

Merged
loewy merged 2 commits from loewy/fix-android-focus-timeout-crash into main 2026-01-27 00:50:05 +00:00
Showing only changes of commit 3bb72d5d94 - Show all commits

View File

@@ -198,8 +198,10 @@ class PreviewView(context: Context, callback: SurfaceHolder.Callback) :
val viewOrientation = Orientation.PORTRAIT
val rotated = point.rotatedBy(viewSize, cameraSize, viewOrientation, sensorOrientation)
Log.i(TAG, "Converted layer point $point to camera point $rotated! ($sensorOrientation, $cameraSize -> $viewSize)")
return rotated
// Clamp to valid camera coordinates (must be non-negative for MeteringRectangle)
val clamped = Point(maxOf(0, rotated.x), maxOf(0, rotated.y))
Log.i(TAG, "Converted layer point $point to camera point $clamped! ($sensorOrientation, $cameraSize -> $viewSize)")
return clamped
}
private fun updateLayout() {