summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraSettings.java
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-05-05 15:37:25 +0800
committerWu-cheng Li <wuchengli@google.com>2011-05-06 13:01:53 +0800
commit9fff0f154b8531094aa1349e0241a998c14da810 (patch)
tree19187b2541e8fd2c612297a6fe4c9b4f80bc649e /src/com/android/camera/CameraSettings.java
parent3d108b88030763f102398487e9b9e74fb67b47a8 (diff)
downloadLegacyCamera-9fff0f154b8531094aa1349e0241a998c14da810.zip
LegacyCamera-9fff0f154b8531094aa1349e0241a998c14da810.tar.gz
LegacyCamera-9fff0f154b8531094aa1349e0241a998c14da810.tar.bz2
Pass camera id while getting camcorder profile.
This also prevents NPE during variable initialization if camera module fails to load. When camera module fails to load, CamcorderProfile.get(int) will return null. bug:4381780 Change-Id: I14a9af9e6f172cd02ef6df11ed81f1655361618a
Diffstat (limited to 'src/com/android/camera/CameraSettings.java')
-rw-r--r--src/com/android/camera/CameraSettings.java28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 86dacd0..225cf88 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -56,8 +56,7 @@ public class CameraSettings {
public static final int CURRENT_VERSION = 4;
public static final int CURRENT_LOCAL_VERSION = 1;
- // max video duration in seconds for mms and youtube.
- private static final int MMS_VIDEO_DURATION = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW).duration;
+ // max video duration in seconds for youtube.
private static final int YOUTUBE_VIDEO_DURATION = 15 * 60; // 15 mins
private static final int DEFAULT_VIDEO_DURATION = 0; // no limit
@@ -181,21 +180,6 @@ public class CameraSettings {
if (timeLapseInterval != null) resetIfInvalid(timeLapseInterval);
}
- private static List<String> getSupportedTimeLapseProfiles(int cameraId) {
- ArrayList<String> supportedProfiles = new ArrayList<String>();
- if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_TIME_LAPSE_480P)) {
- supportedProfiles.add(Integer.toString(CamcorderProfile.QUALITY_TIME_LAPSE_480P));
- }
- if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_TIME_LAPSE_720P)) {
- supportedProfiles.add(Integer.toString(CamcorderProfile.QUALITY_TIME_LAPSE_720P));
- }
- if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_TIME_LAPSE_1080P)) {
- supportedProfiles.add(Integer.toString(CamcorderProfile.QUALITY_TIME_LAPSE_1080P));
- }
-
- return supportedProfiles;
- }
-
private void buildExposureCompensation(
PreferenceGroup group, ListPreference exposure) {
int max = mParameters.getMaxExposureCompensation();
@@ -358,9 +342,11 @@ public class CameraSettings {
|| context.getString(R.string.pref_video_quality_high).equals(quality);
}
- public static int getVideoDurationInMillis(Context context, String quality) {
+ public static int getVideoDurationInMillis(Context context, String quality, int cameraId) {
if (context.getString(R.string.pref_video_quality_mms).equals(quality)) {
- return MMS_VIDEO_DURATION * 1000;
+ int mmsVideoDuration = CamcorderProfile.get(cameraId,
+ CamcorderProfile.QUALITY_LOW).duration;
+ return mmsVideoDuration * 1000;
} else if (context.getString(R.string.pref_video_quality_youtube).equals(quality)) {
return YOUTUBE_VIDEO_DURATION * 1000;
}
@@ -417,11 +403,13 @@ public class CameraSettings {
CharSequence[] entries = videoQuality.getEntries();
CharSequence[] values = videoQuality.getEntryValues();
if (Util.isMmsCapable(mContext)) {
+ int mmsVideoDuration = CamcorderProfile.get(mCameraId,
+ CamcorderProfile.QUALITY_LOW).duration;
// We need to fill in the device-dependent value (in seconds).
for (int i = 0; i < entries.length; ++i) {
if (mContext.getString(R.string.pref_video_quality_mms).equals(values[i])) {
entries[i] = entries[i].toString().replace(
- "30", Integer.toString(MMS_VIDEO_DURATION));
+ "30", Integer.toString(mmsVideoDuration));
break;
}
}