summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByunghun Jeon <bjeon@codeaurora.org>2016-09-20 15:30:11 -0700
committerArne Coucheron <arco68@gmail.com>2017-06-13 07:16:41 +0200
commitd24a8ede150863e67f67bbd04279b138c7fde242 (patch)
tree317749ed5c68db7c9028f19a78721dc7f0ab1267
parentbdb5068e459f6ce80d3ac6478513dfa445dee696 (diff)
downloadandroid_packages_apps_Snap-d24a8ede150863e67f67bbd04279b138c7fde242.zip
android_packages_apps_Snap-d24a8ede150863e67f67bbd04279b138c7fde242.tar.gz
android_packages_apps_Snap-d24a8ede150863e67f67bbd04279b138c7fde242.tar.bz2
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
-rw-r--r--res/xml/capture_preferences.xml11
-rw-r--r--src/com/android/camera/CaptureModule.java20
2 files changed, 16 insertions, 15 deletions
diff --git a/res/xml/capture_preferences.xml b/res/xml/capture_preferences.xml
index cd84433..58a6160 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"/>
- <ListPreference
- camera:defaultValue="@string/pref_camera2_videosnap_default"
- camera:entries="@array/pref_camera2_videosnap_entries"
- camera:entryValues="@array/pref_camera2_videosnap_entryvalues"
- camera:key="pref_camera2_videosnap_key"
- camera:title="@string/pref_camera2_videosnap_title" />
-
- <ListPreference
+ <IconListPreference
camera:defaultValue="off"
camera:key="pref_camera2_trackingfocus_key"
camera:entries="@array/pref_camera2_trackingfocus_entries"
camera:entryValues="@array/pref_camera2_trackingfocus_entryvalues"
- camera:title="@string/pref_camera2_trackingfocus_title"/>
+ camera:title="@string/pref_camera2_trackingfocus_title" />
<IconListPreference
camera:defaultValue="@string/pref_camera_hfr_default"
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index b6968f6..6505a4a 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -2322,17 +2322,18 @@ public class CaptureModule extends BaseModule<CaptureUI> 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<CaptureUI> 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) {