Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 17bbff0

Browse files
[camera] Fix for CameraAccessException affecting certain devices on Android 7/8 (#4572)
1 parent 936257f commit 17bbff0

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

packages/camera/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.9.4+6
2+
3+
* Fixes bug resulting in a `CameraAccessException` that prevents image capture on certain devices running Android 7/8.
4+
15
## 0.9.4+5
26

37
* Fixes bug where calling a method after the camera was closed resulted in a Java `IllegalStateException` exception.

packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,12 @@ public void onCaptureCompleted(
583583
};
584584

585585
try {
586-
captureSession.stopRepeating();
587-
captureSession.abortCaptures();
586+
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O) {
587+
captureSession.stopRepeating();
588+
} else {
589+
captureSession.stopRepeating();
590+
captureSession.abortCaptures();
591+
}
588592
Log.i(TAG, "sending capture request");
589593
captureSession.capture(stillBuilder.build(), captureCallback, backgroundHandler);
590594
} catch (CameraAccessException e) {

packages/camera/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
44
Dart.
55
repository: https://github.com/flutter/plugins/tree/master/packages/camera/camera
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
7-
version: 0.9.4+5
7+
version: 0.9.4+6
88

99
environment:
1010
sdk: ">=2.14.0 <3.0.0"

0 commit comments

Comments
 (0)