From 90e75d1f90b85e11f6905966ea28d59916935c68 Mon Sep 17 00:00:00 2001 From: Alan Newberger Date: Sun, 5 Oct 2014 12:41:11 -0700 Subject: Check isZoomSupported before any zoom ratio calculations. Per API doc, isZoomeSupported should be checked before calling getZoomRatios or getMaxZoom. Moving zoom calculation into isZoomSupported check fixed crash in front camera with no zoom support, where a HAL/fwk returns a null list of zoom ratios. Bug: 17863266 Change-Id: I80b5f7a431e7bbe4d50e5d062628e38eda3fd0a6 --- .../com/android/ex/camera2/portability/AndroidCameraCapabilities.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraCapabilities.java') diff --git a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraCapabilities.java b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraCapabilities.java index 84b44e6..9892d4a 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraCapabilities.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCameraCapabilities.java @@ -47,7 +47,6 @@ class AndroidCameraCapabilities extends CameraCapabilities { mPreferredPreviewSizeForVideo = new Size(p.getPreferredPreviewSizeForVideo()); mSupportedPreviewFormats.addAll(p.getSupportedPreviewFormats()); mSupportedPhotoFormats.addAll(p.getSupportedPictureFormats()); - mMaxZoomRatio = p.getZoomRatios().get(p.getMaxZoom()) / ZOOM_MULTIPLIER; mHorizontalViewAngle = p.getHorizontalViewAngle(); mVerticalViewAngle = p.getVerticalViewAngle(); buildPreviewFpsRange(p); @@ -60,6 +59,7 @@ class AndroidCameraCapabilities extends CameraCapabilities { buildWhiteBalances(p); if (p.isZoomSupported()) { + mMaxZoomRatio = p.getZoomRatios().get(p.getMaxZoom()) / ZOOM_MULTIPLIER; mSupportedFeatures.add(Feature.ZOOM); } if (p.isVideoSnapshotSupported()) { -- cgit v1.2.3