summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraSettings.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/CameraSettings.java')
-rw-r--r--src/com/android/camera/CameraSettings.java455
1 files changed, 441 insertions, 14 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 55867a1e8..c70ee9909 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -16,12 +16,14 @@
package com.android.camera;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.Size;
@@ -36,6 +38,8 @@ import com.android.camera2.R;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import android.os.Build;
+import java.util.StringTokenizer;
/**
* Provides utilities and keys for Camera settings.
@@ -61,17 +65,95 @@ public class CameraSettings {
public static final String KEY_VIDEO_EFFECT = "pref_video_effect_key";
public static final String KEY_CAMERA_ID = "pref_camera_id_key";
public static final String KEY_CAMERA_HDR = "pref_camera_hdr_key";
+ public static final String KEY_CAMERA_HQ = "pref_camera_hq_key";
public static final String KEY_CAMERA_HDR_PLUS = "pref_camera_hdr_plus_key";
public static final String KEY_CAMERA_FIRST_USE_HINT_SHOWN = "pref_camera_first_use_hint_shown_key";
public static final String KEY_VIDEO_FIRST_USE_HINT_SHOWN = "pref_video_first_use_hint_shown_key";
public static final String KEY_PHOTOSPHERE_PICTURESIZE = "pref_photosphere_picturesize_key";
public static final String KEY_STARTUP_MODULE_INDEX = "camera.startup_module";
+ public static final String KEY_VIDEO_ENCODER = "pref_camera_videoencoder_key";
+ public static final String KEY_AUDIO_ENCODER = "pref_camera_audioencoder_key";
+ public static final String KEY_VIDEO_DURATION = "pref_camera_video_duration_key";
+ public static final String KEY_POWER_MODE = "pref_camera_powermode_key";
+ public static final String KEY_PICTURE_FORMAT = "pref_camera_pictureformat_key";
+ public static final String KEY_ZSL = "pref_camera_zsl_key";
+ public static final String KEY_CAMERA_SAVEPATH = "pref_camera_savepath_key";
+ public static final String KEY_COLOR_EFFECT = "pref_camera_coloreffect_key";
+ public static final String KEY_FACE_DETECTION = "pref_camera_facedetection_key";
+ public static final String KEY_TOUCH_AF_AEC = "pref_camera_touchafaec_key";
+ public static final String KEY_SELECTABLE_ZONE_AF = "pref_camera_selectablezoneaf_key";
+ public static final String KEY_SATURATION = "pref_camera_saturation_key";
+ public static final String KEY_CONTRAST = "pref_camera_contrast_key";
+ public static final String KEY_SHARPNESS = "pref_camera_sharpness_key";
+ public static final String KEY_AUTOEXPOSURE = "pref_camera_autoexposure_key";
+ public static final String KEY_ANTIBANDING = "pref_camera_antibanding_key";
+ public static final String KEY_ISO = "pref_camera_iso_key";
+ public static final String KEY_LENSSHADING = "pref_camera_lensshading_key";
+ public static final String KEY_HISTOGRAM = "pref_camera_histogram_key";
+ public static final String KEY_DENOISE = "pref_camera_denoise_key";
+ public static final String KEY_REDEYE_REDUCTION = "pref_camera_redeyereduction_key";
+ public static final String KEY_AE_BRACKET_HDR = "pref_camera_ae_bracket_hdr_key";
+ public static final String KEY_ADVANCED_FEATURES = "pref_camera_advanced_features_key";
+
+ public static final String KEY_VIDEO_SNAPSHOT_SIZE = "pref_camera_videosnapsize_key";
+ public static final String KEY_VIDEO_HIGH_FRAME_RATE = "pref_camera_hfr_key";
+ public static final String KEY_VIDEO_HDR = "pref_camera_video_hdr_key";
+ public static final String DEFAULT_VIDEO_QUALITY_VALUE = "custom";
+ public static final String KEY_SKIN_TONE_ENHANCEMENT = "pref_camera_skinToneEnhancement_key";
+ public static final String KEY_SKIN_TONE_ENHANCEMENT_FACTOR = "pref_camera_skinToneEnhancement_factor_key";
+
+ public static final String KEY_FACE_RECOGNITION = "pref_camera_facerc_key";
+ public static final String KEY_DIS = "pref_camera_dis_key";
+
+ public static final String KEY_LONGSHOT = "pref_camera_longshot_key";
+
+ private static final String KEY_QC_SUPPORTED_AE_BRACKETING_MODES = "ae-bracket-hdr-values";
+ private static final String KEY_QC_SUPPORTED_AF_BRACKETING_MODES = "af-bracket-values";
+ private static final String KEY_QC_SUPPORTED_CF_MODES = "chroma-flash-values";
+ private static final String KEY_QC_SUPPORTED_OZ_MODES = "opti-zoom-values";
+ private static final String KEY_QC_SUPPORTED_FACE_RECOGNITION_MODES = "face-recognition-values";
+ private static final String KEY_QC_SUPPORTED_DIS_MODES = "dis-values";
+ public static final String KEY_QC_AE_BRACKETING = "ae-bracket-hdr";
+ public static final String KEY_QC_AF_BRACKETING = "af-bracket";
+ public static final String KEY_QC_CHROMA_FLASH = "chroma-flash";
+ public static final String KEY_QC_OPTI_ZOOM = "opti-zoom";
+ public static final String KEY_QC_FACE_RECOGNITION = "face-recognition";
+ public static final String KEY_QC_DIS_MODE = "dis";
+
+ public static final String KEY_INTERNAL_PREVIEW_RESTART = "internal-restart";
+ public static final String KEY_QC_ZSL_HDR_SUPPORTED = "zsl-hdr-supported";
+ public static final String KEY_QC_LONGSHOT_SUPPORTED = "longshot-supported";
+ private static final String TRUE = "true";
+ private static final String FALSE = "false";
+
+ //for flip
+ public static final String KEY_QC_PREVIEW_FLIP = "preview-flip";
+ public static final String KEY_QC_VIDEO_FLIP = "video-flip";
+ public static final String KEY_QC_SNAPSHOT_PICTURE_FLIP = "snapshot-picture-flip";
+ public static final String KEY_QC_SUPPORTED_FLIP_MODES = "flip-mode-values";
+
+ public static final String FLIP_MODE_OFF = "off";
+ public static final String FLIP_MODE_V = "flip-v";
+ public static final String FLIP_MODE_H = "flip-h";
+ public static final String FLIP_MODE_VH = "flip-vh";
+
+ private static final String KEY_QC_PICTURE_FORMAT = "picture-format-values";
+ private static final String VIDEO_QUALITY_HIGH = "high";
+ private static final String VIDEO_QUALITY_MMS = "mms";
+ private static final String VIDEO_QUALITY_YOUTUBE = "youtube";
+
+
public static final String EXPOSURE_DEFAULT_VALUE = "0";
public static final int CURRENT_VERSION = 5;
public static final int CURRENT_LOCAL_VERSION = 2;
+ public static final int DEFAULT_VIDEO_DURATION = 0; // no limit
+ private static final int MMS_VIDEO_DURATION = (CamcorderProfile.get(CamcorderProfile.QUALITY_LOW) != null) ?
+ CamcorderProfile.get(CamcorderProfile.QUALITY_LOW).duration :30;
+ private static final int YOUTUBE_VIDEO_DURATION = 15 * 60; // 15 mins
+
private static final String TAG = "CameraSettings";
private final Context mContext;
@@ -96,10 +178,10 @@ public class CameraSettings {
}
public static String getSupportedHighestVideoQuality(int cameraId,
- String defaultQuality) {
+ String defaultQuality,Parameters parameters) {
// When launching the camera app first time, we will set the video quality
// to the first one (i.e. highest quality) in the supported list
- List<String> supported = getSupportedVideoQuality(cameraId);
+ List<String> supported = getSupportedVideoQuality(cameraId,parameters);
if (supported == null) {
Log.e(TAG, "No supported video quality is found");
return defaultQuality;
@@ -156,6 +238,210 @@ public class CameraSettings {
return duration;
}
+ public static List<String> getSupportedFaceRecognitionModes(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_FACE_RECOGNITION_MODES);
+ if (str == null) {
+ return null;
+ }
+ return split(str);
+ }
+
+ public static List<String> getSupportedDISModes(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_DIS_MODES);
+ if (str == null) {
+ return null;
+ }
+ return split(str);
+ }
+
+ public static List<String> getSupportedAEBracketingModes(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_AE_BRACKETING_MODES);
+ if (str == null) {
+ return null;
+ }
+ return split(str);
+ }
+
+ public List<String> getSupportedAdvancedFeatures(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_AF_BRACKETING_MODES);
+ str += ',' + params.get(KEY_QC_SUPPORTED_CF_MODES);
+ str += ',' + params.get(KEY_QC_SUPPORTED_OZ_MODES);
+ str += ',' + mContext.getString(R.string.pref_camera_advanced_feature_default);
+ return split(str);
+ }
+
+ public static List<String> getSupportedAFBracketingModes(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_AF_BRACKETING_MODES);
+ if (str == null) {
+ return null;
+ }
+ return split(str);
+ }
+
+ public static List<String> getSupportedChromaFlashModes(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_CF_MODES);
+ if (str == null) {
+ return null;
+ }
+ return split(str);
+ }
+
+ public static List<String> getSupportedOptiZoomModes(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_OZ_MODES);
+ if (str == null) {
+ return null;
+ }
+ return split(str);
+ }
+
+
+ // Splits a comma delimited string to an ArrayList of String.
+ // Return null if the passing string is null or the size is 0.
+ private static ArrayList<String> split(String str) {
+ if (str == null) return null;
+
+ // Use StringTokenizer because it is faster than split.
+ StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ ArrayList<String> substrings = new ArrayList<String>();
+ while (tokenizer.hasMoreElements()) {
+ substrings.add(tokenizer.nextToken());
+ }
+ return substrings;
+ }
+ private List<String> getSupportedPictureFormatLists() {
+ String str = mParameters.get(KEY_QC_PICTURE_FORMAT);
+ if (str == null) {
+ str = "jpeg,raw"; // if not set, fall back to default behavior
+ }
+ return split(str);
+ }
+
+ public static List<String> getSupportedFlipMode(Parameters params){
+ String str = params.get(KEY_QC_SUPPORTED_FLIP_MODES);
+ if(str == null)
+ return null;
+
+ return split(str);
+ }
+
+ private void qcomInitPreferences(PreferenceGroup group){
+ //Qcom Preference add here
+ ListPreference powerMode = group.findPreference(KEY_POWER_MODE);
+ ListPreference zsl = group.findPreference(KEY_ZSL);
+ ListPreference colorEffect = group.findPreference(KEY_COLOR_EFFECT);
+ ListPreference faceDetection = group.findPreference(KEY_FACE_DETECTION);
+ ListPreference touchAfAec = group.findPreference(KEY_TOUCH_AF_AEC);
+ ListPreference selectableZoneAf = group.findPreference(KEY_SELECTABLE_ZONE_AF);
+ ListPreference saturation = group.findPreference(KEY_SATURATION);
+ ListPreference contrast = group.findPreference(KEY_CONTRAST);
+ ListPreference sharpness = group.findPreference(KEY_SHARPNESS);
+ ListPreference autoExposure = group.findPreference(KEY_AUTOEXPOSURE);
+ ListPreference antiBanding = group.findPreference(KEY_ANTIBANDING);
+ ListPreference mIso = group.findPreference(KEY_ISO);
+ ListPreference lensShade = group.findPreference(KEY_LENSSHADING);
+ ListPreference histogram = group.findPreference(KEY_HISTOGRAM);
+ ListPreference denoise = group.findPreference(KEY_DENOISE);
+ ListPreference redeyeReduction = group.findPreference(KEY_REDEYE_REDUCTION);
+ ListPreference aeBracketing = group.findPreference(KEY_AE_BRACKET_HDR);
+ ListPreference advancedFeatures = group.findPreference(KEY_ADVANCED_FEATURES);
+ ListPreference faceRC = group.findPreference(KEY_FACE_RECOGNITION);
+ ListPreference jpegQuality = group.findPreference(KEY_JPEG_QUALITY);
+ ListPreference videoSnapSize = group.findPreference(KEY_VIDEO_SNAPSHOT_SIZE);
+ ListPreference videoHdr = group.findPreference(KEY_VIDEO_HDR);
+ ListPreference pictureFormat = group.findPreference(KEY_PICTURE_FORMAT);
+ ListPreference hfr = group.findPreference(KEY_VIDEO_HIGH_FRAME_RATE);
+ ListPreference longShot = group.findPreference(KEY_LONGSHOT);
+
+ if (touchAfAec != null) {
+ filterUnsupportedOptions(group,
+ touchAfAec, mParameters.getSupportedTouchAfAec());
+ }
+
+ if (!mParameters.isPowerModeSupported() && powerMode != null) {
+ removePreference(group, powerMode.getKey());
+ }
+
+ if (selectableZoneAf != null) {
+ filterUnsupportedOptions(group,
+ selectableZoneAf, mParameters.getSupportedSelectableZoneAf());
+ }
+
+ if (mIso != null) {
+ filterUnsupportedOptions(group,
+ mIso, mParameters.getSupportedIsoValues());
+ }
+
+ if (redeyeReduction != null) {
+ filterUnsupportedOptions(group,
+ redeyeReduction, mParameters.getSupportedRedeyeReductionModes());
+ }
+
+ if (denoise != null) {
+ filterUnsupportedOptions(group,
+ denoise, mParameters.getSupportedDenoiseModes());
+ }
+
+ if (videoHdr != null) {
+ filterUnsupportedOptions(group,
+ videoHdr, mParameters.getSupportedVideoHDRModes());
+ }
+
+ if (colorEffect != null) {
+ filterUnsupportedOptions(group,
+ colorEffect, mParameters.getSupportedColorEffects());
+ }
+
+ if (aeBracketing != null) {
+ filterUnsupportedOptions(group,
+ aeBracketing, getSupportedAEBracketingModes(mParameters));
+ }
+
+ if (antiBanding != null) {
+ filterUnsupportedOptions(group,
+ antiBanding, mParameters.getSupportedAntibanding());
+ }
+
+ if (faceRC != null) {
+ filterUnsupportedOptions(group,
+ faceRC, getSupportedFaceRecognitionModes(mParameters));
+ }
+
+ if (autoExposure != null) {
+ filterUnsupportedOptions(group,
+ autoExposure, mParameters.getSupportedAutoexposure());
+ }
+
+ if (!mParameters.isPowerModeSupported()){
+ filterUnsupportedOptions(group,
+ videoSnapSize, null);
+ } else {
+ filterUnsupportedOptions(group, videoSnapSize, sizeListToStringList(
+ mParameters.getSupportedPictureSizes()));
+ }
+
+ if (histogram!= null) {
+ filterUnsupportedOptions(group,
+ histogram, mParameters.getSupportedHistogramModes());
+ }
+
+ if (pictureFormat!= null) {
+ filterUnsupportedOptions(group,
+ pictureFormat, getSupportedPictureFormatLists());
+ }
+
+ if (hfr != null) {
+ filterUnsupportedOptions(group,
+ hfr, mParameters.getSupportedVideoHighFrameRateModes());
+ }
+
+ if(advancedFeatures != null) {
+ filterUnsupportedOptions(group,
+ advancedFeatures, getSupportedAdvancedFeatures(mParameters));
+ }
+ if (longShot!= null && !isLongshotSupported(mParameters)) {
+ removePreference(group, longShot.getKey());
+ }
+ }
private void initPreference(PreferenceGroup group) {
ListPreference videoQuality = group.findPreference(KEY_VIDEO_QUALITY);
ListPreference timeLapseInterval = group.findPreference(KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL);
@@ -172,12 +458,21 @@ public class CameraSettings {
group.findPreference(KEY_VIDEOCAMERA_FLASH_MODE);
ListPreference videoEffect = group.findPreference(KEY_VIDEO_EFFECT);
ListPreference cameraHdr = group.findPreference(KEY_CAMERA_HDR);
+ ListPreference disMode = group.findPreference(KEY_DIS);
ListPreference cameraHdrPlus = group.findPreference(KEY_CAMERA_HDR_PLUS);
+ ListPreference videoHfrMode =
+ group.findPreference(KEY_VIDEO_HIGH_FRAME_RATE);
// Since the screen could be loaded from different resources, we need
// to check if the preference is available here
+ if ((videoHfrMode != null) &&
+ (mParameters.getSupportedHfrSizes() == null)) {
+ filterUnsupportedOptions(group, videoHfrMode, null);
+ }
+
if (videoQuality != null) {
- filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality(mCameraId));
+ filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality(
+ mCameraId,mParameters));
}
if (pictureSize != null) {
@@ -197,13 +492,14 @@ public class CameraSettings {
filterUnsupportedOptions(group,
flashMode, mParameters.getSupportedFlashModes());
}
+ if (disMode != null) {
+ filterUnsupportedOptions(group,
+ disMode, getSupportedDISModes(mParameters));
+ }
if (focusMode != null) {
if (!CameraUtil.isFocusAreaSupported(mParameters)) {
filterUnsupportedOptions(group,
focusMode, mParameters.getSupportedFocusModes());
- } else {
- // Remove the focus mode if we can use tap-to-focus.
- removePreference(group, focusMode.getKey());
}
}
if (videoFlashMode != null) {
@@ -223,13 +519,13 @@ public class CameraSettings {
|| !CameraUtil.isCameraHdrSupported(mParameters))) {
removePreference(group, cameraHdr.getKey());
}
-
int frontCameraId = CameraHolder.instance().getFrontCameraId();
boolean isFrontCamera = (frontCameraId == mCameraId);
if (cameraHdrPlus != null && (!ApiHelper.HAS_CAMERA_HDR_PLUS ||
!GcamHelper.hasGcamCapture() || isFrontCamera)) {
removePreference(group, cameraHdrPlus.getKey());
}
+ qcomInitPreferences(group);
}
private void buildExposureCompensation(
@@ -424,12 +720,15 @@ public class CameraSettings {
int n = CameraHolder.instance().getNumberOfCameras();
if (cameraId < 0 || cameraId >= n) {
- writePreferredCameraId(pref, 0);
+ cameraId = 0;
}
+ writePreferredCameraId(pref, cameraId);
}
public static int readPreferredCameraId(SharedPreferences pref) {
- return Integer.parseInt(pref.getString(KEY_CAMERA_ID, "0"));
+ String rearCameraId = Integer.toString(
+ CameraHolder.instance().getBackCameraId());
+ return Integer.parseInt(pref.getString(KEY_CAMERA_ID, rearCameraId));
}
public static void writePreferredCameraId(SharedPreferences pref,
@@ -484,19 +783,147 @@ public class CameraSettings {
initialCameraPictureSize(context, parameters);
writePreferredCameraId(preferences, currentCameraId);
}
+ private static boolean checkSupportedVideoQuality(Parameters parameters,int width, int height){
+ List <Size> supported = parameters.getSupportedVideoSizes();
+ int flag = 0;
+ for (Size size : supported){
+ //since we are having two profiles with same height, we are checking with height
+ if (size.height == 480) {
+ if (size.height == height && size.width == width) {
+ flag = 1;
+ break;
+ }
+ } else {
+ if (size.width == width) {
+ flag = 1;
+ break;
+ }
+ }
+ }
+ if (flag == 1)
+ return true;
- private static ArrayList<String> getSupportedVideoQuality(int cameraId) {
+ return false;
+ }
+ private static ArrayList<String> getSupportedVideoQuality(int cameraId,Parameters parameters) {
ArrayList<String> supported = new ArrayList<String>();
// Check for supported quality
+ if (ApiHelper.HAS_FINE_RESOLUTION_QUALITY_LEVELS) {
+ getFineResolutionQuality(supported,cameraId,parameters);
+ } else {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_HIGH));
+ CamcorderProfile high = CamcorderProfile.get(
+ cameraId, CamcorderProfile.QUALITY_HIGH);
+ CamcorderProfile low = CamcorderProfile.get(
+ cameraId, CamcorderProfile.QUALITY_LOW);
+ if (high.videoFrameHeight * high.videoFrameWidth >
+ low.videoFrameHeight * low.videoFrameWidth) {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_LOW));
+ }
+ }
+
+ return supported;
+ }
+
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+ private static void getFineResolutionQuality(ArrayList<String> supported,
+ int cameraId,Parameters parameters) {
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_4kDCI)) {
+ if (checkSupportedVideoQuality(parameters,4096,2160)) {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_4kDCI));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_4kUHD)) {
+ if (checkSupportedVideoQuality(parameters,3840,2160)) {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_4kUHD));
+ }
+ }
if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_1080P)) {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_1080P));
+ if (checkSupportedVideoQuality(parameters,1920,1080)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_1080P));
+ }
}
if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_720P)) {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_720P));
+ if (checkSupportedVideoQuality(parameters,1280,720)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_720P));
+ }
}
if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_480P));
+ if (checkSupportedVideoQuality(parameters,720,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_480P));
+ }
}
- return supported;
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_FWVGA)) {
+ if (checkSupportedVideoQuality(parameters,864,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_FWVGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_WVGA)) {
+ if (checkSupportedVideoQuality(parameters,800,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_WVGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_VGA)) {
+ if (checkSupportedVideoQuality(parameters,640,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_VGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_CIF)) {
+ if (checkSupportedVideoQuality(parameters,352,288)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_CIF));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_QVGA)) {
+ if (checkSupportedVideoQuality(parameters,320,240)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_QVGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_QCIF)) {
+ if (checkSupportedVideoQuality(parameters,176,144)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_QCIF));
+ }
+ }
+
+ }
+ public static int getVideoDurationInMillis(String quality) {
+ if (VIDEO_QUALITY_MMS.equals(quality)) {
+ return MMS_VIDEO_DURATION * 1000;
+ } else if (VIDEO_QUALITY_YOUTUBE.equals(quality)) {
+ return YOUTUBE_VIDEO_DURATION * 1000;
+ }
+ return DEFAULT_VIDEO_DURATION * 1000;
+ }
+
+ public static boolean isInternalPreviewSupported(Parameters params) {
+ boolean ret = false;
+ if (null != params) {
+ String val = params.get(KEY_INTERNAL_PREVIEW_RESTART);
+ if ((null != val) && (TRUE.equals(val))) {
+ ret = true;
+ }
+ }
+ return ret;
+ }
+
+ public static boolean isLongshotSupported(Parameters params) {
+ boolean ret = false;
+ if (null != params) {
+ String val = params.get(KEY_QC_LONGSHOT_SUPPORTED);
+ if ((null != val) && (TRUE.equals(val))) {
+ ret = true;
+ }
+ }
+ return ret;
+ }
+
+ public static boolean isZSLHDRSupported(Parameters params) {
+ boolean ret = false;
+ if (null != params) {
+ String val = params.get(KEY_QC_ZSL_HDR_SUPPORTED);
+ if ((null != val) && (TRUE.equals(val))) {
+ ret = true;
+ }
+ }
+ return ret;
}
}