From d24a8ede150863e67f67bbd04279b138c7fde242 Mon Sep 17 00:00:00 2001 From: Byunghun Jeon Date: Tue, 20 Sep 2016 15:30:11 -0700 Subject: SnapdragonCamera: Change video snapshot picture size logic Remove auto video snapshot size menu and use picture size setting instead. In case of 4k, use one that is smaller than 4k. Change-Id: Ic8ab193055afa0f571c73a074d346c2a9f8dbacd CRs-Fixed: 1066519 --- res/xml/capture_preferences.xml | 11 ++--------- src/com/android/camera/CaptureModule.java | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/res/xml/capture_preferences.xml b/res/xml/capture_preferences.xml index cd8443331..58a616026 100644 --- a/res/xml/capture_preferences.xml +++ b/res/xml/capture_preferences.xml @@ -264,19 +264,12 @@ camera:singleIcon="@drawable/ic_settings_facerec" camera:title="@string/pref_camera_facedetection_title"/> - - - + camera:title="@string/pref_camera2_trackingfocus_title" /> implements PhotoControl } private void updateVideoSnapshotSize() { - String auto = mSettingsManager.getValue(SettingsManager.KEY_AUTO_VIDEOSNAP_SIZE); - if (auto != null && auto.equals("enable")) { - Size[] sizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.JPEG); - mVideoSnapshotSize = getMaxSizeWithRatio(sizes, mVideoSize); - } else { - mVideoSnapshotSize = mPictureSize; + mVideoSnapshotSize = mPictureSize; + if (is4kSize(mVideoSize) && is4kSize(mVideoSnapshotSize)) { + mVideoSnapshotSize = getMaxPictureSizeLessThan4k(); } Size[] thumbSizes = mSettingsManager.getSupportedThumbnailSizes(getMainCameraId()); mVideoSnapshotThumbSize = getOptimalPreviewSize(mVideoSnapshotSize, thumbSizes, 0, 0); // get largest thumb size } + private boolean is4kSize(Size size) { + return (size.getHeight() >= 2160 || size.getWidth() >= 3840); + } + private void updateMaxVideoDuration() { String minutesStr = mSettingsManager.getValue(SettingsManager.KEY_VIDEO_DURATION); if (minutesStr == null) { @@ -3404,6 +3405,13 @@ public class CaptureModule extends BaseModule implements PhotoControl return optimal; } + private Size getMaxPictureSizeLessThan4k() { + Size[] sizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.JPEG); + for (Size size : sizes) { + if (!is4kSize(size)) return size; + } + return sizes[sizes.length - 1]; + } private Size getMaxSizeWithRatio(Size[] sizes, Size reference) { float ratio = (float) reference.getWidth() / reference.getHeight(); for (Size size : sizes) { -- cgit v1.2.3