summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2010-08-31 13:57:23 -0700
committerWu-cheng Li <wuchengli@google.com>2010-09-01 09:06:44 -0700
commitd4a37518c3b73fcf1860ab10fd3bb7e7ceffba99 (patch)
tree80cb5a0e35b58c4a7b11f9227b10d035e6c12aca /src
parent1ba127ec81106c9f63ef945137f315a55da59f4a (diff)
downloadLegacyCamera-d4a37518c3b73fcf1860ab10fd3bb7e7ceffba99.zip
LegacyCamera-d4a37518c3b73fcf1860ab10fd3bb7e7ceffba99.tar.gz
LegacyCamera-d4a37518c3b73fcf1860ab10fd3bb7e7ceffba99.tar.bz2
Fix wrong orientation after suspend and resume.
Camera application calls setDisplayOrientation according to Display.getRotation and sensor orientation. After power key is pressed, camera app resumes behind the lock screen and preview is started. Rotation is 90 at the time. After the screen is unlocked, surfaceChanged is called because the orientation is changed from portrait to landscape. Preview is stopped and restarted. setDisplayOrientation should be called again because the rotation has changed to 0. bug:2870671 Change-Id: I1ca5106087c168d88cc8eb4f2a9f192d7fa75a8a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java5
-rw-r--r--src/com/android/camera/VideoCamera.java4
2 files changed, 3 insertions, 6 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 4008f82..3059a56 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -1580,7 +1580,6 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
private void ensureCameraDevice() throws CameraHardwareException {
if (mCameraDevice == null) {
mCameraDevice = CameraHolder.instance().open(mCameraId);
- Util.setCameraDisplayOrientation(this, mCameraId, mCameraDevice);
mInitialParams = mCameraDevice.getParameters();
}
}
@@ -1639,11 +1638,9 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
if (mPreviewing) stopPreview();
setPreviewDisplay(mSurfaceHolder);
+ Util.setCameraDisplayOrientation(this, mCameraId, mCameraDevice);
setCameraParameters(UPDATE_PARAM_ALL);
- final long wallTimeStart = SystemClock.elapsedRealtime();
- final long threadTimeStart = Debug.threadCpuTimeNanos();
-
mCameraDevice.setErrorCallback(mErrorCallback);
try {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 59f6ab9..1d19561 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -636,12 +636,12 @@ public class VideoCamera extends NoSearchActivity
// If the activity is paused and resumed, camera device has been
// released and we need to open the camera.
mCameraDevice = CameraHolder.instance().open(mCameraId);
- Util.setCameraDisplayOrientation(this, mCameraId, mCameraDevice);
}
mCameraDevice.lock();
- setCameraParameters();
setPreviewDisplay(mSurfaceHolder);
+ Util.setCameraDisplayOrientation(this, mCameraId, mCameraDevice);
+ setCameraParameters();
try {
mCameraDevice.startPreview();