From 6c43863efdc8ecaf5915c21d8722305db69fc78a Mon Sep 17 00:00:00 2001 From: Likai Ding Date: Fri, 6 Feb 2015 13:28:34 +0800 Subject: SnapdragonCamera: fix preview not shown bug resizeForPreviewAspectRatio() might be called before SurfaceView's layout process, which causes SurfaceView being set to 0 width and height. Add check before adjusting SurfaceView's dimensions. Change-Id: I66bf6dfcef74253429b2c6cd1a80031d8e30f95d --- src/com/android/camera/PhotoUI.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/com/android/camera/PhotoUI.java') diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index bad7073a9..81837f68f 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -390,6 +390,8 @@ public class PhotoUI implements PieListener, } } else { float width = mOriginalPreviewWidth, height = mOriginalPreviewHeight; + if (width == 0 || height == 0) return; + if (mOrientationResize) { scaledTextureWidth = height * mAspectRatio; if (scaledTextureWidth > width) { -- cgit v1.2.3