Skip to content

[camera_avfoundation] Replace deprecated high-resolution capture APIs - #12372

Merged
auto-submit[bot] merged 4 commits into
flutter:mainfrom
toyaji:camera-avfoundation-max-photo-dimensions
Sep 23, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:mainfrom
toyaji:camera-avfoundation-max-photo-dimensions

Conversation

@toyaji

@toyaji toyaji commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Replaces isHighResolutionCaptureEnabled/isHighResolutionPhotoEnabled
(API_DEPRECATED, iOS 16) with maxPhotoDimensions, falling back to the
deprecated APIs below iOS 16.

Part of flutter/flutter#160687

Also fixes the resolution setting being silently dropped for HEIF captures
at ResolutionPreset.max, found while making this change: the HEIF branch
of captureToFile replaces settings with a new instance after the flag
was set on the discarded one. Regression tests are included for both the
HEIF and JPEG-quality branches.

Deprecation source (Xcode 26.2 SDK headers, API_DEPRECATED("Use maxPhotoDimensions instead.", ios(10.0, 16.0))):

Pre-Review Checklist

Replaces `isHighResolutionCaptureEnabled`/`isHighResolutionPhotoEnabled`
(`API_DEPRECATED`, iOS 16) with `maxPhotoDimensions`, falling back to the
deprecated APIs below iOS 16.

Part of flutter/flutter#160687

Also fixes the resolution setting being silently dropped for HEIF captures
at `ResolutionPreset.max`, found while making this change: the HEIF branch
of `captureToFile` replaces `settings` with a new instance after the flag
was set on the discarded one. Regression tests are included for both the
HEIF and JPEG-quality branches.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the deprecated high-resolution photo APIs with maxPhotoDimensions on iOS 16 and later, falling back to the deprecated APIs on older iOS versions. It also fixes an issue where the maximum resolution setting was ignored for HEIF captures when using ResolutionPreset.max. The review feedback suggests defensively checking if high-resolution photo capture is supported on iOS versions prior to 16 before enabling it to prevent potential runtime crashes.

@toyaji

toyaji commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the review — I don't think these three suggestions should be applied.

The suggested property doesn't exist

isHighResolutionPhotoSupported isn't a real AVCaptureDevice.Format API — not in the Xcode 26.2 SDK headers, not in Apple's public docs. The closest real symbol, isHighPhotoQualitySupported, is about photoQualityPrioritization, not resolution.

The documented crash condition is different

Apple's header for highResolutionCaptureEnabled:

If you have not set this property to YES and call capturePhotoWithSettings:delegate: with settings.highResolutionCaptureEnabled set to YES, an NSInvalidArgumentException will be thrown.

That's an output/settings mismatch, not a format-support issue.

This line predates the PR

capturePhotoOutput.isHighResolutionCaptureEnabled = true has been unconditional since the original Swift migration (699fb4d6a). This PR only moves where it's called.

@hellohuanlin hellohuanlin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense to me. Can you address gemini's open comments?

@toyaji

toyaji commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@hellohuanlin Replied to all three of gemini's comments and resolved the threads — no code changes. All three are built on isHighResolutionPhotoSupported, which is a hallucination: it's not in the Xcode 26.2 SDK headers or Apple's docs. There's nothing to guard on.

@hellohuanlin hellohuanlin added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels Aug 19, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 19, 2026
@auto-submit

auto-submit Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12372, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@hellohuanlin

Copy link
Copy Markdown
Contributor

This will need another review from @LouiseHsu

…-max-photo-dimensions

# Conflicts:
#	packages/camera/camera_avfoundation/CHANGELOG.md
#	packages/camera/camera_avfoundation/pubspec.yaml
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 3, 2026
@toyaji

toyaji commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged main to clear the conflict (camera_avfoundation → 0.10.3+1, no code changes).

@LouiseHsu — this is already approved by @hellohuanlin and just needs a second review when you have a chance. Thanks!

@LouiseHsu LouiseHsu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@LouiseHsu LouiseHsu added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 4, 2026
@toyaji

