Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add maximum recording length resource. DO NOT MERGE
bug:7075393

Change-Id: Ieb18d955d809193f652c41eb36d52f2acb8e18e0
  • Loading branch information
Angus Kong committed Nov 2, 2012
1 parent 16687a1 commit 7365336
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
22 changes: 22 additions & 0 deletions 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>
13 changes: 10 additions & 3 deletions src/com/android/camera/CameraSettings.java
Expand Up @@ -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;
Expand Down Expand Up @@ -59,8 +60,6 @@ public class CameraSettings {
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;
Expand Down Expand Up @@ -133,6 +132,15 @@ public static boolean setCameraPictureSize(
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);
Expand Down Expand Up @@ -444,7 +452,6 @@ public static Object readEffectParameter(SharedPreferences pref) {
return null;
}


public static void restorePreferences(Context context,
ComboPreferences preferences, Parameters parameters) {
int currentCameraId = readPreferredCameraId(preferences);
Expand Down
2 changes: 1 addition & 1 deletion src/com/android/camera/VideoCamera.java
Expand Up @@ -663,7 +663,7 @@ private void readVideoPreferences() {
intent.getIntExtra(MediaStore.EXTRA_DURATION_LIMIT, 0);
mMaxVideoDurationInMs = 1000 * seconds;
} else {
mMaxVideoDurationInMs = CameraSettings.DEFAULT_VIDEO_DURATION;
mMaxVideoDurationInMs = CameraSettings.getMaxVideoDuration(this);
}

// Set effect
Expand Down

0 comments on commit 7365336

Please sign in to comment.