summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
authorSanjeev Garg <sangarg@codeaurora.org>2015-09-02 19:57:10 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2015-09-16 02:42:07 -0700
commite51e82617b631046af8e5f5035f53fc66dfb524d (patch)
treec06bb2ba6ef00213d113a56060b5cb68392db21a /src/com/android/camera/VideoModule.java
parent465c11e451e18b7f3e8109fdbbc56b866f7f8a56 (diff)
downloadandroid_packages_apps_Snap-e51e82617b631046af8e5f5035f53fc66dfb524d.tar.gz
android_packages_apps_Snap-e51e82617b631046af8e5f5035f53fc66dfb524d.tar.bz2
android_packages_apps_Snap-e51e82617b631046af8e5f5035f53fc66dfb524d.zip
SnapdragonCamera: Adding support for any number of cameras in app.
At present the SnapdragonCamera App can support maximum of 2 cameras. Generalizing SnapdragonCamera App to support any number of cameras exposed to the application. Note - If number of cameras supported is greater than 2 then we need to add corresponding entries in media_profiles.xml so that recording can work fine on more than 2 cameras supported. Change-Id: Ic20667e29e0541d71c764bfd51a9c7a4d2ea83cd
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--src/com/android/camera/VideoModule.java60
1 files changed, 33 insertions, 27 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 2bd5e1584..f1bad38d2 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -527,34 +527,40 @@ public class VideoModule implements CameraModule,
settings.getPreferenceGroup(R.xml.video_preferences));
int numOfCams = Camera.getNumberOfCameras();
- int backCamId = CameraHolder.instance().getBackCameraId();
- int frontCamId = CameraHolder.instance().getFrontCameraId();
- // We need to swap the list preference contents if back camera and front camera
- // IDs are not 0 and 1 respectively
- if( (numOfCams == 2) && ((backCamId != CameraInfo.CAMERA_FACING_BACK)
- || (frontCamId != CameraInfo.CAMERA_FACING_FRONT))) {
- Log.e(TAG,"loadCameraPreferences() updating camera_id pref");
-
- IconListPreference switchIconPref =
- (IconListPreference)mPreferenceGroup.findPreference(
- CameraSettings.KEY_CAMERA_ID);
-
- int[] iconIds = {R.drawable.ic_switch_front, R.drawable.ic_switch_back};
- switchIconPref.setIconIds(iconIds);
-
- String[] entries = {mActivity.getResources().getString(
- R.string.pref_camera_id_entry_front), mActivity.getResources().
- getString(R.string.pref_camera_id_entry_back)};
- switchIconPref.setEntries(entries);
-
- String[] labels = {mActivity.getResources().getString(
- R.string.pref_camera_id_label_front), mActivity.getResources().
- getString(R.string.pref_camera_id_label_back)};
- switchIconPref.setLabels(labels);
-
- int[] largeIconIds = {R.drawable.ic_switch_front, R.drawable.ic_switch_back};
- switchIconPref.setLargeIconIds(largeIconIds);
+
+ //TODO: If numOfCams > 2 then corresponding entries needs to be added to the media_profiles.xml
+
+ Log.e(TAG,"loadCameraPreferences() updating camera_id pref");
+
+ int[] iconIds = new int[numOfCams];
+ String[] entries = new String[numOfCams];
+ String[] labels = new String[numOfCams];
+ int[] largeIconIds = new int[numOfCams];
+
+ for(int i=0;i<numOfCams;i++) {
+ CameraInfo info = CameraHolder.instance().getCameraInfo()[i];
+ if(info.facing == CameraInfo.CAMERA_FACING_BACK) {
+ iconIds[i] = R.drawable.ic_switch_back;
+ entries[i] = mActivity.getResources().getString(R.string.pref_camera_id_entry_back);
+ labels[i] = mActivity.getResources().getString(R.string.pref_camera_id_label_back);
+ largeIconIds[i] = R.drawable.ic_switch_back;
+ } else {
+ iconIds[i] = R.drawable.ic_switch_front;
+ entries[i] = mActivity.getResources().getString(R.string.pref_camera_id_entry_front);
+ labels[i] = mActivity.getResources().getString(R.string.pref_camera_id_label_front);
+ largeIconIds[i] = R.drawable.ic_switch_front;
+ }
}
+
+ IconListPreference switchIconPref =
+ (IconListPreference)mPreferenceGroup.findPreference(
+ CameraSettings.KEY_CAMERA_ID);
+
+ switchIconPref.setIconIds(iconIds);
+ switchIconPref.setEntries(entries);
+ switchIconPref.setLabels(labels);
+ switchIconPref.setLargeIconIds(largeIconIds);
+
}
private void initializeVideoControl() {