toyaji commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@hellohuanlin @LouiseHsu the CICD label got auto-removed by the bot after I pushed the conflict-resolution commit — could either of you re-add it so the presubmit checks can run? Both reviews are already in, just waiting on this. Thanks!

…-max-photo-dimensions

# Conflicts:
#	packages/camera/camera_avfoundation/CHANGELOG.md
@toyaji

toyaji commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

@hellohuanlin @LouiseHsu Gentle ping — resolved another CHANGELOG conflict (no code changes). This is approved with autosubmit, but still needs the CICD label to run CI.

@LouiseHsu LouiseHsu added the CICD Run CI/CD label Sep 23, 2026
@auto-submit
auto-submit Bot merged commit c06a3f2 into flutter:main Sep 23, 2026
13 checks passed
pull Bot pushed a commit to edisplay/flutter that referenced this pull request Sep 24, 2026
Roll Packages from c2b58e1 to 431ea69 (56 revisions)

flutter/packages@c2b58e1...431ea69

2026-09-24 10687576+bparrishMines@users.noreply.github.com [cross_file]
Updates cross_file to a package separated federated plugin
(flutter/packages#11010)
2026-09-23 21270878+elliette@users.noreply.github.com [material_ui]
Remove static access of `copyWith` from `dart fix` golden tests for
`ThemeData/TextTheme` (flutter/packages#12994)
2026-09-23 happytoday83@naver.com [camera_avfoundation] Replace
deprecated high-resolution capture APIs (flutter/packages#12372)
2026-09-23 tarrinneal@gmail.com [pigeon] update nullish checks to use
new isNullish method (flutter/packages#12985)
2026-09-23 katelovett@google.com [ci] Assign batch release PR approver
as reviewer on sync-back PR (flutter/packages#12976)
2026-09-23 kf013099@gmail.com [image_picker] Fix scaling 10-bit images
(flutter/packages#12557)
2026-09-23 kevmoo@users.noreply.github.com [material_ui] Improve
Autocomplete, DrawerHeader, and Tooltip accessibility
(flutter/packages#12918)
2026-09-23 katelovett@google.com [google_fonts] Decouple GoogleFontsLite
for full tree-shaking and add full feature parity
(flutter/packages#12830)
2026-09-23 21270878+elliette@users.noreply.github.com [file_selector]
Ignore flakey `file_selector_android` tests (flutter/packages#12992)
2026-09-23 31859944+LongCatIsLooong@users.noreply.github.com [CI] Remove
bringup from `Mac_arm64 build_all_packages` targets
(flutter/packages#12978)
2026-09-22 1961493+harryterkelsen@users.noreply.github.com [material_ui]
Unskip 5 passing web tests in bottom_app_bar_test and text_field_test
(flutter/packages#12983)
2026-09-22 1961493+harryterkelsen@users.noreply.github.com
[cupertino_ui] Unskip 5 passing web tests in
adaptive_text_selection_toolbar_test and text_field_test
(flutter/packages#12984)
2026-09-22 me@davidmiguel.com [go_router] Fix ShellRoute chrome dropped
from semantics tree by ModalBarrier (flutter/packages#12353)
2026-09-22 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Add contrastLevel for M3 ColorScheme (flutter/packages#12743)
2026-09-22 themis.chatzie@gmail.com [go_router] Preserve nested pushes
during config updates (flutter/packages#12611)
2026-09-22 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Migrate M3 Chip template to use new gen_defaults
(flutter/packages#12847)
2026-09-22 50643541+Mairramer@users.noreply.github.com [material_ui] Fix
LocalHistoryEntry leak when double tapping Drawer scrim
(flutter/packages#12552)
2026-09-22 katelovett@google.com Update suggested reviewers
(flutter/packages#12974)
2026-09-22 fluttergithubbot@gmail.com Sync release-material_ui-1.4.0 to
main (flutter/packages#12966)
2026-09-22 fluttergithubbot@gmail.com Sync release-cupertino_ui-1.1.1 to
main (flutter/packages#12965)
2026-09-21 21270878+elliette@users.noreply.github.com [ci] Update repo
for 3.47 stable release (flutter/packages#12959)
2026-09-21 engine-flutter-autoroll@skia.org Manual roll Flutter from
27fec0e to 4fcd90b (1 revision) (flutter/packages#12904)
2026-09-21 katelovett@google.com Revert "[go_router_builder] Migrate to
material_ui" (flutter/packages#12962)
2026-09-21 31859944+LongCatIsLooong@users.noreply.github.com
[material_ui] Update `material_ui` tests to prevent them from failing
when framework `TextStyle` changes (flutter/packages#12728)
2026-09-21 katelovett@google.com [go_router_builder] Migrate to
material_ui (flutter/packages#12913)
2026-09-21 dkwingsmt@users.noreply.github.com [material_ui,
cupertino_ui] Bump Flutter version from to 3.47 (flutter/packages#12944)
2026-09-21 katelovett@google.com [cupertino_ui] Work around dart2wasm
optional parameter inference bug in example checkbox tests
(flutter/packages#12961)
2026-09-21 katelovett@google.com [cupertino_ui] Work around dart2wasm
optional parameter inference bug in checkbox_test.dart
(flutter/packages#12956)
2026-09-21 victor.orozco@cloudsufi.com [google_sign_in] PR 3/4 Migrate
ViewProvider and GID SDK wrappers from Objective-C to Swift
(flutter/packages#12657)
2026-09-21 victor.orozco@cloudsufi.com [google_sign_in] PR 2/4 Migrate
the plugin class from Objective-C to Swift. (flutter/packages#12655)
2026-09-20 10687576+bparrishMines@users.noreply.github.com
[cross_file_darwin] iOS/macOS implementation of `cross_file`
(flutter/packages#12910)
2026-09-20 10687576+bparrishMines@users.noreply.github.com
[cross_file_web] Web implementation of `cross_file`
(flutter/packages#12908)
2026-09-20 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Migrate M3 `InputChip` template to use new gen_defaults
(flutter/packages#12850)
2026-09-20 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Migrate M3 Checkbox defaults to new gen_defaults
(flutter/packages#12816)
2026-09-20 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Migrate M3 `FilterChip` template to use new gen_defaults
(flutter/packages#12849)
2026-09-19 zengyan@88.com [material_ui] Announce PopupMenuButton with a
child as a button (flutter/packages#12585)
2026-09-19 engine-flutter-autoroll@skia.org Roll Flutter (stable) from
9584c67 to 6a19cca (7 revisions) (flutter/packages#12950)
2026-09-18 21270878+elliette@users.noreply.github.com [material_ui]
Reduce the `material_ui` non-wasm web test suite
(flutter/packages#12763)
2026-09-18 31859944+LongCatIsLooong@users.noreply.github.com Replace
`Mac_x64` builders with `Mac_arm64` ones (flutter/packages#12941)
2026-09-18 32538273+ValentinVignal@users.noreply.github.com
[in_app_purchase_storekit] Use `_$SKPaymentDiscountWrapperToJson`
(flutter/packages#12721)
2026-09-18 gerardo.morales@cloudsufi.com [In_app _purchase] README
excerpt examples and changelog (flutter/packages#12739)
2026-09-18 brunocorona.alcantar@gmail.com [material_ui] Add alternative
input method for `RangeSlider` in `NavigationMode.directional`
(flutter/packages#12630)
2026-09-18 10687576+bparrishMines@users.noreply.github.com
[cross_file_android] Android implementation of `cross_file`
(flutter/packages#12909)
2026-09-18 50643541+Mairramer@users.noreply.github.com
[camera_platform_interface] Adds videoOutputPath support to
startVideoRecording (flutter/packages#12667)
2026-09-17 dkwingsmt@users.noreply.github.com [cupertino_ui] Migrate a
snippet in `CupertinoCheckbox`'s API doc to `{@example}` and add unit
tests (flutter/packages#12180)
2026-09-17 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Default gen_defaults color helper prefix (flutter/packages#12848)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: camera platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants