summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-07-11 10:17:36 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-07-11 10:17:36 -0700
commitd74db8839676f0ba1ab8d77d985a8126b5f11073 (patch)
treeb0083c3f2d9f990adf5140041e55b7606f400e13
parent2f8a61454085a60196a18caca4a87853f7bcf5c0 (diff)
parent85695457ba745d0b22e565c80816a39c4cc0d528 (diff)
downloadandroid_packages_apps_Gallery2-d74db8839676f0ba1ab8d77d985a8126b5f11073.tar.gz
android_packages_apps_Gallery2-d74db8839676f0ba1ab8d77d985a8126b5f11073.tar.bz2
android_packages_apps_Gallery2-d74db8839676f0ba1ab8d77d985a8126b5f11073.zip
am 85695457: am ee14cce0: am e8e2610f: Fix preview thumb and touch target out of sync
* commit '85695457ba745d0b22e565c80816a39c4cc0d528': Fix preview thumb and touch target out of sync
-rw-r--r--src/com/android/camera/Util.java6
-rw-r--r--src/com/android/camera/VideoModule.java13
2 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index ed42de85a..44af42531 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -39,6 +39,7 @@ import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.os.ParcelFileDescriptor;
+import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.FloatMath;
@@ -375,6 +376,11 @@ public class Util {
return x;
}
+ public static boolean systemRotationLocked(Activity activity) {
+ return Settings.System.getInt(activity.getContentResolver(),
+ Settings.System.ACCELEROMETER_ROTATION, 0) == 0;
+ }
+
public static int getDisplayRotation(Activity activity) {
int rotation = activity.getWindowManager().getDefaultDisplay()
.getRotation();
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 2c654fc29..2eb3d1bad 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -583,6 +583,11 @@ public class VideoModule implements CameraModule,
// back to use SurfaceTexture for preview and we need to stop then start
// the preview. This will cause the preview flicker since the preview
// will not be continuous for a short period of time.
+
+ // Get orientation directly from display rotation to make sure it's up
+ // to date. OnConfigurationChanged callback usually kicks in a bit later, if
+ // device is rotated during recording.
+ mDisplayRotation = Util.getDisplayRotation(mActivity);
((CameraScreenNail) mActivity.mCameraScreenNail).animateCapture(mDisplayRotation);
mUI.enablePreviewThumb(true);
@@ -1537,7 +1542,9 @@ public class VideoModule implements CameraModule,
mUI.enableCameraControls(false);
mMediaRecorderRecording = true;
- mActivity.getOrientationManager().lockOrientation();
+ if (!Util.systemRotationLocked(mActivity)) {
+ mActivity.getOrientationManager().lockOrientation();
+ }
mRecordingStartTime = SystemClock.uptimeMillis();
mUI.showRecordingUI(true, mParameters.isZoomSupported());
@@ -1612,7 +1619,9 @@ public class VideoModule implements CameraModule,
fail = true;
}
mMediaRecorderRecording = false;
- mActivity.getOrientationManager().unlockOrientation();
+ if (!Util.systemRotationLocked(mActivity)) {
+ mActivity.getOrientationManager().unlockOrientation();
+ }
// If the activity is paused, this means activity is interrupted
// during recording. Release the camera as soon as possible because