summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByunghun Jeon <bjeon@codeaurora.org>2016-05-10 14:19:36 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-21 18:45:51 -0700
commit4137ed16ff29aaa83c1396b1ac748e6aafe536b3 (patch)
tree66df9e9c170efcc9440fe76a376de752b9de64ec
parent154c8e8ec204f39014d73fd8824927f2e50bf645 (diff)
downloadandroid_packages_apps_Snap-4137ed16ff29aaa83c1396b1ac748e6aafe536b3.zip
android_packages_apps_Snap-4137ed16ff29aaa83c1396b1ac748e6aafe536b3.tar.gz
android_packages_apps_Snap-4137ed16ff29aaa83c1396b1ac748e6aafe536b3.tar.bz2
SnapdragonCamera: Update settingsManager and add Dual mode to Scene mode
Update settingsManager and add Dual mode to Scene mode Change-Id: I508430840c3fb8c7d0b56a2a63e09b271754fcb4 CRs-Fixed: 1018118
-rw-r--r--res/values/camera2arrays.xml71
-rw-r--r--res/values/qcomstrings.xml12
-rw-r--r--res/xml/capture_preferences.xml24
-rw-r--r--src/com/android/camera/CameraActivity.java5
-rw-r--r--src/com/android/camera/CameraSettings.java10
-rw-r--r--src/com/android/camera/CaptureModule.java416
-rw-r--r--src/com/android/camera/CaptureUI.java79
-rw-r--r--src/com/android/camera/ComboPreferences.java4
-rw-r--r--src/com/android/camera/ListPreference.java2
-rw-r--r--src/com/android/camera/SettingsManager.java289
-rw-r--r--src/com/android/camera/ui/ListMenu.java2
-rw-r--r--src/com/android/camera/util/PersistUtil.java2
12 files changed, 575 insertions, 341 deletions
diff --git a/res/values/camera2arrays.xml b/res/values/camera2arrays.xml
index f4ac13e..8e54a2a 100644
--- a/res/values/camera2arrays.xml
+++ b/res/values/camera2arrays.xml
@@ -38,31 +38,36 @@
<item>@string/pref_camera2_camera2_value_enable</item>
</string-array>
- <string-array name="pref_camera2_dual_camera_entries" translatable="true">
- <item>@string/pref_camera2_dual_camera_entry_dual</item>
- <item>@string/pref_camera2_dual_camera_entry_bayer</item>
- <item>@string/pref_camera2_dual_camera_entry_mono</item>
+ <string-array name="pref_camera2_mono_only_entries" translatable="true">
+ <item>On</item>
+ <item>Off</item>
</string-array>
- <string-array name="pref_camera2_dual_camera_entryvalues" translatable="false">
- <item>0</item>
- <item>1</item>
- <item>2</item>
+ <string-array name="pref_camera2_mono_only_entryvalues" translatable="false">
+ <item>on</item>
+ <item>off</item>
+ </string-array>
+
+ <string-array name="pref_camera2_initial_camera_entries" translatable="true">
+ <item>Bayer</item>
+ <item>Mono</item>
+ <item>Front</item>
</string-array>
- <string-array name="pref_camera2_dual_camera_dependencylist" translatable="false">
- <item>pref_camera2_mono_preview_key</item>
- <item>pref_camera2_clearsight_key</item>
+ <string-array name="pref_camera2_initial_camera_entryvalues" translatable="false">
+ <item>bayer</item>
+ <item>mono</item>
+ <item>front</item>
</string-array>
<string-array name="pref_camera2_mono_preview_entries" translatable="true">
- <item>@string/pref_camera2_mono_preview_entry_off</item>
<item>@string/pref_camera2_mono_preview_entry_on</item>
+ <item>@string/pref_camera2_mono_preview_entry_off</item>
</string-array>
<string-array name="pref_camera2_mono_preview_entryvalues" translatable="false">
- <item>@string/pref_camera2_mono_preview_value_off</item>
<item>@string/pref_camera2_mono_preview_value_on</item>
+ <item>@string/pref_camera2_mono_preview_value_off</item>
</string-array>
<string-array name="pref_camera2_clearsight_entries" translatable="true">
@@ -75,18 +80,14 @@
<item>@string/pref_camera2_clearsight_value_on</item>
</string-array>
- <string-array name="pref_camera2_scenemode_dependencylist" translatable="false">
- <item>pref_camera2_coloreffect_key</item>
- <item>pref_camera2_flashmode_key</item>
- <item>pref_camera2_whitebalance_key</item>
- </string-array>
-
<!-- Refer to CONTROL_SCENE_MODE of Camera2 API for values
-1 refers to ones not supported in Camera2 API
0 is special case added for auto (meaning off)
+ -5 is for dual mode
-->
<string-array name="pref_camera2_scenemode_entryvalues" translatable="false">
<item>0</item>
+ <item>-5</item>
<item>18</item>
<item>-1</item>
<item>-1</item>
@@ -106,6 +107,7 @@
<!-- Camera Preferences Scene Mode dialog box entries -->
<string-array name="pref_camera2_scenemode_entries" translatable="false">
<item>@string/pref_camera_scenemode_entry_auto</item>
+ <item>Dual</item>
<item>@string/pref_camera_scenemode_entry_hdr</item>
<item>@string/pref_camera_scenemode_entry_refocus</item>
<item>@string/pref_camera_scenemode_entry_optizoom</item>
@@ -125,6 +127,7 @@
<array name="pref_camera2_scenemode_thumbnails" translatable="false">
<item>@drawable/ic_scene_mode_auto</item>
<item>@drawable/ic_scene_mode_hdr</item>
+ <item>@drawable/ic_scene_mode_hdr</item>
<item>@drawable/ic_scene_mode_refocus</item>
<item>@drawable/ic_scene_mode_optizoom</item>
<item>@drawable/ic_scene_mode_portrait</item>
@@ -140,51 +143,35 @@
<item>@drawable/ic_scene_mode_smartauto</item>
</array>
- <string-array name="pref_camera2_scenemode_labels">
- <item>@string/pref_camera_scenemode_label_action</item>
- <item>@string/pref_camera_scenemode_label_night</item>
- <item>@string/pref_camera_scenemode_label_auto</item>
- <item>@string/pref_camera_scenemode_label_sunset</item>
- <item>@string/pref_camera_scenemode_label_party</item>
- </string-array>
-
- <array name="pref_camera2_scenemode_icons">
- <item>@drawable/ic_sce_action</item>
- <item>@drawable/ic_sce_night</item>
- <item>@drawable/ic_sce_off</item>
- <item>@drawable/ic_sce_sunset</item>
- <item>@drawable/ic_sce_party</item>
- </array>
-
<string-array name="pref_camera2_whitebalance_entryvalues" translatable="false">
+ <item>1</item>
<item>2</item>
<item>4</item>
- <item>1</item>
<item>5</item>
<item>6</item>
</string-array>
<!-- Camera Preferences White Balance dialog box entries -->
<string-array name="pref_camera2_whitebalance_entries" translatable="false">
+ <item>@string/pref_camera_whitebalance_entry_auto</item>
<item>@string/pref_camera_whitebalance_entry_incandescent</item>
<item>@string/pref_camera_whitebalance_entry_fluorescent</item>
- <item>@string/pref_camera_whitebalance_entry_auto</item>
<item>@string/pref_camera_whitebalance_entry_daylight</item>
<item>@string/pref_camera_whitebalance_entry_cloudy</item>
</string-array>
<string-array name="pref_camera2_whitebalance_labels" translatable="false">
+ <item>@string/pref_camera_whitebalance_label_auto</item>
<item>@string/pref_camera_whitebalance_label_incandescent</item>
<item>@string/pref_camera_whitebalance_label_fluorescent</item>
- <item>@string/pref_camera_whitebalance_label_auto</item>
<item>@string/pref_camera_whitebalance_label_daylight</item>
<item>@string/pref_camera_whitebalance_label_cloudy</item>
</string-array>
<array name="pref_camera2_whitebalance_icons" translatable="false">
+ <item>@drawable/ic_wb_auto</item>
<item>@drawable/ic_wb_incandescent</item>
<item>@drawable/ic_wb_fluorescent</item>
- <item>@drawable/ic_wb_auto</item>
<item>@drawable/ic_wb_sunlight</item>
<item>@drawable/ic_wb_cloudy</item>
</array>
@@ -287,9 +274,9 @@
</string-array>
<string-array name="pref_camera2_flashmode_entryvalues" translatable="false">
- <item>off</item>
- <item>auto</item>
- <item>on</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
</string-array>
<array name="pref_camera2_flashmode_icons" translatable="false">
diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml
index 6acae82..e6656e9 100644
--- a/res/values/qcomstrings.xml
+++ b/res/values/qcomstrings.xml
@@ -539,11 +539,8 @@
<string name="pref_camera2_camera2_value_enable" translatable="false">enable</string>
<string name="pref_camera2_camera2_value_disable" translatable="false">disable</string>
- <string name="pref_camera2_dual_camera_title" translatable="true">Dual Camera Mode</string>
- <string name="pref_camera2_dual_camera_entry_dual" translatable="true">Dual-camera Linked</string>
- <string name="pref_camera2_dual_camera_entry_bayer" translatable="true">Single Bayer Camera</string>
- <string name="pref_camera2_dual_camera_entry_mono" translatable="true">Single Mono Camera</string>
- <string name="pref_camera2_dual_camera_default" translatable="false">1</string>
+ <string name="pref_camera2_mono_only_title" translatable="true">Mono Only</string>
+ <string name="pref_camera2_mono_only_default" translatable="false">off</string>
<string name="pref_camera2_mono_preview_title" translatable="true">Mono Preview</string>
<string name="pref_camera2_mono_preview_entry_on" translatable="true">On</string>
@@ -553,7 +550,7 @@
<string name="pref_camera2_mono_preview_value_off" translatable="false">off</string>
<string name="pref_camera2_clearsight_title" translatable="true">ClearSight</string>
- <string name="pref_camera2_clearsight_default" translatable="false">off</string>
+ <string name="pref_camera2_clearsight_default" translatable="false">on</string>
<string name="pref_camera2_clearsight_entry_on" translatable="false">On</string>
<string name="pref_camera2_clearsight_entry_off" translatable="false">Off</string>
@@ -564,5 +561,8 @@
<string name="clearsight_capture_fail">ClearSight capture failed</string>
<string name="pref_camera2_scenemode_default" translatable="false">0</string>
+ <string name="pref_camera2_whitebalance_default" translatable="false">1</string>
+ <string name="pref_camera2_coloreffect_default" translatable="false">0</string>
+ <string name="pref_camera2_flashmode_default" translatable="false">2</string>
</resources>
diff --git a/res/xml/capture_preferences.xml b/res/xml/capture_preferences.xml
index 3bab09e..3dad3a7 100644
--- a/res/xml/capture_preferences.xml
+++ b/res/xml/capture_preferences.xml
@@ -31,7 +31,7 @@
xmlns:camera="http://schemas.android.com/apk/res/org.codeaurora.snapcam"
camera:title="@string/pref_camera_settings_category">
<IconListPreference
- camera:defaultValue="@string/pref_camera_flashmode_default"
+ camera:defaultValue="@string/pref_camera2_flashmode_default"
camera:entries="@array/pref_camera2_flashmode_entries"
camera:entryValues="@array/pref_camera2_flashmode_entryvalues"
camera:icons="@array/pref_camera2_flashmode_icons"
@@ -42,7 +42,7 @@
camera:title="@string/pref_camera_flashmode_title"/>
<IconListPreference
- camera:defaultValue="@string/pref_camera_whitebalance_default"
+ camera:defaultValue="@string/pref_camera2_whitebalance_default"
camera:entries="@array/pref_camera2_whitebalance_entries"
camera:entryValues="@array/pref_camera2_whitebalance_entryvalues"
camera:icons="@array/pref_camera2_whitebalance_icons"
@@ -87,12 +87,11 @@
camera:title="@string/pref_camera2_camera2_title"/>
<ListPreference
- camera:defaultValue="@string/pref_camera2_dual_camera_default"
- camera:dependencyList="@array/pref_camera2_dual_camera_dependencylist"
- camera:entries="@array/pref_camera2_dual_camera_entries"
- camera:entryValues="@array/pref_camera2_dual_camera_entryvalues"
- camera:key="pref_camera2_dual_camera_key"
- camera:title="@string/pref_camera2_dual_camera_title"/>
+ camera:defaultValue="@string/pref_camera2_mono_only_default"
+ camera:entries="@array/pref_camera2_mono_only_entries"
+ camera:entryValues="@array/pref_camera2_mono_only_entryvalues"
+ camera:key="pref_camera2_mono_only_key"
+ camera:title="@string/pref_camera2_mono_only_title"/>
<ListPreference
camera:defaultValue="@string/pref_camera2_mono_preview_default"
@@ -109,7 +108,7 @@
camera:title="@string/pref_camera2_clearsight_title"/>
<IconListPreference
- camera:defaultValue="@string/pref_camera_coloreffect_default"
+ camera:defaultValue="@string/pref_camera2_coloreffect_default"
camera:entries="@array/pref_camera2_coloreffect_entries"
camera:entryValues="@array/pref_camera2_coloreffect_entryvalues"
camera:key="pref_camera2_coloreffect_key"
@@ -120,7 +119,6 @@
<IconListPreference
camera:defaultValue="@string/pref_camera2_scenemode_default"
- camera:dependencyList="@array/pref_camera2_scenemode_dependencylist"
camera:entries="@array/pref_camera2_scenemode_entries"
camera:entryValues="@array/pref_camera2_scenemode_entryvalues"
camera:key="pref_camera2_scenemode_key"
@@ -179,4 +177,10 @@
camera:key="pref_camera2_timer_key"
camera:singleIcon="@drawable/ic_settings_countdowntimer"
camera:title="@string/pref_camera_timer_title"/>
+
+ <ListPreference
+ camera:defaultValue="0"
+ camera:key="pref_camera2_initial_camera_key"
+ camera:entries="@array/pref_camera2_initial_camera_entries"
+ camera:entryValues="@array/pref_camera2_initial_camera_entryvalues"/>
</PreferenceGroup>
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 543e672..f5d99a6 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -256,6 +256,7 @@ public class CameraActivity extends Activity
public static int SETTING_LIST_WIDTH_2 = 250;
private ImageView mThumbnail;
+ private UpdateThumbnailTask mUpdateThumbnailTask;
private CircularDrawable mThumbnailDrawable;
// FilmStripView.setDataAdapter fires 2 onDataLoaded calls before any data is actually loaded
// Keep track of data request here to avoid creating useless UpdateThumbnailTask.
@@ -767,7 +768,9 @@ public class CameraActivity extends Activity
}
public void updateThumbnail(final byte[] jpegData) {
- (new UpdateThumbnailTask(jpegData, true)).execute();
+ if (mUpdateThumbnailTask != null) mUpdateThumbnailTask.cancel(true);
+ mUpdateThumbnailTask = new UpdateThumbnailTask(jpegData, true);
+ mUpdateThumbnailTask.execute();
}
public void updateThumbnail(final Bitmap bitmap) {
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 3d2b3b6..dfadeed 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -1263,14 +1263,8 @@ public class CameraSettings {
}
public static int getInitialCameraId(SharedPreferences pref) {
- int id = Integer.parseInt(pref.getString(KEY_CAMERA_ID, "0"));
- if (id == CaptureModule.BAYER_ID) {
- int mode = Integer.parseInt(pref.getString(SettingsManager.KEY_DUAL_CAMERA, "1"));
- if (mode == CaptureModule.MONO_MODE) return CaptureModule.MONO_ID;
- else return CaptureModule.BAYER_ID;
- } else {
- return CaptureModule.FRONT_ID;
- }
+ String value = pref.getString(SettingsManager.KEY_INITIAL_CAMERA, "0");
+ return Integer.parseInt(value);
}
public static void writePreferredCameraId(SharedPreferences pref,
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 7c6e5e7..962ee48 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -54,13 +54,13 @@ import android.util.SparseIntArray;
import android.view.KeyEvent;
import android.view.OrientationEventListener;
import android.view.Surface;
-import android.view.SurfaceHolder;
import android.view.View;
import android.widget.Toast;
import com.android.camera.PhotoModule.NamedImages;
import com.android.camera.PhotoModule.NamedImages.NamedEntity;
import com.android.camera.ui.CountDownView;
+import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.util.CameraUtil;
import com.android.camera.util.PersistUtil;
@@ -71,8 +71,6 @@ import org.codeaurora.snapcam.filter.ClearSightImageProcessor;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
@@ -85,10 +83,9 @@ public class CaptureModule implements CameraModule, PhotoController,
public static final int DUAL_MODE = 0;
public static final int BAYER_MODE = 1;
public static final int MONO_MODE = 2;
- //Todo: Read ids from the device dynamically
public static final int BAYER_ID = 0;
- public static final int MONO_ID = 1;
- public static final int FRONT_ID = 1;
+ public static int MONO_ID = 1;
+ public static int FRONT_ID = 1;
private static final int BACK_MODE = 0;
private static final int FRONT_MODE = 1;
private static final int CANCEL_TOUCH_FOCUS_DELAY = 3000;
@@ -149,7 +146,9 @@ public class CaptureModule implements CameraModule, PhotoController,
CaptureRequest.Key<Integer> BayerMonoLinkSessionIdKey =
new CaptureRequest.Key<>("org.codeaurora.qcamera3.dualcam_link_meta_data" +
".related_camera_id", Integer.class);
-
+ public static CameraCharacteristics.Key<Byte> MetaDataMonoOnlyKey =
+ new CameraCharacteristics.Key<>("org.codeaurora.qcamera3.sensor_meta_data.is_mono_only",
+ Byte.class);
private boolean[] mTakingPicture = new boolean[MAX_NUM_CAM];
private int mControlAFMode = CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
private int mLastResultAFState = -1;
@@ -174,8 +173,6 @@ public class CaptureModule implements CameraModule, PhotoController,
private FocusStateListener mFocusStateListener;
private LocationManager mLocationManager;
private SettingsManager mSettingsManager;
- private int mLongShotCaptureCount;
- private int mLongShotCaptureCountLimit;
private long SECONDARY_SERVER_MEM;
private boolean mLongshotActive = false;
@@ -203,6 +200,9 @@ public class CaptureModule implements CameraModule, PhotoController,
private ImageReader[] mImageReader = new ImageReader[MAX_NUM_CAM];
private NamedImages mNamedImages;
private ContentResolver mContentResolver;
+ private byte[] mLastJpegData;
+ private int mJpegFileSizeEstimation;
+ private boolean mFirstPreviewLoaded;
private class MediaSaveNotifyThread extends Thread {
private Uri uri;
@@ -227,6 +227,7 @@ public class CaptureModule implements CameraModule, PhotoController,
if (uri != null)
mActivity.notifyNewMedia(uri);
mActivity.updateStorageSpaceAndHint();
+ if (mLastJpegData != null) mActivity.updateThumbnail(mLastJpegData);
}
});
mediaSaveNotifyThread = null;
@@ -248,6 +249,7 @@ public class CaptureModule implements CameraModule, PhotoController,
if (uri != null) {
mActivity.notifyNewMedia(uri);
}
+ if (mLastJpegData != null) mActivity.updateThumbnail(mLastJpegData);
}
}
};
@@ -291,7 +293,15 @@ public class CaptureModule implements CameraModule, PhotoController,
private void process(CaptureResult result) {
int id = (int) result.getRequest().getTag();
-
+ if (!mFirstPreviewLoaded) {
+ mActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mUI.hidePreviewCover();
+ }
+ });
+ mFirstPreviewLoaded = true;
+ }
switch (mState[id]) {
case STATE_PREVIEW: {
break;
@@ -403,7 +413,7 @@ public class CaptureModule implements CameraModule, PhotoController,
@Override
public void onError(CameraDevice cameraDevice, int error) {
int id = Integer.parseInt(cameraDevice.getId());
- Log.d(TAG, "onError " + id + error);
+ Log.e(TAG, "onError " + id + " " + error);
cameraDevice.close();
mCameraDevice[id] = null;
mCameraOpenCloseLock.release();
@@ -422,6 +432,13 @@ public class CaptureModule implements CameraModule, PhotoController,
};
+ private boolean isMonoPreviewOn() {
+ String value = mSettingsManager.getValue(SettingsManager.KEY_MONO_PREVIEW);
+ if (value == null) return false;
+ if (value.equals("on")) return true;
+ else return false;
+ }
+
private boolean isBackMode() {
String value = mSettingsManager.getValue(SettingsManager.KEY_CAMERA_ID);
if (value == null) return true;
@@ -430,8 +447,11 @@ public class CaptureModule implements CameraModule, PhotoController,
}
private int getMode() {
- String value = mSettingsManager.getValue(SettingsManager.KEY_DUAL_CAMERA);
- return Integer.parseInt(value);
+ String value = mSettingsManager.getValue(SettingsManager.KEY_SCENE_MODE);
+ if (value != null && value.equals("-5")) return DUAL_MODE;
+ value = mSettingsManager.getValue(SettingsManager.KEY_MONO_ONLY);
+ if (value == null || !value.equals("on")) return BAYER_MODE;
+ return MONO_MODE;
}
private boolean isClearSightOn() {
@@ -504,30 +524,8 @@ public class CaptureModule implements CameraModule, PhotoController,
if (mPaused || !mCameraOpened[id] || !mSurfaceReady) return;
Log.d(TAG, "createSession " + id);
List<Surface> list = new LinkedList<Surface>();
- mUI.hidePreviewCover();
try {
- Surface surface;
- if (isBackMode()) {
- if (id == BAYER_ID || (id == MONO_ID && getMode() == MONO_MODE)) {
- SurfaceHolder sh = mUI.getSurfaceHolder();
- if (sh == null) {
- return;
- }
- surface = sh.getSurface();
- } else {
- SurfaceHolder sh = mUI.getSurfaceHolder2();
- if (sh == null) {
- return;
- }
- surface = sh.getSurface();
- }
- } else {
- SurfaceHolder sh = mUI.getSurfaceHolder();
- if (sh == null) {
- return;
- }
- surface = sh.getSurface();
- }
+ Surface surface = getPreviewSurface(id);
// We set up a CaptureRequest.Builder with the output Surface.
mPreviewRequestBuilder[id] = mCameraDevice[id].createCaptureRequest(CameraDevice
.TEMPLATE_PREVIEW);
@@ -601,11 +599,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
public void reinit() {
- String pictureSize = mSettingsManager.getValue(SettingsManager
- .KEY_PICTURE_SIZE);
-
- Size size = parsePictureSize(pictureSize);
- mUI.setPreviewSize(size.getHeight(), size.getWidth());
+ setCurrentMode();
mSettingsManager.reinit(getMainCameraId());
}
@@ -621,6 +615,7 @@ public class CaptureModule implements CameraModule, PhotoController,
mSettingsManager = SettingsManager.getInstance();
mSettingsManager.registerListener(this);
mSettingsManager.init();
+ mFirstPreviewLoaded = false;
Log.d(TAG, "init");
for (int i = 0; i < MAX_NUM_CAM; i++) {
mCameraOpened[i] = false;
@@ -631,13 +626,11 @@ public class CaptureModule implements CameraModule, PhotoController,
for (int i = 0; i < MAX_NUM_CAM; i++) {
mState[i] = STATE_PREVIEW;
}
-
+ setCurrentMode();
mContentResolver = mActivity.getContentResolver();
mUI = new CaptureUI(activity, this, parent);
mUI.initializeControlByIntent();
- String pictureSize = mSettingsManager.getValue(SettingsManager.KEY_PICTURE_SIZE);
- Size size = parsePictureSize(pictureSize);
- mUI.setPreviewSize(size.getHeight(), size.getWidth());
+
mFocusStateListener = new FocusStateListener(mUI);
mLocationManager = new LocationManager(mActivity, mUI);
Storage.setSaveSDCard(mSettingsManager.getValue(SettingsManager
@@ -775,77 +768,77 @@ public class CaptureModule implements CameraModule, PhotoController,
mCaptureSession[id].stopRepeating();
if (mLongshotActive) {
- mCaptureSession[id].setRepeatingRequest(captureBuilder.build(), new
- CameraCaptureSession.CaptureCallback() {
+ Log.d(TAG, "captureStillPicture capture longshot " + id);
+ List<CaptureRequest> burstList = new ArrayList<>();
+ for (int i = 0; i < PersistUtil.getLongshotShotLimit(); i++) {
+ burstList.add(captureBuilder.build());
+ }
+ mCaptureSession[id].captureBurst(burstList, new
+ CameraCaptureSession.CaptureCallback() {
- @Override
- public void onCaptureCompleted(CameraCaptureSession session,
- CaptureRequest request,
- TotalCaptureResult result) {
- Log.d(TAG, "captureStillPicture Longshot onCaptureCompleted: " + id);
- mActivity.updateStorageSpaceAndHint();
- if (checkLongShotMemoAndLimit()) {
- cancelAutoFocus();
- return;
- }
- mActivity.runOnUiThread(new Runnable() {
@Override
- public void run() {
- mUI.doShutterAnimation();
+ public void onCaptureCompleted(CameraCaptureSession session,
+ CaptureRequest request,
+ TotalCaptureResult result) {
+ Log.d(TAG, "captureStillPicture Longshot onCaptureCompleted: " + id);
+ if (mLongshotActive) {
+ mActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mUI.doShutterAnimation();
+ }
+ });
+ }
}
- });
- mLongShotCaptureCount++;
- }
- @Override
- public void onCaptureFailed(CameraCaptureSession session,
- CaptureRequest request,
- CaptureFailure result) {
- Log.d(TAG, "captureStillPicture Longshot onCaptureFailed: " + id);
- if (checkLongShotMemoAndLimit()) {
- cancelAutoFocus();
- return;
- }
- mActivity.runOnUiThread(new Runnable() {
@Override
- public void run() {
- mUI.doShutterAnimation();
+ public void onCaptureFailed(CameraCaptureSession session,
+ CaptureRequest request,
+ CaptureFailure result) {
+ Log.d(TAG, "captureStillPicture Longshot onCaptureFailed: " + id);
+ if (mLongshotActive) {
+ mActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mUI.doShutterAnimation();
+ }
+ });
+ }
}
- });
- }
- @Override
- public void onCaptureSequenceCompleted(CameraCaptureSession session, int
- sequenceId, long frameNumber) {
- Log.d(TAG, "captureStillPicture Longshot onCaptureSequenceCompleted: " +
- id);
- unlockFocus(id);
- }
- }, mCaptureCallbackHandler);
+ @Override
+ public void onCaptureSequenceCompleted(CameraCaptureSession session, int
+ sequenceId, long frameNumber) {
+ Log.d(TAG, "captureStillPicture Longshot onCaptureSequenceCompleted: " + id);
+ mLongshotActive = false;
+ unlockFocus(id);
+ }
+ }, mCaptureCallbackHandler);
} else {
- mCaptureSession[id].capture(captureBuilder.build(), new CameraCaptureSession.CaptureCallback() {
+ mCaptureSession[id].capture(captureBuilder.build(),
+ new CameraCaptureSession.CaptureCallback() {
- @Override
- public void onCaptureCompleted(CameraCaptureSession session,
- CaptureRequest request,
- TotalCaptureResult result) {
- Log.d(TAG, "captureStillPicture onCaptureCompleted: " + id);
- }
+ @Override
+ public void onCaptureCompleted(CameraCaptureSession session,
+ CaptureRequest request,
+ TotalCaptureResult result) {
+ Log.d(TAG, "captureStillPicture onCaptureCompleted: " + id);
+ }
- @Override
- public void onCaptureFailed(CameraCaptureSession session,
- CaptureRequest request,
- CaptureFailure result) {
- Log.d(TAG, "captureStillPicture onCaptureFailed: " + id);
- }
+ @Override
+ public void onCaptureFailed(CameraCaptureSession session,
+ CaptureRequest request,
+ CaptureFailure result) {
+ Log.d(TAG, "captureStillPicture onCaptureFailed: " + id);
+ }
- @Override
- public void onCaptureSequenceCompleted(CameraCaptureSession session, int
- sequenceId, long frameNumber) {
- Log.d(TAG, "captureStillPicture onCaptureSequenceCompleted: " + id);
- unlockFocus(id);
- }
- }, mCaptureCallbackHandler);
+ @Override
+ public void onCaptureSequenceCompleted(CameraCaptureSession session, int
+ sequenceId, long frameNumber) {
+ Log.d(TAG, "captureStillPicture onCaptureSequenceCompleted: " + id);
+ unlockFocus(id);
+ }
+ }, mCaptureCallbackHandler);
}
}
} catch (CameraAccessException e) {
@@ -882,13 +875,15 @@ public class CaptureModule implements CameraModule, PhotoController,
* @param height The height of available size for camera preview
*/
private void setUpCameraOutputs() {
+ Log.d(TAG, "setUpCameraOutputs");
CameraManager manager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE);
try {
String[] cameraIdList = manager.getCameraIdList();
for (int i = 0; i < cameraIdList.length; i++) {
String cameraId = cameraIdList[i];
CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
- mCameraIdList.add(i);
+ if (isInMode(i))
+ mCameraIdList.add(i);
StreamConfigurationMap map = characteristics.get(
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (map == null) {
@@ -896,25 +891,16 @@ public class CaptureModule implements CameraModule, PhotoController,
}
mCameraId[i] = cameraId;
- if(isClearSightOn()) {
- Size largest = Collections.max(
- Arrays.asList(map.getOutputSizes(ImageFormat.YUV_420_888)),
- new CompareSizesByArea());
- ClearSightImageProcessor.getInstance().init(
- largest.getWidth(), largest.getHeight(), mActivity, mOnMediaSavedListener);
+ String pictureSize = mSettingsManager.getValue(SettingsManager
+ .KEY_PICTURE_SIZE);
+
+ Size size = parsePictureSize(pictureSize);
+ if (isClearSightOn()) {
+ ClearSightImageProcessor.getInstance().init(size.getWidth(), size.getHeight(),
+ mActivity, mOnMediaSavedListener);
ClearSightImageProcessor.getInstance().setCallback(this);
} else {
// No Clearsight
- // For still image captures, we use the largest available size.
- Size largest = Collections.max(
- Arrays.asList(map.getOutputSizes(ImageFormat.JPEG)),
- new CompareSizesByArea());
-
- String pictureSize = mSettingsManager.getValue(SettingsManager
- .KEY_PICTURE_SIZE);
-
- Size size = parsePictureSize(pictureSize);
-
mImageReader[i] = ImageReader.newInstance(size.getWidth(), size.getHeight(),
ImageFormat.JPEG, 3);
mImageReader[i].setOnImageAvailableListener(new ImageAvailableListener(i) {
@@ -930,6 +916,7 @@ public class CaptureModule implements CameraModule, PhotoController,
ByteBuffer buffer = image.getPlanes()[0].getBuffer();
byte[] bytes = new byte[buffer.remaining()];
+ mLastJpegData = bytes;
buffer.get(bytes);
mActivity.getMediaSaveService().addImage(bytes, title, date,
@@ -939,6 +926,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}, mImageAvailableHandler);
}
+
}
mAutoFocusSupported = mSettingsManager.isAutoFocusSupported(mCameraIdList);
} catch (CameraAccessException e) {
@@ -997,7 +985,6 @@ public class CaptureModule implements CameraModule, PhotoController,
e.printStackTrace();
}
}
-
mCaptureSession[i].close();
mCaptureSession[i] = null;
}
@@ -1035,7 +1022,6 @@ public class CaptureModule implements CameraModule, PhotoController,
private void applySettingsForCapture(CaptureRequest.Builder builder, int id) {
builder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE);
- applyFlash(builder, id);
applyJpegQuality(builder);
applyCommonSettings(builder, id);
}
@@ -1043,7 +1029,6 @@ public class CaptureModule implements CameraModule, PhotoController,
private void applySettingsForPrecapture(CaptureRequest.Builder builder, int id) {
builder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,
CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
- applyFlash(builder, id);
applyCommonSettings(builder, id);
}
@@ -1063,6 +1048,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private void applyCommonSettings(CaptureRequest.Builder builder, int id) {
builder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_AUTO);
builder.set(CaptureRequest.CONTROL_AF_MODE, mControlAFMode);
+ applyFlash(builder, id);
applyWhiteBalance(builder);
applyExposure(builder);
applyIso(builder);
@@ -1152,12 +1138,14 @@ public class CaptureModule implements CameraModule, PhotoController,
@Override
public void onPauseAfterSuper() {
Log.d(TAG, "onPause");
- mUI.showPreviewCover();
if (mLocationManager != null) mLocationManager.recordLocation(false);
if(isClearSightOn()) {
ClearSightImageProcessor.getInstance().close();
}
closeCamera();
+ mUI.showPreviewCover();
+ mUI.hideSurfaceView();
+ mFirstPreviewLoaded = false;
stopBackgroundThread();
mUI.onPause();
}
@@ -1167,9 +1155,17 @@ public class CaptureModule implements CameraModule, PhotoController,
mPaused = false;
}
+ private void setCurrentMode() {
+ mCurrentMode = isBackMode() ? getMode() : FRONT_MODE;
+ }
+
@Override
public void onResumeAfterSuper() {
Log.d(TAG, "onResume " + getMode());
+ mUI.showSurfaceView();
+ String pictureSize = mSettingsManager.getValue(SettingsManager.KEY_PICTURE_SIZE);
+ Size size = parsePictureSize(pictureSize);
+ mUI.setPreviewSize(size.getWidth(), size.getHeight());
mUI.setSwitcherIndex();
mCameraIdList = new ArrayList<>();
setUpCameraOutputs();
@@ -1198,8 +1194,8 @@ public class CaptureModule implements CameraModule, PhotoController,
} else {
initializeSecondTime();
}
- mUI.hidePreviewCover();
mActivity.updateStorageSpaceAndHint();
+ estimateJpegFileSize();
mUI.enableShutter(true);
}
@@ -1265,6 +1261,22 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}
+ private boolean isInMode(int cameraId) {
+ if (isBackMode()) {
+ switch (getMode()) {
+ case DUAL_MODE:
+ return cameraId == BAYER_ID || cameraId == MONO_ID;
+ case BAYER_MODE:
+ return cameraId == BAYER_ID;
+ case MONO_MODE:
+ return cameraId == MONO_ID;
+ }
+ } else {
+ return cameraId == FRONT_ID;
+ }
+ return false;
+ }
+
@Override
public boolean isImageCaptureIntent() {
return false;
@@ -1347,7 +1359,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}
- private boolean isTouchToFocusAllowed() {
+ public boolean isTouchToFocusAllowed() {
for (int i = 0; i < mTakingPicture.length; i++) {
if (mTakingPicture[i]) return false;
}
@@ -1479,7 +1491,7 @@ public class CaptureModule implements CameraModule, PhotoController,
@Override
public void onShutterButtonFocus(boolean pressed) {
if (!pressed && mLongshotActive) {
- cancelLongshot();
+ Log.d(TAG, "Longshot button up");
}
}
@@ -1503,11 +1515,6 @@ public class CaptureModule implements CameraModule, PhotoController,
@Override
public void onShutterButtonLongClick() {
if (isBackMode() && getMode() == DUAL_MODE) return;
- if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
- Log.i(TAG, "Not enough space or storage not ready. remaining="
- + mActivity.getStorageSpaceBytes());
- return;
- }
String longshot = mSettingsManager.getValue(SettingsManager.KEY_LONGSHOT);
if (longshot.equals("on")) {
@@ -1518,36 +1525,50 @@ public class CaptureModule implements CameraModule, PhotoController,
//check whether current memory is enough for longshot.
mActivity.updateStorageSpaceAndHint();
+ long storageSpace = mActivity.getStorageSpaceBytes();
+ int mLongShotCaptureCountLimit = PersistUtil.getLongshotShotLimit();
+
+ if (storageSpace <= Storage.LOW_STORAGE_THRESHOLD_BYTES + mLongShotCaptureCountLimit
+ * mJpegFileSizeEstimation) {
+ Log.i(TAG, "Not enough space or storage not ready. remaining=" + storageSpace);
+ return;
+ }
+
if (isLongshotNeedCancel()) {
mLongshotActive = false;
return;
}
- mLongShotCaptureCountLimit = PersistUtil.getLongshotShotLimit();
- mLongShotCaptureCount = 1;
+
+ Log.d(TAG, "Start Longshot");
mLongshotActive = true;
takePicture();
}
}
- private void cancelLongshot() {
- Log.d(TAG, "cancelLongshot");
- mLongshotActive = false;
- try {
- if (isBackMode()) {
- switch (getMode()) {
- case BAYER_MODE:
- mCaptureSession[BAYER_ID].stopRepeating();
- break;
- case MONO_MODE:
- mCaptureSession[MONO_MODE].stopRepeating();
- break;
- }
- } else {
- mCaptureSession[FRONT_ID].stopRepeating();
+ private void estimateJpegFileSize() {
+ String quality = mSettingsManager.getValue(SettingsManager
+ .KEY_JPEG_QUALITY);
+ int[] ratios = mActivity.getResources().getIntArray(R.array.jpegquality_compression_ratio);
+ String[] qualities = mActivity.getResources().getStringArray(
+ R.array.pref_camera_jpegquality_entryvalues);
+ int ratio = 0;
+ for (int i = ratios.length - 1; i >= 0; --i) {
+ if (qualities[i].equals(quality)) {
+ ratio = ratios[i];
+ break;
}
- } catch (CameraAccessException e) {
- e.printStackTrace();
}
+ String pictureSize = mSettingsManager.getValue(SettingsManager
+ .KEY_PICTURE_SIZE);
+
+ Size size = parsePictureSize(pictureSize);
+ if (ratio == 0) {
+ Log.d(TAG, "mJpegFileSizeEstimation 0");
+ } else {
+ mJpegFileSizeEstimation = size.getWidth() * size.getHeight() * 3 / ratio;
+ Log.d(TAG, "mJpegFileSizeEstimation " + mJpegFileSizeEstimation);
+ }
+
}
private boolean isLongshotNeedCancel() {
@@ -1588,29 +1609,14 @@ public class CaptureModule implements CameraModule, PhotoController,
return false;
}
- private boolean checkLongShotMemoAndLimit() {
- if (isLongshotNeedCancel()) {
- return true;
- }
-
- if (mLongShotCaptureCount == mLongShotCaptureCountLimit) {
- return true;
- }
- return false;
- }
-
private boolean isFlashOff(int id) {
if (!mSettingsManager.isFlashSupported(id)) return true;
- return mSettingsManager.getValue(SettingsManager.KEY_FLASH_MODE).equals("off");
+ return mSettingsManager.getValue(SettingsManager.KEY_FLASH_MODE).equals("1");
}
private void initializePreviewConfiguration(int id) {
mPreviewRequestBuilder[id].set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest
.CONTROL_AF_TRIGGER_IDLE);
- mPreviewRequestBuilder[id].set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest
- .CONTROL_AE_MODE_ON);
- mPreviewRequestBuilder[id].set(CaptureRequest.FLASH_MODE, CaptureRequest
- .FLASH_MODE_OFF);
applyCommonSettings(mPreviewRequestBuilder[id], id);
}
@@ -1651,6 +1657,10 @@ public class CaptureModule implements CameraModule, PhotoController,
updatePreview = true;
applyExposure(mPreviewRequestBuilder[cameraId]);
break;
+ case SettingsManager.KEY_FLASH_MODE:
+ updatePreview = true;
+ applyFlash(mPreviewRequestBuilder[cameraId], cameraId);
+ break;
}
return updatePreview;
}
@@ -1681,7 +1691,7 @@ public class CaptureModule implements CameraModule, PhotoController,
String value = mSettingsManager.getValue(SettingsManager.KEY_SCENE_MODE);
if (value == null) return;
int mode = Integer.parseInt(value);
- if (mode != CaptureRequest.CONTROL_SCENE_MODE_DISABLED) {
+ if (mode != CaptureRequest.CONTROL_SCENE_MODE_DISABLED && mode != -5) {
request.set(CaptureRequest.CONTROL_SCENE_MODE, mode);
request.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_USE_SCENE_MODE);
} else {
@@ -1773,12 +1783,7 @@ public class CaptureModule implements CameraModule, PhotoController,
public void triggerFocusAtPoint(float x, float y, int id) {
Log.d(TAG, "triggerFocusAtPoint " + x + " " + y + " " + id);
- Point p;
- if (id == getMainCameraId()) {
- p = mUI.getSurfaceViewSize();
- } else {
- p = mUI.getSurfaceView2Size();
- }
+ Point p = mUI.getSurfaceViewSize();
int width = p.x;
int height = p.y;
x = x / width;
@@ -1829,8 +1834,8 @@ public class CaptureModule implements CameraModule, PhotoController,
boolean updatePreviewBayer = false;
boolean updatePreviewMono = false;
boolean updatePreviewFront = false;
+ int count = 0;
for (SettingsManager.SettingState settingState : settings) {
-
String key = settingState.key;
SettingsManager.Values values = settingState.values;
String value;
@@ -1839,14 +1844,31 @@ public class CaptureModule implements CameraModule, PhotoController,
} else {
value = values.value;
}
- if (SettingsManager.KEY_CAMERA_SAVEPATH.equals(key)) {
- Storage.setSaveSDCard(value.equals("1"));
- mActivity.updateStorageSpaceAndHint();
- continue;
- }
- if (SettingsManager.KEY_JPEG_QUALITY.equals(key)) {
- mJpegQuality = getQualityNumber(value);
- continue;
+ switch (key) {
+ case SettingsManager.KEY_CAMERA_SAVEPATH:
+ Storage.setSaveSDCard(value.equals("1"));
+ mActivity.updateStorageSpaceAndHint();
+ continue;
+ case SettingsManager.KEY_JPEG_QUALITY:
+ mJpegQuality = getQualityNumber(value);
+ estimateJpegFileSize();
+ continue;
+ case SettingsManager.KEY_CAMERA2:
+ switchCameraMode(value);
+ return;
+ case SettingsManager.KEY_CAMERA_ID:
+ case SettingsManager.KEY_MONO_ONLY:
+ case SettingsManager.KEY_CLEARSIGHT:
+ case SettingsManager.KEY_PICTURE_SIZE:
+ case SettingsManager.KEY_MONO_PREVIEW:
+ if (count == 0) restart();
+ return;
+ case SettingsManager.KEY_SCENE_MODE:
+ if (count == 0 && checkNeedToRestart(value)) {
+ restart();
+ return;
+ }
+ break;
}
if (isBackMode()) {
@@ -1865,6 +1887,7 @@ public class CaptureModule implements CameraModule, PhotoController,
} else {
updatePreviewFront |= applyPreferenceToPreview(FRONT_ID, key, value);
}
+ count++;
}
if (updatePreviewBayer) {
try {
@@ -1892,6 +1915,29 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}
+ private int mCurrentMode;
+ private boolean checkNeedToRestart(String value) {
+ if (value.equals("-5") && mCurrentMode != DUAL_MODE) return true;
+ if (!value.equals("-5") && mCurrentMode == DUAL_MODE) return true;
+ return false;
+ }
+
+ private void restart() {
+ reinit();
+ onPauseBeforeSuper();
+ onPauseAfterSuper();
+ onResumeBeforeSuper();
+ onResumeAfterSuper();
+ }
+
+ private void switchCameraMode(String value) {
+ if (value.equals("enable")) {
+ mActivity.onModuleSelected(ModuleSwitcher.CAPTURE_MODULE_INDEX);
+ } else {
+ mActivity.onModuleSelected(ModuleSwitcher.PHOTO_MODULE_INDEX);
+ }
+ }
+
/**
* Compares two {@code Size}s based on their areas.
*/
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java
index 331d2df..bc0d310 100644
--- a/src/com/android/camera/CaptureUI.java
+++ b/src/com/android/camera/CaptureUI.java
@@ -93,9 +93,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
SettingsManager.KEY_ISO,
SettingsManager.KEY_EXPOSURE,
SettingsManager.KEY_WHITE_BALANCE,
- SettingsManager.KEY_CAMERA2,
- SettingsManager.KEY_DUAL_CAMERA,
- SettingsManager.KEY_CLEARSIGHT
+ SettingsManager.KEY_CAMERA2
};
String[] mDeveloperKeys = new String[]{
SettingsManager.KEY_FLASH_MODE,
@@ -109,7 +107,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
SettingsManager.KEY_EXPOSURE,
SettingsManager.KEY_WHITE_BALANCE,
SettingsManager.KEY_CAMERA2,
- SettingsManager.KEY_DUAL_CAMERA,
+ SettingsManager.KEY_MONO_ONLY,
SettingsManager.KEY_CLEARSIGHT,
SettingsManager.KEY_MONO_PREVIEW
};
@@ -121,8 +119,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
private AutoFitSurfaceView mSurfaceView2;
private SurfaceHolder mSurfaceHolder;
private SurfaceHolder mSurfaceHolder2;
- private boolean surface1created = false;
- private boolean surface2created = false;
private int mOrientation;
private RotateLayout mMenuLayout;
private RotateLayout mSubMenuLayout;
@@ -135,6 +131,9 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
private PreviewGestures mGestures;
private boolean mUIhidden = false;
private SettingsManager mSettingsManager;
+
+ private ImageView mThumbnail;
+
private SurfaceHolder.Callback callback = new SurfaceHolder.Callback() {
// SurfaceHolder callbacks
@@ -147,15 +146,14 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
public void surfaceCreated(SurfaceHolder holder) {
Log.v(TAG, "surfaceCreated");
mSurfaceHolder = holder;
- if (surface2created) mModule.onPreviewUIReady();
- surface1created = true;
+ mModule.onPreviewUIReady();
+ mActivity.updateThumbnail(mThumbnail);
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.v(TAG, "surfaceDestroyed");
mSurfaceHolder = null;
- surface1created = false;
mModule.onPreviewUIDestroyed();
}
};
@@ -189,14 +187,11 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
@Override
public void surfaceCreated(SurfaceHolder holder) {
mSurfaceHolder2 = holder;
- if (surface1created) mModule.onPreviewUIReady();
- surface2created = true;
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
mSurfaceHolder2 = null;
- surface2created = false;
}
};
@@ -490,14 +485,13 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
startTime = System.currentTimeMillis();
} else if (event.getAction() == MotionEvent.ACTION_UP) {
if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) {
- mSettingsManager.setValueIndex(SettingsManager.KEY_SCENE_MODE, j);
- updateSceneModeIcon();
for (View v1 : views) {
v1.setBackgroundResource(R.drawable.scene_mode_view_border);
}
View border = v.findViewById(R.id.border);
- border.setBackgroundResource(R.drawable
- .scene_mode_view_border_selected);
+ border.setBackgroundResource(R.drawable.scene_mode_view_border_selected);
+ updateSceneModeIcon(j);
+ mSettingsManager.setValueIndex(SettingsManager.KEY_SCENE_MODE, j);
removeSceneAndFilterMenu(true);
}
}
@@ -527,6 +521,15 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
((ImageView) mSceneModeSwitcher).setImageResource(thumbnail);
}
+ public void updateSceneModeIcon(int idx) {
+ int[] thumbnails = mSettingsManager.getResource(SettingsManager.KEY_SCENE_MODE,
+ SettingsManager.RESOURCE_TYPE_THUMBNAIL);
+ int thumbnail = thumbnails[idx];
+ if (thumbnail == -1)
+ thumbnail = 0;
+ ((ImageView) mSceneModeSwitcher).setImageResource(thumbnail);
+ }
+
public void addFilterMode() {
if (mSettingsManager.getValue(SettingsManager.KEY_COLOR_EFFECT) == null)
return;
@@ -981,6 +984,14 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
}
public void initializeControlByIntent() {
+ mThumbnail = (ImageView) mRootView.findViewById(R.id.preview_thumb);
+ mThumbnail.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (!CameraControls.isAnimating() && mModule.isTouchToFocusAllowed())
+ mActivity.gotoGallery();
+ }
+ });
mMenuButton = mRootView.findViewById(R.id.menu);
mMenuButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -1131,7 +1142,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
}
}
-
private void initializeCountDown() {
mActivity.getLayoutInflater().inflate(R.layout.count_down_to_capture,
(ViewGroup) mRootView, true);
@@ -1163,8 +1173,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
}
public boolean collapseCameraControls() {
- // TODO: Mode switcher should behave like a popup and should hide itself when there
- // is a touch outside of it.
mSwitcher.closePopup();
// Remove all the popups/dialog boxes
boolean ret = false;
@@ -1336,15 +1344,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
SettingsManager.Values values = setting.values;
String value = (values.overriddenValue == null) ? values.value : values.overriddenValue;
switch (key) {
- case SettingsManager.KEY_CAMERA2:
- switchCameraMode(value);
- return;
- case SettingsManager.KEY_CAMERA_ID:
- case SettingsManager.KEY_DUAL_CAMERA:
- case SettingsManager.KEY_CLEARSIGHT:
- case SettingsManager.KEY_PICTURE_SIZE:
- mActivity.onModuleSelected(ModuleSwitcher.CAPTURE_MODULE_INDEX);
- return;
case SettingsManager.KEY_COLOR_EFFECT:
changeFilterModeControlIcon(value);
updateFilterModeIcon(values.overriddenValue == null);
@@ -1353,18 +1352,30 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
}
}
- public void setPreviewSize(int width, int height) {
- mSurfaceView.setAspectRatio(width, height);
+ public void hideSurfaceView() {
+ mSurfaceView.setVisibility(View.INVISIBLE);
+ mSurfaceView2.setVisibility(View.INVISIBLE);
+ }
+
+ public void showSurfaceView() {
+ mSurfaceView.setVisibility(View.VISIBLE);
+ mSurfaceView2.setVisibility(View.VISIBLE);
}
- private void switchCameraMode(String value) {
- if (value.equals("enable")) {
- mActivity.onModuleSelected(ModuleSwitcher.CAPTURE_MODULE_INDEX);
+ public void setSurfaceView(boolean show) {
+ if (show) {
+ mSurfaceView2.setVisibility(View.VISIBLE);
} else {
- mActivity.onModuleSelected(ModuleSwitcher.PHOTO_MODULE_INDEX);
+ mSurfaceView2.setVisibility(View.INVISIBLE);
}
}
+ public void setPreviewSize(int width, int height) {
+ mSurfaceView.getHolder().setFixedSize(width, height);
+ mCameraControls.setPreviewRatio(0, true);
+ mSurfaceView.setAspectRatio(height, width);
+ }
+
@Override
public void onSettingChanged(ListPreference pref) {
removeAllSettingMenu();
diff --git a/src/com/android/camera/ComboPreferences.java b/src/com/android/camera/ComboPreferences.java
index 9e039bf..c37e9f5 100644
--- a/src/com/android/camera/ComboPreferences.java
+++ b/src/com/android/camera/ComboPreferences.java
@@ -157,7 +157,9 @@ public class ComboPreferences implements
|| key.equals(CameraSettings.KEY_POWER_SHUTTER)
|| key.equals(CameraSettings.KEY_MAX_BRIGHTNESS
|| key.equals(SettingsManager.KEY_CAMERA2)
- || key.equals(SettingsManager.KEY_DUAL_CAMERA)
+ || key.equals(SettingsManager.KEY_INITIAL_CAMERA)
+ || key.equals(SettingsManager.KEY_CAMERA_ID)
+ || key.equals(SettingsManager.KEY_MONO_ONLY)
|| key.equals(SettingsManager.KEY_MONO_PREVIEW)
|| key.equals(SettingsManager.KEY_CLEARSIGHT);
}
diff --git a/src/com/android/camera/ListPreference.java b/src/com/android/camera/ListPreference.java
index 9b8fd68..a888d65 100644
--- a/src/com/android/camera/ListPreference.java
+++ b/src/com/android/camera/ListPreference.java
@@ -38,7 +38,7 @@ public class ListPreference extends CameraPreference {
private static final String TAG = "ListPreference";
private final String mKey;
private String mValue;
- private final CharSequence[] mDefaultValues;
+ public final CharSequence[] mDefaultValues;
private CharSequence[] mEntries;
private CharSequence[] mEntryValues;
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index a79b642..86ecd62 100644
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -47,7 +47,9 @@ import org.codeaurora.snapcam.R;
import java.text.DecimalFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -62,7 +64,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
public static final String KEY_FLASH_MODE = "pref_camera2_flashmode_key";
public static final String KEY_WHITE_BALANCE = "pref_camera2_whitebalance_key";
public static final String KEY_CAMERA2 = "pref_camera2_camera2_key";
- public static final String KEY_DUAL_CAMERA = "pref_camera2_dual_camera_key";
+ public static final String KEY_MONO_ONLY = "pref_camera2_mono_only_key";
public static final String KEY_MONO_PREVIEW = "pref_camera2_mono_preview_key";
public static final String KEY_CLEARSIGHT = "pref_camera2_clearsight_key";
public static final String KEY_FILTER_MODE = "pref_camera2_filter_mode_key";
@@ -75,6 +77,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
public static final String KEY_EXPOSURE = "pref_camera2_exposure_key";
public static final String KEY_TIMER = "pref_camera2_timer_key";
public static final String KEY_LONGSHOT = "pref_camera2_longshot_key";
+ public static final String KEY_INITIAL_CAMERA = "pref_camera2_initial_camera_key";
private static final String TAG = "SnapCam_SettingsManager";
private static final List<CameraCharacteristics> mCharacteristics = new ArrayList<>();
private static final int NOT_FOUND = -1;
@@ -86,12 +89,12 @@ public class SettingsManager implements ListMenu.SettingsListener {
private Context mContext;
private PreferenceGroup mPreferenceGroup;
private ComboPreferences mPreferences;
- private Map<String, List<String>> mDependendsOnMap;
+ private Map<String, Set<String>> mDependendsOnMap;
+ private boolean mIsMonoCameraPresent = false;
+ private boolean mIsFrontCameraPresent = false;
private SettingsManager(Context context) {
mListeners = new ArrayList<>();
- mValuesMap = new HashMap<>();
- mDependendsOnMap = new HashMap<>();
mContext = context;
mPreferences = new ComboPreferences(mContext);
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), mContext);
@@ -100,10 +103,19 @@ public class SettingsManager implements ListMenu.SettingsListener {
try {
String[] cameraIdList = manager.getCameraIdList();
for (int i = 0; i < cameraIdList.length; i++) {
- //TODO: determine front/back/bayer/mono and their ids
String cameraId = cameraIdList[i];
CameraCharacteristics characteristics
= manager.getCameraCharacteristics(cameraId);
+ Byte monoOnly = characteristics.get(CaptureModule.MetaDataMonoOnlyKey);
+ if (monoOnly == 1) {
+ CaptureModule.MONO_ID = i;
+ mIsMonoCameraPresent = true;
+ }
+ int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
+ if (facing == CameraCharacteristics.LENS_FACING_FRONT) {
+ CaptureModule.FRONT_ID = i;
+ mIsFrontCameraPresent = true;
+ }
mCharacteristics.add(i, characteristics);
}
} catch (CameraAccessException e) {
@@ -138,6 +150,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
public void onSettingChanged(ListPreference pref) {
String key = pref.getKey();
List changed = checkDependencyAndUpdate(key);
+ if (changed == null) return;
notifyListeners(changed);
}
@@ -159,7 +172,8 @@ public class SettingsManager implements ListMenu.SettingsListener {
PreferenceInflater inflater = new PreferenceInflater(mContext);
mPreferenceGroup =
(PreferenceGroup) inflater.inflate(R.xml.capture_preferences);
-
+ mValuesMap = new HashMap<>();
+ mDependendsOnMap = new HashMap<>();
filterPreferences(cameraId);
initDepedencyTable();
initializeValueMap();
@@ -169,18 +183,30 @@ public class SettingsManager implements ListMenu.SettingsListener {
for (int i = 0; i < mPreferenceGroup.size(); i++) {
ListPreference pref = (ListPreference) mPreferenceGroup.get(i);
String baseKey = pref.getKey();
- CharSequence[] dependencyList = pref.getDependencyList();
+ CharSequence[] dependencyList = null;
+ if (!specialDepedency(baseKey)) dependencyList = pref.getDependencyList();
+ else {
+ List<KeyValue> keyValue = getSpecialDependencyList(pref);
+ if (keyValue.size() > 0) {
+ dependencyList = new CharSequence[keyValue.size()];
+ int k = 0;
+ for (KeyValue kv: keyValue) {
+ dependencyList[k++] = kv.key;
+ }
+ }
+ pref.setDependencyList(dependencyList);
+ }
if (dependencyList != null) {
for (int j = 0; j < dependencyList.length; j++) {
String key = dependencyList[j].toString();
pref = mPreferenceGroup.findPreference(key);
if (pref == null) continue; //filtered?
- List list = mDependendsOnMap.get(key);
- if (list == null) {
- list = new ArrayList<String>();
+ Set set = mDependendsOnMap.get(key);
+ if (set == null) {
+ set = new HashSet<>();
}
- list.add(baseKey);
- mDependendsOnMap.put(key, list);
+ set.add(baseKey);
+ mDependendsOnMap.put(key, set);
}
}
}
@@ -191,25 +217,36 @@ public class SettingsManager implements ListMenu.SettingsListener {
for (int i = 0; i < mPreferenceGroup.size(); i++) {
ListPreference pref = (ListPreference) mPreferenceGroup.get(i);
String key = pref.getKey();
- if (mDependendsOnMap.get(key) != null) {
+ if (mDependendsOnMap.get(key) != null && mDependendsOnMap.get(key).size() != 0) {
processLater.add(key);
continue;
}
Values values = new Values(pref.getValue(), null);
mValuesMap.put(pref.getKey(), values);
}
-
for (String keyToProcess : processLater) {
- List<String> dependsOnList = mDependendsOnMap.get(keyToProcess);
+ Set<String> dependsOnSet = mDependendsOnMap.get(keyToProcess);
boolean active = true;
- for (String s : dependsOnList) {
- if (isOptionOn(s)) active = false;
+ List<KeyValue> keyValue = null;
+ for (String s : dependsOnSet) {
+ if (specialDepedency(s) || isOptionOn(s)) {
+ active = false;
+ if (specialDepedency(s)) {
+ keyValue = getSpecialDependencyList(s);
+ }
+ }
break;
}
ListPreference pref = mPreferenceGroup.findPreference(keyToProcess);
Values values = new Values(pref.getValue(), null);
if (!active) {
- values.overriddenValue = pref.getOffValue();
+ String offValue = pref.getOffValue();
+ if (keyValue != null) {
+ String matchValue = getMatchingValue(keyToProcess, keyValue);
+ if (matchValue != null)
+ offValue = matchValue;
+ }
+ values.overriddenValue = offValue;
}
mValuesMap.put(keyToProcess, values);
}
@@ -221,49 +258,128 @@ public class SettingsManager implements ListMenu.SettingsListener {
String key = changedPref.getKey();
String value = changedPref.getValue();
+ boolean special = specialDepedency(changedPrefKey);
+ String prevValue = getValue(changedPrefKey);
+ if (value.equals(prevValue)) return null;
+
boolean turnedOff = value.equals(changedPref.getOffValue());
+ boolean updateBackDependency = false;
List<SettingState> changed = new ArrayList();
Values values = new Values(value, null);
mValuesMap.put(key, values);
changed.add(new SettingState(key, values));
- CharSequence[] dependencyList = changedPref.getDependencyList();
- if (!turnedOff) { // turned on
- if (dependencyList != null) {
- for (int j = 0; j < dependencyList.length; j++) {
- key = dependencyList[j].toString();
- ListPreference pref = mPreferenceGroup.findPreference(key);
- if (pref == null) continue;
- values = mValuesMap.get(key);
- if (values != null && values.overriddenValue != null) continue;
- Values newValue = new Values(pref.getValue(), pref.getOffValue());
- mValuesMap.put(key, newValue);
- changed.add(new SettingState(key, newValue));
+ Set<CharSequence> turnOn = new HashSet<>();
+ Set<CharSequence> turnOff = new HashSet<>();
+
+ CharSequence[] originalDependencyList = changedPref.getDependencyList();
+ CharSequence[] dependencyList = null;
+ List<KeyValue> keyValue = null;
+ if (special) {
+ keyValue = getSpecialDependencyList(changedPref);
+ if (keyValue.size() > 0) {
+ dependencyList = new CharSequence[keyValue.size()];
+ int k = 0;
+ for (KeyValue kv : keyValue) {
+ dependencyList[k++] = kv.key;
}
}
- } else {
- if (dependencyList != null) {
- for (int j = 0; j < dependencyList.length; j++) {
- key = dependencyList[j].toString();
- List<String> dependsOnList = mDependendsOnMap.get(key);
- if (dependsOnList == null) continue;
- boolean active = true;
- for (String s : dependsOnList) {
- if (isOptionOn(s)) active = false;
- break;
+ }
+
+ if (special) {
+ boolean same = Arrays.equals(originalDependencyList, dependencyList);
+ if (!same) {
+ changedPref.setDependencyList(dependencyList);
+ if (originalDependencyList != null)
+ for (CharSequence c : originalDependencyList) {
+ turnOn.add(c);
+ }
+ if (dependencyList != null)
+ for (CharSequence c : dependencyList) {
+ turnOff.add(c);
}
- if (active) {
- values = mValuesMap.get(key);
- values.overriddenValue = null;
- mValuesMap.put(key, values);
- changed.add(new SettingState(key, values));
+
+ if (originalDependencyList != null)
+ for (CharSequence c : originalDependencyList) {
+ turnOff.remove(c);
+ }
+ if (dependencyList != null)
+ for (CharSequence c : dependencyList) {
+ turnOn.remove(c);
}
+ updateBackDependency = true;
+ }
+ } else {
+ if (originalDependencyList != null) {
+ for (CharSequence c : originalDependencyList) {
+ if (turnedOff) turnOn.add(c);
+ else turnOff.add(c);
}
}
}
+
+ for (CharSequence c : turnOn) {// turn back on
+ key = c.toString();
+ Set<String> dependsOnSet = mDependendsOnMap.get(key);
+ if (dependsOnSet == null) continue;
+ boolean active = true;
+ for (String s : dependsOnSet) {
+ if (s.equals(changedPrefKey)) continue;
+ if (isOptionOn(s)) active = false;
+ break;
+ }
+ if (active) {
+ values = mValuesMap.get(key);
+ if (values == null) continue;
+ values.overriddenValue = null;
+ mValuesMap.put(key, values);
+ changed.add(new SettingState(key, values));
+ }
+ }
+
+ for (CharSequence c : turnOff) {// turn off logic
+ key = c.toString();
+ ListPreference pref = mPreferenceGroup.findPreference(key);
+ if (pref == null) continue;
+ values = mValuesMap.get(key);
+ if (values == null) continue;
+ if (values != null && values.overriddenValue != null) continue;
+ String offValue = pref.getOffValue();
+ if (keyValue != null) {
+ String matchValue = getMatchingValue(key, keyValue);
+ if (matchValue != null)
+ offValue = matchValue;
+ }
+ Values newValue = new Values(pref.getValue(), offValue);
+ mValuesMap.put(key, newValue);
+ changed.add(new SettingState(key, newValue));
+ }
+
+ if (updateBackDependency) {
+ updateBackDependency(changedPrefKey, turnOn, turnOff);
+ }
+
return changed;
}
+ private void updateBackDependency(String key, Set<CharSequence> remove, Set<CharSequence>
+ add) {
+ for (CharSequence c : remove) {
+ String currentKey = c.toString();
+ Set<String> dependsOnSet = mDependendsOnMap.get(currentKey);
+ if (dependsOnSet != null) dependsOnSet.remove(key);
+ }
+ for (CharSequence c : add) {
+ String currentKey = c.toString();
+ Set<String> dependsOnSet = mDependendsOnMap.get(currentKey);
+ if (dependsOnSet == null) {
+ dependsOnSet = new HashSet<>();
+ mDependendsOnMap.put(currentKey, dependsOnSet);
+ }
+ dependsOnSet.add(key);
+ }
+ }
+
public void registerListener(Listener listener) {
mListeners.add(listener);
}
@@ -311,11 +427,8 @@ public class SettingsManager implements ListMenu.SettingsListener {
private void updateMapAndNotify(ListPreference pref) {
String key = pref.getKey();
- Values values = mValuesMap.get(key);
- values.overriddenValue = null;
- values.value = pref.getValue();
- mValuesMap.put(key, values);
List changed = checkDependencyAndUpdate(key);
+ if (changed == null) return;
notifyListeners(changed);
}
@@ -355,6 +468,9 @@ public class SettingsManager implements ListMenu.SettingsListener {
ListPreference pictureSize = mPreferenceGroup.findPreference(KEY_PICTURE_SIZE);
ListPreference exposure = mPreferenceGroup.findPreference(KEY_EXPOSURE);
ListPreference iso = mPreferenceGroup.findPreference(KEY_ISO);
+ ListPreference clearsight = mPreferenceGroup.findPreference(KEY_CLEARSIGHT);
+ ListPreference monoPreview = mPreferenceGroup.findPreference(KEY_MONO_PREVIEW);
+ ListPreference monoOnly = mPreferenceGroup.findPreference(KEY_MONO_ONLY);
if (whiteBalance != null) {
CameraSettings.filterUnsupportedOptions(mPreferenceGroup,
@@ -388,6 +504,13 @@ public class SettingsManager implements ListMenu.SettingsListener {
CameraSettings.filterUnsupportedOptions(mPreferenceGroup,
iso, getSupportedIso(cameraId));
}
+
+ if (!mIsMonoCameraPresent) {
+ if (clearsight != null) removePreference(mPreferenceGroup, KEY_CLEARSIGHT);
+ if (monoPreview != null) removePreference(mPreferenceGroup, KEY_MONO_PREVIEW);
+ if (monoOnly != null) removePreference(mPreferenceGroup, KEY_MONO_ONLY);
+
+ }
}
private void buildExposureCompensation(int cameraId) {
@@ -431,16 +554,23 @@ public class SettingsManager implements ListMenu.SettingsListener {
private void buildCameraId() {
int numOfCameras = mCharacteristics.size();
- if (numOfCameras < 2) {
+ if (!mIsFrontCameraPresent) {
removePreference(mPreferenceGroup, KEY_CAMERA_ID);
+ return;
}
CharSequence[] entryValues = new CharSequence[numOfCameras];
+ CharSequence[] entries = new CharSequence[numOfCameras];
//TODO: Modify this after bayer/mono/front/back determination is done
entryValues[0] = "" + CaptureModule.BAYER_ID;
- entryValues[1] = "" + CaptureModule.FRONT_ID;
+ entries[0] = "BACK";
+ if (mIsFrontCameraPresent) {
+ entryValues[1] = "" + CaptureModule.FRONT_ID;
+ entries[1] = "FRONT";
+ }
ListPreference cameraIdPref = mPreferenceGroup.findPreference(KEY_CAMERA_ID);
cameraIdPref.setEntryValues(entryValues);
+ cameraIdPref.setEntries(entries);
}
private boolean removePreference(PreferenceGroup group, String key) {
@@ -537,6 +667,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
.CONTROL_AVAILABLE_SCENE_MODES);
List<String> modes = new ArrayList<>();
modes.add("0"); // need special case handle for auto scene mode
+ if (mIsMonoCameraPresent) modes.add("-5"); // need special case handle for dual mode
for (int mode : sceneModes) {
modes.add("" + mode);
}
@@ -579,10 +710,66 @@ public class SettingsManager implements ListMenu.SettingsListener {
return supportedIso;
}
+ private boolean specialDepedency(String key) {
+ return key.equals(KEY_SCENE_MODE);
+ }
+
+ private List<KeyValue> getSpecialDependencyList(String key) {
+ ListPreference pref = mPreferenceGroup.findPreference(key);
+ return getSpecialDependencyList(pref);
+ }
+
+ private List<KeyValue> getSpecialDependencyList(ListPreference pref) {
+ String key = pref.getKey();
+ List<KeyValue> dependency = new ArrayList<>();
+ switch (key) {
+ case KEY_SCENE_MODE:
+ String value = pref.getValue();
+ switch (value) {
+ case "0":
+ dependency.add(new KeyValue(KEY_CLEARSIGHT, "off"));
+ dependency.add(new KeyValue(KEY_MONO_PREVIEW, "off"));
+ break;
+ case "-5":
+ dependency.add(new KeyValue(KEY_LONGSHOT, "off"));
+ dependency.add(new KeyValue(KEY_MONO_ONLY, "off"));
+ break;
+ default:
+ dependency.add(new KeyValue(KEY_COLOR_EFFECT, "0"));
+ dependency.add(new KeyValue(KEY_FLASH_MODE, "2"));
+ dependency.add(new KeyValue(KEY_WHITE_BALANCE, "1"));
+ dependency.add(new KeyValue(KEY_EXPOSURE, "0"));
+ dependency.add(new KeyValue(KEY_CLEARSIGHT, "off"));
+ dependency.add(new KeyValue(KEY_MONO_PREVIEW, "off"));
+ break;
+ }
+ break;
+ }
+ return dependency;
+ }
+
public interface Listener {
void onSettingsChanged(List<SettingState> settings);
}
+ private String getMatchingValue(String key, List<KeyValue> keyValue) {
+ for (KeyValue kv: keyValue) {
+ if (key.equals(kv.key)) {
+ return kv.value;
+ }
+ }
+ return null;
+ }
+
+ static class KeyValue {
+ String key;
+ String value;
+
+ KeyValue(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+ }
static class Values {
String value;
String overriddenValue;
diff --git a/src/com/android/camera/ui/ListMenu.java b/src/com/android/camera/ui/ListMenu.java
index 4cb3598..decaad8 100644
--- a/src/com/android/camera/ui/ListMenu.java
+++ b/src/com/android/camera/ui/ListMenu.java
@@ -117,7 +117,7 @@ public class ListMenu extends ListView
if (position >= 0 && position < mEnabled.length) {
view.setEnabled(mEnabled[position]);
if (mForCamera2 && !mEnabled[position]) {
- view.overrideSettings(pref.getOffValue());
+ view.overrideSettings(mSettingsManager.getValue(pref.getKey()));
}
} else {
Log.w(TAG, "Invalid input: enabled list length, " + mEnabled.length
diff --git a/src/com/android/camera/util/PersistUtil.java b/src/com/android/camera/util/PersistUtil.java
index 0f3f43f..c9a5a47 100644
--- a/src/com/android/camera/util/PersistUtil.java
+++ b/src/com/android/camera/util/PersistUtil.java
@@ -45,7 +45,7 @@ public class PersistUtil {
}
public static int getLongshotShotLimit() {
- return SystemProperties.getInt(PERSIST_LONGSHOT_SHOT_LIMIT, 0);
+ return SystemProperties.getInt(PERSIST_LONGSHOT_SHOT_LIMIT, 20);
}
}