diff --git a/packages/camera/CHANGELOG.md b/packages/camera/CHANGELOG.md index 9ed7a78f1bb1..45a2235043e6 100644 --- a/packages/camera/CHANGELOG.md +++ b/packages/camera/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.4+2 + +* Fix Android NullPointerException on devices with only front-facing camera. + ## 0.5.4+1 * Fix Android pause and resume video crash when executing in APIs below 24. diff --git a/packages/camera/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java b/packages/camera/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java index e4613fb237c1..a7bb3b7d4914 100644 --- a/packages/camera/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java +++ b/packages/camera/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java @@ -77,32 +77,31 @@ static CamcorderProfile getBestAvailableCamcorderProfileForResolutionPreset( // All of these cases deliberately fall through to get the best available profile. case max: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_HIGH)) { - return CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH); + return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH); } case ultraHigh: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_2160P)) { - return CamcorderProfile.get(CamcorderProfile.QUALITY_2160P); + return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_2160P); } case veryHigh: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_1080P)) { - return CamcorderProfile.get(CamcorderProfile.QUALITY_1080P); + return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_1080P); } case high: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_720P)) { - return CamcorderProfile.get(CamcorderProfile.QUALITY_720P); + return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_720P); } case medium: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) { - return CamcorderProfile.get(CamcorderProfile.QUALITY_480P); + return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P); } case low: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_QVGA)) { - return CamcorderProfile.get(CamcorderProfile.QUALITY_QVGA); + return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_QVGA); } default: - if (CamcorderProfile.hasProfile( - Integer.parseInt(cameraName), CamcorderProfile.QUALITY_LOW)) { - return CamcorderProfile.get(CamcorderProfile.QUALITY_LOW); + if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_LOW)) { + return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_LOW); } else { throw new IllegalArgumentException( "No capture session available for current capture session."); diff --git a/packages/camera/pubspec.yaml b/packages/camera/pubspec.yaml index c9e715225d59..e7c8632b042f 100644 --- a/packages/camera/pubspec.yaml +++ b/packages/camera/pubspec.yaml @@ -2,7 +2,7 @@ name: camera description: A Flutter plugin for getting information about and controlling the camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video, and streaming image buffers to dart. -version: 0.5.4+1 +version: 0.5.4+2 authors: - Flutter Team