summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSultanxda <sultanxda@gmail.com>2015-09-08 21:32:48 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-02-07 15:04:23 -0800
commitb562c16cb859a45218873957583712d018bf9326 (patch)
tree89a1e6c677e3b7cc3bddd2b8efdaa2743bfd5fd3
parentab30dbecd443fefc046f820d90c98a469a2696c6 (diff)
downloadandroid_packages_apps_Snap-b562c16cb859a45218873957583712d018bf9326.zip
android_packages_apps_Snap-b562c16cb859a45218873957583712d018bf9326.tar.gz
android_packages_apps_Snap-b562c16cb859a45218873957583712d018bf9326.tar.bz2
SnapdragonCamera: Add focus-mode option to camcorder
User can now control the focus mode used while recording video. Change-Id: I340c01a3f88314de67ca024279672276eff453ed Signed-off-by: Sultanxda <sultanxda@gmail.com>
-rw-r--r--res/values/arrays.xml5
-rw-r--r--res/values/cm_arrays.xml16
-rw-r--r--res/xml/video_preferences.xml7
-rw-r--r--src/com/android/camera/CameraSettings.java6
-rw-r--r--src/com/android/camera/FocusOverlayManager.java13
-rw-r--r--src/com/android/camera/PhotoModule.java28
-rw-r--r--src/com/android/camera/VideoMenu.java4
-rw-r--r--src/com/android/camera/VideoModule.java7
8 files changed, 59 insertions, 27 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index b8253d6..94ae584 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -751,11 +751,6 @@
<item>auto</item>
</string-array>
- <string-array name="pref_video_focusmode_default_array" translatable="false">
- <item>continuous-video</item>
- <item>auto</item>
- </string-array>
-
<!-- Icons for exposure compensation -->
<array name="pref_camera_exposure_icons" translatable="false">
<item>@drawable/ic_exposure_n3</item>
diff --git a/res/values/cm_arrays.xml b/res/values/cm_arrays.xml
index d341435..7a1aede 100644
--- a/res/values/cm_arrays.xml
+++ b/res/values/cm_arrays.xml
@@ -92,4 +92,20 @@
<item>30</item>
</string-array>
+ <!-- Default focus mode setting.-->
+ <string-array name="pref_video_focusmode_default_array" translatable="false">
+ <item>continuous-video</item>
+ <item>auto</item>
+ </string-array>
+
+ <!-- Camcorder Preferences focus mode dialog box entries -->
+ <string-array name="pref_video_focusmode_entries" translatable="false">
+ <item>@string/pref_camera_focusmode_entry_auto</item>
+ <item>@string/pref_camera_focusmode_entry_continuous</item>
+ </string-array>
+
+ <string-array name="pref_video_focusmode_entryvalues" translatable="false">
+ <item>auto</item>
+ <item>continuous-video</item>
+ </string-array>
</resources>
diff --git a/res/xml/video_preferences.xml b/res/xml/video_preferences.xml
index 7c4cffb..0ce03a1 100644
--- a/res/xml/video_preferences.xml
+++ b/res/xml/video_preferences.xml
@@ -166,6 +166,13 @@
camera:entries="@array/pref_camera_video_rotation_entries"
camera:entryValues="@array/pref_camera_video_rotation_entryvalues" />
<IconListPreference
+ camera:key="pref_camera_video_focusmode_key"
+ camera:defaultValue="@array/pref_video_focusmode_default_array"
+ camera:title="@string/pref_camera_focusmode_title"
+ camera:singleIcon="@drawable/ic_settings_focus"
+ camera:entries="@array/pref_video_focusmode_entries"
+ camera:entryValues="@array/pref_video_focusmode_entryvalues" />
+ <IconListPreference
camera:key="pref_camera_antibanding_key"
camera:defaultValue="@string/pref_camera_antibanding_default"
camera:title="@string/pref_camera_antibanding_title"
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index e322421..94829c2 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -58,6 +58,7 @@ public class CameraSettings {
public static final String KEY_PICTURE_SIZE = "pref_camera_picturesize_key";
public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key";
+ public static final String KEY_VIDEOCAMERA_FOCUS_MODE = "pref_camera_video_focusmode_key";
public static final String KEY_FOCUS_TIME = "pref_camera_focustime_key";
public static final String KEY_FLASH_MODE = "pref_camera_flashmode_key";
public static final String KEY_VIDEOCAMERA_FLASH_MODE = "pref_camera_video_flashmode_key";
@@ -846,6 +847,7 @@ public class CameraSettings {
ListPreference sceneMode = group.findPreference(KEY_SCENE_MODE);
ListPreference flashMode = group.findPreference(KEY_FLASH_MODE);
ListPreference focusMode = group.findPreference(KEY_FOCUS_MODE);
+ ListPreference videoFocusMode = group.findPreference(KEY_VIDEOCAMERA_FOCUS_MODE);
IconListPreference exposure =
(IconListPreference) group.findPreference(KEY_EXPOSURE);
IconListPreference cameraIdPref =
@@ -913,6 +915,10 @@ public class CameraSettings {
filterUnsupportedOptions(group,
focusMode, mParameters.getSupportedFocusModes());
}
+ if (videoFocusMode != null) {
+ filterUnsupportedOptions(group,
+ videoFocusMode, mParameters.getSupportedFocusModes());
+ }
if (videoFlashMode != null) {
filterUnsupportedOptions(group,
videoFlashMode, mParameters.getSupportedFlashModes());
diff --git a/src/com/android/camera/FocusOverlayManager.java b/src/com/android/camera/FocusOverlayManager.java
index 5e96061..401480d 100644
--- a/src/com/android/camera/FocusOverlayManager.java
+++ b/src/com/android/camera/FocusOverlayManager.java
@@ -438,7 +438,7 @@ public class FocusOverlayManager {
}
}
- public String getFocusMode() {
+ public String getFocusMode(boolean fromVideo) {
if (mOverrideFocusMode != null) return mOverrideFocusMode;
if (mParameters == null) return Parameters.FOCUS_MODE_AUTO;
List<String> supportedFocusModes = mParameters.getSupportedFocusModes();
@@ -448,8 +448,13 @@ public class FocusOverlayManager {
mFocusMode = Parameters.FOCUS_MODE_AUTO;
} else {
// The default is continuous autofocus.
- mFocusMode = mPreferences.getString(
- CameraSettings.KEY_FOCUS_MODE, null);
+ if (fromVideo) {
+ mFocusMode = mPreferences.getString(
+ CameraSettings.KEY_VIDEOCAMERA_FOCUS_MODE, null);
+ } else {
+ mFocusMode = mPreferences.getString(
+ CameraSettings.KEY_FOCUS_MODE, null);
+ }
// Try to find a supported focus mode from the default list.
if (mFocusMode == null) {
@@ -549,7 +554,7 @@ public class FocusOverlayManager {
}
private boolean needAutoFocusCall() {
- String focusMode = getFocusMode();
+ String focusMode = getFocusMode(false);
return !(focusMode.equals(Parameters.FOCUS_MODE_INFINITY)
|| focusMode.equals(Parameters.FOCUS_MODE_FIXED)
|| focusMode.equals(Parameters.FOCUS_MODE_EDOF));
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 08d5a0a..8af68a2 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -1227,16 +1227,16 @@ public class PhotoModule
if (needRestartPreview) {
Log.d(TAG, "JpegPictureCallback: needRestartPreview");
setupPreview();
- if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())
- || CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
+ if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))
+ || CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))) {
mCameraDevice.cancelAutoFocus();
}
} else if (((mCameraState != LONGSHOT) && (mReceivedSnapNum == mBurstSnapNum))
|| isLongshotDone()){
mUI.enableShutter(true);
mFocusManager.resetTouchFocus();
- if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())
- || CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
+ if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))
+ || CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))) {
mCameraDevice.cancelAutoFocus();
}
if (!mIsImageCaptureIntent) {
@@ -1696,7 +1696,7 @@ public class PhotoModule
}
if ((mManual3AEnabled & MANUAL_FOCUS) != 0) {
mUI.overrideSettings(CameraSettings.KEY_FOCUS_MODE,
- mFocusManager.getFocusMode());
+ mFocusManager.getFocusMode(false));
}
}
@@ -1788,7 +1788,7 @@ public class PhotoModule
if (!Parameters.SCENE_MODE_AUTO.equals(mSceneMode)) {
flashMode = mParameters.FLASH_MODE_OFF;
String whiteBalance = Parameters.WHITE_BALANCE_AUTO;
- focusMode = mFocusManager.getFocusMode();
+ focusMode = mFocusManager.getFocusMode(false);
colorEffect = mParameters.getColorEffect();
String defaultEffect = mActivity.getString(R.string.pref_camera_coloreffect_default);
if (CameraUtil.SCENE_MODE_HDR.equals(mSceneMode)
@@ -2680,8 +2680,8 @@ public class PhotoModule
if (!mSnapshotOnIdle) {
// If the focus mode is continuous autofocus, call cancelAutoFocus to
// resume it because it may have been paused by autoFocus call.
- if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode()) ||
- CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
+ if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false)) ||
+ CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))) {
mCameraDevice.cancelAutoFocus();
}
} else {
@@ -3177,10 +3177,10 @@ public class PhotoModule
}
} else if (mFocusManager.isTouch()) {
mFocusManager.overrideFocusMode(null);
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(false));
} else {
// If not supported use the current mode
- mFocusManager.overrideFocusMode(mFocusManager.getFocusMode());
+ mFocusManager.overrideFocusMode(mFocusManager.getFocusMode(false));
}
if (!pictureFormat.equals(PIXEL_FORMAT_JPEG)) {
@@ -3197,7 +3197,7 @@ public class PhotoModule
mFocusManager.setZslEnable(false);
if ((mManual3AEnabled & MANUAL_FOCUS) == 0) {
mFocusManager.overrideFocusMode(null);
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(false));
}
}
// Set face detetction parameter.
@@ -3345,7 +3345,7 @@ public class PhotoModule
// initialize focus mode
if ((mManual3AEnabled & MANUAL_FOCUS) == 0) {
mFocusManager.overrideFocusMode(null);
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(false));
}
// Set picture size.
@@ -3555,7 +3555,7 @@ public class PhotoModule
// Set focus mode.
if ((mManual3AEnabled & MANUAL_FOCUS) == 0) {
mFocusManager.overrideFocusMode(null);
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(false));
}
// Set focus time.
@@ -3800,7 +3800,7 @@ public class PhotoModule
alert.show();
} else {
mManual3AEnabled &= ~MANUAL_FOCUS;
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(false));
mUI.overrideSettings(CameraSettings.KEY_FOCUS_MODE, null);
updateCommonManual3ASettings();
onSharedPreferenceChanged();
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index b2805ac..c534900 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -109,7 +109,7 @@ public class VideoMenu extends MenuController
mOtherKeys1 = new String[] {
CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,
CameraSettings.KEY_VIDEO_QUALITY,
- CameraSettings.KEY_FOCUS_TIME,
+ CameraSettings.KEY_VIDEOCAMERA_FOCUS_MODE,
CameraSettings.KEY_RECORD_LOCATION,
CameraSettings.KEY_CAMERA_SAVEPATH,
CameraSettings.KEY_EXPOSURE,
@@ -121,7 +121,7 @@ public class VideoMenu extends MenuController
mOtherKeys2 = new String[] {
CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,
CameraSettings.KEY_VIDEO_QUALITY,
- CameraSettings.KEY_FOCUS_TIME,
+ CameraSettings.KEY_VIDEOCAMERA_FOCUS_MODE,
CameraSettings.KEY_RECORD_LOCATION,
CameraSettings.KEY_CAMERA_SAVEPATH,
CameraSettings.KEY_EXPOSURE,
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index fd7bff6..cecaf14 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -535,7 +535,7 @@ public class VideoModule implements CameraModule,
if (mMeteringAreaSupported)
mParameters.setMeteringAreas(mFocusManager.getMeteringAreas());
if (mFocusAreaSupported || mMeteringAreaSupported) {
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(true));
mCameraDevice.setParameters(mParameters);
}
}
@@ -2509,7 +2509,10 @@ public class VideoModule implements CameraModule,
mParameters.setVideoRotation(videoRotation);
}
+ // Set focus mode
+ mParameters.setFocusMode(mFocusManager.getFocusMode(true));
}
+
@SuppressWarnings("deprecation")
private void setCameraParameters() {
Log.d(TAG,"Preview dimension in App->"+mDesiredPreviewWidth+"X"+mDesiredPreviewHeight);
@@ -2564,7 +2567,7 @@ public class VideoModule implements CameraModule,
}
// Set focus mode
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(true));
mParameters.set(CameraUtil.RECORDING_HINT, CameraUtil.TRUE);