Steps to reproduce
- Make a flutter app with the attached code, and add the camera package
- Start the app. On a level 3 device, you will probably see the counter on the bottom left rising. On a level 1 device, it will stay at 0.
Expected results
The device should do image analysis.
Actual results
The device doesn't do image analysis.
The reason for this was introduced with this PR: flutter/packages@79d733c
The documentation says:
* **and** the camera device is at least supported hardware [`LEVEL_3`][7]
However the implementation isn't doing a 'least', it's checking equality.
flutter/packages@79d733c#diff-ab4e3a5919ae7d66e10ab0ae28fa47cae44d20c78b41cbbbe05765c49e47e151R925-R928
The legacy check above that also probably has the same issue.
So basically I believe all highish-end or newer devices (like my Pixel 6 Pro that this is happening on) can't record and do analysis at the same time with the most recent version of androidx camera.
Code sample
Code sample
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
CameraController? _controller;
int _counter = 0;
@override
void initState() {
super.initState();
_initializeCamera();
}
Future<void> _initializeCamera() async {
final cameras = await availableCameras();
final firstCamera = cameras.first;
_controller = CameraController(firstCamera, ResolutionPreset.medium);
await _controller!.initialize();
if (mounted) {
setState(() {});
}
_controller!.startVideoRecording(onAvailable: _onImage);
}
void _onImage(CameraImage image) {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Stack(
children: [
Padding(
padding: const EdgeInsets.all(32.0),
child: Center(
child: _controller != null
? CameraPreview(_controller!)
: const CircularProgressIndicator(),
),
),
Positioned(
bottom: 16,
right: 16,
child: Text('images received: $_counter'),
),
],
),
);
}
}
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.22.1, on macOS 13.6.3 22G436 darwin-arm64, locale
en-CA)
• Flutter version 3.22.1 on channel stable at
XXXX
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision a14f74ff3a (2 weeks ago), 2024-05-22 11:08:21 -0500
• Engine revision 55eae6864b
• Dart version 3.4.1
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at XXXX/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = XXXX/Library/Android/sdk
• ANDROID_SDK_ROOT = XXXX/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.7+0-17.0.7b1000.6-10550314)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 15.0.1)
• Xcode at /Applications/Xcode-15.0.1.app/Contents/Developer
• Build 15A507
✗ Unable to get list of installed Simulator runtimes.
• CocoaPods version 1.14.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.7+0-17.0.7b1000.6-10550314)
[✓] VS Code (version 1.90.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.91.20240529
[✓] Connected device (4 available)
• Pixel 6 Pro (mobile) • 1A131FDEE00480 • android-arm64 •
Android 14 (API 34)
• macOS (desktop) • macos • darwin-arm64 •
macOS 13.6.3 22G436 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin •
macOS 13.6.3 22G436 darwin-arm64
• Chrome (web) • chrome • web-javascript •
Google Chrome 125.0.6422.142
[✓] Network resources
• All expected network resources are available.
Steps to reproduce
Expected results
The device should do image analysis.
Actual results
The device doesn't do image analysis.
The reason for this was introduced with this PR: flutter/packages@79d733c
The documentation says:
However the implementation isn't doing a 'least', it's checking equality.
flutter/packages@79d733c#diff-ab4e3a5919ae7d66e10ab0ae28fa47cae44d20c78b41cbbbe05765c49e47e151R925-R928
The legacy check above that also probably has the same issue.
So basically I believe all highish-end or newer devices (like my Pixel 6 Pro that this is happening on) can't record and do analysis at the same time with the most recent version of androidx camera.
Code sample
Code sample
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output