Add maximum recording length resource. DO NOT MERGE bug:7075393 Change-Id: Ieb18d955d809193f652c41eb36d52f2acb8e18e0
diff --git a/res/values/config.xml b/res/values/config.xml new file mode 100644 index 0000000..33e1e14 --- /dev/null +++ b/res/values/config.xml
@@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- Camera app resources that may need to be customized + for different hardware or product builds. --> +<resources> + <!-- Maximum recording length in milliseconds. 0 means unlimited. --> + <integer name="max_video_recording_length">0</integer> +</resources>
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 48d0593..5647ec7 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java
@@ -20,6 +20,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; +import android.content.res.Resources; import android.hardware.Camera.CameraInfo; import android.hardware.Camera.Parameters; import android.hardware.Camera.Size; @@ -59,8 +60,6 @@ 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 String TAG = "CameraSettings"; private final Context mContext; @@ -133,6 +132,15 @@ return false; } + public static int getMaxVideoDuration(Context context) { + int duration = 0; // in milliseconds, 0 means unlimited. + try { + duration = context.getResources().getInteger(R.integer.max_video_recording_length); + } catch (Resources.NotFoundException ex) { + } + return duration; + } + private void initPreference(PreferenceGroup group) { ListPreference videoQuality = group.findPreference(KEY_VIDEO_QUALITY); ListPreference timeLapseInterval = group.findPreference(KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL); @@ -444,7 +452,6 @@ return null; } - public static void restorePreferences(Context context, ComboPreferences preferences, Parameters parameters) { int currentCameraId = readPreferredCameraId(preferences);
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index ae5176b..1029008 100755 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java
@@ -663,7 +663,7 @@ intent.getIntExtra(MediaStore.EXTRA_DURATION_LIMIT, 0); mMaxVideoDurationInMs = 1000 * seconds; } else { - mMaxVideoDurationInMs = CameraSettings.DEFAULT_VIDEO_DURATION; + mMaxVideoDurationInMs = CameraSettings.getMaxVideoDuration(this); } // Set effect