diff options
author | Michael Kolb <kolby@google.com> | 2013-05-30 13:39:00 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-05-30 13:39:00 -0700 |
commit | 9d6561494d28e8e8c6f1add50ab7724df722525b (patch) | |
tree | b3cb6c036d3455926dd86bece45f409783a4c903 | |
parent | 32d50e89e7877a2b38573d20a8251850c87e7851 (diff) | |
parent | d42c203a7fbbef58af268e7dcec295b7cdca6e4a (diff) | |
download | android_packages_apps_Snap-9d6561494d28e8e8c6f1add50ab7724df722525b.tar.gz android_packages_apps_Snap-9d6561494d28e8e8c6f1add50ab7724df722525b.tar.bz2 android_packages_apps_Snap-9d6561494d28e8e8c6f1add50ab7724df722525b.zip |
am af65d7ba: Merge "Add HTC One picture resolutions" into gb-ub-photos-bryce
* commit 'af65d7ba216eba60651d11d248d20346309375ed':
Add HTC One picture resolutions
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 17ed2373a..c3d152716 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -1629,6 +1629,8 @@ public class PhotoModule return; // Exiting, so no need to get the surface texture. } mUI.setSurfaceTexture(screenNail.getSurfaceTexture()); + } else { + updatePreviewSize(screenNail); } mCameraDevice.setDisplayOrientation(mCameraDisplayOrientation); Object st = mUI.getSurfaceTexture(); @@ -1650,6 +1652,21 @@ public class PhotoModule } } + private void updatePreviewSize(CameraScreenNail snail) { + Size size = mParameters.getPreviewSize(); + int w = size.width; + int h = size.height; + if (mCameraDisplayOrientation % 180 != 0) { + w = size.height; + h = size.width; + } + if (snail.getWidth() != w || snail.getHeight() != h) { + snail.setSize(w, h); + } + snail.enableAspectRatioClamping(); + mActivity.notifyScreenNailChanged(); + } + @Override public void stopPreview() { if (mCameraDevice != null && mCameraState != PREVIEW_STOPPED) { @@ -1743,10 +1760,14 @@ public class PhotoModule Size original = mParameters.getPreviewSize(); if (!original.equals(optimalSize)) { mParameters.setPreviewSize(optimalSize.width, optimalSize.height); - // Zoom related settings will be changed for different preview // sizes, so set and read the parameters to get latest values - mCameraDevice.setParameters(mParameters); + if (mHandler.getLooper() == Looper.myLooper()) { + // On UI thread only, not when camera starts up + setupPreview(); + } else { + mCameraDevice.setParameters(mParameters); + } mParameters = mCameraDevice.getParameters(); } Log.v(TAG, "Preview size is " + optimalSize.width + "x" + optimalSize.height); |