You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 43dcfe5
Browse filesBrowse the repository at this point in the historyBrowse files
[camera_android_camerax] Prefer higher resolution for max preset (#11956)
Updates `camera_android_camerax` so `ResolutionPreset.max` can select Camera2 high-resolution JPEG still capture sizes on Android. For `ResolutionPreset.max`, `ImageCapture` now uses `ResolutionSelector.PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE`; preview and image analysis keep the existing selector without high-resolution mode.
Fixesflutter/flutter#188310
## Problem
On some Android devices, Camera2 exposes the largest 4:3 still resolution only through `getHighResolutionOutputSizes(ImageFormat.JPEG)`. The CameraX backend used `ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY` without `ResolutionSelector.PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE`, so CameraX could pick the largest regular JPEG size instead.
## Observed
- Camera2 regular JPEG max: 3264x2448
- Camera2 high-resolution JPEG: 4624x3468
- Flutter `takePicture()`: 2448x3264
## After fix
- CameraX `ImageCapture`: 4624x3468
- Flutter `takePicture()`: 3468x4624
## Risk / tradeoff
High-resolution still capture can be slower and use more memory. Limited to `ResolutionPreset.max` and `ImageCapture` only.
## Note
Generated Pigeon files (`camerax_library.g.dart`, `CameraXLibrary.g.kt`) include formatting churn from local pigeon regeneration; functional changes are limited to `ResolutionSelector` allowed resolution mode and max-preset ImageCapture selector behavior.
## Pre-Review Checklist
## Test plan
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraXLibrary.g.kt
+37-16Lines changed: 37 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
// Copyright 2013 The Flutter Authors
2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
-
// Autogenerated from Pigeon (v26.1.7), do not edit directly.
4
+
// Autogenerated from Pigeon (v26.3.4), do not edit directly.
5
5
// See also: https://pub.dev/packages/pigeon
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorProxyApi.java
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ class ResolutionSelectorProxyApi extends PigeonApiResolutionSelector {
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java
+51-1Lines changed: 51 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,13 +28,63 @@ public void pigeon_defaultConstructor_createsExpectedResolutionSelectorInstance(
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/lib/src/camerax_library.dart
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,19 @@ class Surface {
96
96
staticconstint rotation270 =3;
97
97
}
98
98
99
+
/// Allowed resolution mode constants for [ResolutionSelector].
100
+
classResolutionSelectorAllowedResolutionMode {
101
+
/// CameraX prefers capture rate over higher resolution.
102
+
///
103
+
/// See https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector#PREFER_CAPTURE_RATE_OVER_HIGHER_RESOLUTION().
/// CameraX prefers higher resolution over capture rate.
107
+
///
108
+
/// See https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector#PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE().
0 commit comments