summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@google.com>2011-11-02 16:37:13 +0800
committerChung-yih Wang <cywang@google.com>2011-11-03 11:40:43 +0800
commitb455c45a3fc04623bfd81573c8a88101a2afcceb (patch)
tree19beb8c2d48c6be4238b91cc38a47aa6539314f2
parent1f56f129d65729705326f4d6852d760e6a5cacf5 (diff)
downloadLegacyCamera-b455c45a3fc04623bfd81573c8a88101a2afcceb.zip
LegacyCamera-b455c45a3fc04623bfd81573c8a88101a2afcceb.tar.gz
LegacyCamera-b455c45a3fc04623bfd81573c8a88101a2afcceb.tar.bz2
Enable camera controls after wakeup.
bug:5516230 Change-Id: Ibf0ab46070af9440f3c7fbef116d65264db0ea7e
-rw-r--r--src/com/android/camera/Camera.java40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 1bd759b..48e8100 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -699,8 +699,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
+ mPictureDisplayedToJpegCallbackTime + "ms");
if (!mIsImageCaptureIntent) {
- enableCameraControls(true);
-
startPreview();
startFaceDetection();
}
@@ -739,12 +737,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mAutoFocusTime = System.currentTimeMillis() - mFocusStartTime;
Log.v(TAG, "mAutoFocusTime = " + mAutoFocusTime + "ms");
+ setCameraState(IDLE);
mFocusManager.onAutoFocus(focused);
- // If focus completes and the snapshot is not started, enable the
- // controls.
- if (mFocusManager.isFocusCompleted()) {
- enableCameraControls(true);
- }
}
}
@@ -954,6 +948,20 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
}
+ private void setCameraState(int state) {
+ mCameraState = state;
+ switch (state) {
+ case SNAPSHOT_IN_PROGRESS:
+ case FOCUSING:
+ enableCameraControls(false);
+ break;
+ case IDLE:
+ case PREVIEW_STOPPED:
+ enableCameraControls(true);
+ break;
+ }
+ }
+
@Override
public boolean capture() {
// If we are already in the middle of taking a snapshot then ignore.
@@ -962,7 +970,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
mCaptureStartTime = System.currentTimeMillis();
mPostViewPictureCallbackTime = 0;
- enableCameraControls(false);
mJpegImageData = null;
// Set rotation and gps data.
@@ -973,7 +980,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mCameraDevice.takePicture(mShutterCallback, mRawPictureCallback,
mPostViewPictureCallback, new JpegPictureCallback(loc));
- mCameraState = SNAPSHOT_IN_PROGRESS;
+ setCameraState(SNAPSHOT_IN_PROGRESS);
return true;
}
@@ -1440,7 +1447,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
if (mOpenCameraFail || mCameraDisabled) return;
mPausing = false;
-
mJpegPictureCallbackTime = 0;
mZoomValue = 0;
@@ -1559,15 +1565,13 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
public void autoFocus() {
mFocusStartTime = System.currentTimeMillis();
mCameraDevice.autoFocus(mAutoFocusCallback);
- mCameraState = FOCUSING;
- enableCameraControls(false);
+ setCameraState(FOCUSING);
}
@Override
public void cancelAutoFocus() {
mCameraDevice.cancelAutoFocus();
- mCameraState = IDLE;
- enableCameraControls(true);
+ setCameraState(IDLE);
setCameraParameters(UPDATE_PARAM_PREFERENCE);
}
@@ -1713,7 +1717,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mCameraDevice.setFaceDetectionListener(null);
mCameraDevice.setErrorCallback(null);
mCameraDevice = null;
- mCameraState = PREVIEW_STOPPED;
+ setCameraState(PREVIEW_STOPPED);
mFocusManager.onCameraReleased();
}
}
@@ -1774,7 +1778,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
mZoomState = ZOOM_STOPPED;
- mCameraState = IDLE;
+ setCameraState(IDLE);
mFocusManager.onPreviewStarted();
if (mSnapshotOnIdle) {
@@ -1788,7 +1792,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mCameraDevice.cancelAutoFocus(); // Reset the focus.
mCameraDevice.stopPreview();
}
- mCameraState = PREVIEW_STOPPED;
+ setCameraState(PREVIEW_STOPPED);
mFocusManager.onPreviewStopped();
}
@@ -2029,8 +2033,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
private void hidePostCaptureAlert() {
if (mIsImageCaptureIntent) {
- enableCameraControls(true);
-
int[] pickIds = {R.id.btn_retake, R.id.btn_done};
for (int id : pickIds) {
Util.fadeOut(findViewById(id));