summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSultanxda <sultanxda@gmail.com>2015-09-08 21:32:48 -0700
committerArne Coucheron <arco68@gmail.com>2018-01-26 01:07:59 +0100
commit9830173106f96f8106e2ed56b457599cdb031191 (patch)
tree055a15dff43961704a9399a1ebec67ceb4743872
parent42c86d06b6347ada95e7a82f2caeaeddaa99f019 (diff)
downloadandroid_packages_apps_Snap-9830173106f96f8106e2ed56b457599cdb031191.zip
android_packages_apps_Snap-9830173106f96f8106e2ed56b457599cdb031191.tar.gz
android_packages_apps_Snap-9830173106f96f8106e2ed56b457599cdb031191.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>
-rwxr-xr-xres/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
-rwxr-xr-xsrc/com/android/camera/FocusOverlayManager.java13
-rw-r--r--src/com/android/camera/PhotoModule.java32
-rw-r--r--src/com/android/camera/VideoMenu.java4
-rw-r--r--src/com/android/camera/VideoModule.java7
8 files changed, 61 insertions, 29 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 635a974..3dbb801 100755
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -661,11 +661,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 83c8fed..a699d26 100644
--- a/res/xml/video_preferences.xml
+++ b/res/xml/video_preferences.xml
@@ -182,6 +182,13 @@
camera:title="@string/pref_camera_video_rotation_title"
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" />
<ListPreference
camera:key="pref_camera_antibanding_key"
camera:defaultValue="@string/pref_camera_antibanding_default"
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index a2cb896..9be4296 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -68,6 +68,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";
@@ -1069,6 +1070,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 =
@@ -1171,6 +1173,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 eae6e89..0a092b4 100755
--- a/src/com/android/camera/FocusOverlayManager.java
+++ b/src/com/android/camera/FocusOverlayManager.java
@@ -470,7 +470,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();
@@ -480,8 +480,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) {
@@ -615,7 +620,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 24bf3dd..df05952 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -1503,15 +1503,15 @@ 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 ((mReceivedSnapNum == mBurstSnapNum)
&& (mCameraState != LONGSHOT)){
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();
}
mUI.resumeFaceDetection();
@@ -2053,7 +2053,7 @@ public class PhotoModule
}
if ((mManual3AEnabled & MANUAL_FOCUS) != 0) {
mUI.overrideSettings(CameraSettings.KEY_FOCUS_MODE,
- mFocusManager.getFocusMode());
+ mFocusManager.getFocusMode(false));
}
}
@@ -2158,7 +2158,7 @@ public class PhotoModule
if (!Parameters.SCENE_MODE_AUTO.equals(mSceneMode)) {
flashMode = Parameters.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)) {
@@ -2520,7 +2520,7 @@ public class PhotoModule
setCameraState(IDLE);
mFocusManager.resetTouchFocus();
if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(
- mFocusManager.getFocusMode())) {
+ mFocusManager.getFocusMode(false))) {
mCameraDevice.cancelAutoFocus();
}
mUI.resumeFaceDetection();
@@ -3212,8 +3212,8 @@ public class PhotoModule
if (!mSnapshotOnIdle && !mInstantCaptureSnapShot) {
// 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()) && mCameraState !=INIT ||
- CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
+ if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false)) && mCameraState !=INIT ||
+ CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))) {
mCameraDevice.cancelAutoFocus();
}
} else {
@@ -3826,10 +3826,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)) {
@@ -3846,7 +3846,7 @@ public class PhotoModule
mFocusManager.setZslEnable(false);
if ((mManual3AEnabled & MANUAL_FOCUS) == 0) {
mFocusManager.overrideFocusMode(null);
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(false));
}
}
@@ -3921,7 +3921,7 @@ public class PhotoModule
mParameters.setFlashMode(fMode);
}
- if(!mFocusManager.getFocusMode().equals(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) &&
+ if(!mFocusManager.getFocusMode(false).equals(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) &&
!mFocusManager.isFocusCompleted()) {
mUI.clearFocus();
}
@@ -4123,7 +4123,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.
@@ -4361,7 +4361,7 @@ public class PhotoModule
mParameters.setFocusMode(Parameters.FOCUS_MODE_INFINITY);
} else if ((mManual3AEnabled & MANUAL_FOCUS) == 0) {
mFocusManager.overrideFocusMode(null);
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(false));
}
// Set focus time.
@@ -4631,7 +4631,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 2595f2b..b025855 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -115,7 +115,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,
@@ -128,7 +128,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 8d8485f..a3bb726 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -617,7 +617,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);
}
}
@@ -2818,6 +2818,9 @@ public class VideoModule implements CameraModule,
//set power mode settings
updatePowerMode();
+ // Set focus mode
+ mParameters.setFocusMode(mFocusManager.getFocusMode(true));
+
// Set face detetction parameter.
String faceDetection = mPreferences.getString(
CameraSettings.KEY_FACE_DETECTION,
@@ -2903,7 +2906,7 @@ public class VideoModule implements CameraModule,
// Set continuous autofocus.
// Set focus mode
- mParameters.setFocusMode(mFocusManager.getFocusMode());
+ mParameters.setFocusMode(mFocusManager.getFocusMode(true));
mParameters.set(CameraUtil.RECORDING_HINT, CameraUtil.TRUE);