summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwenbinw <wenbinw@codeaurora.org>2013-08-07 14:36:30 +0800
committerSteve Kondik <shade@chemlab.org>2013-10-18 15:54:49 -0700
commit07630b2d04520e092a4bc14eb77aa692c4871149 (patch)
tree3b7ad9db8ad136559104595f61b870e01fcf1c98
parentfd188e6ecbee4f3d30c122016887232609f4bc8d (diff)
downloadandroid_packages_apps_Gallery2-07630b2d04520e092a4bc14eb77aa692c4871149.tar.gz
android_packages_apps_Gallery2-07630b2d04520e092a4bc14eb77aa692c4871149.tar.bz2
android_packages_apps_Gallery2-07630b2d04520e092a4bc14eb77aa692c4871149.zip
Camera: Fix camera crash when post picture taken in message app
When post the picture taken in message, the gestures should be disabled, that's to say, you can not touch screen to AF or show the preference menu. 1. Disable gestures. 2. Disable keyevent. Change-Id: I70d478979b0738334886dc3ca6534ca428159339 CRs-Fixed: 520918
-rw-r--r--src/com/android/camera/PhotoModule.java13
-rw-r--r--src/com/android/camera/PhotoUI.java2
2 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 0df8994a5..9e691c46d 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -164,6 +164,7 @@ public class PhotoModule
private static final String sTempCropFilename = "crop-temp";
private ContentProviderClient mMediaProviderClient;
+ private ShutterButton mShutterButton;
private boolean mFaceDetectionStarted = false;
// mCropValue and mSaveUri are used only if isImageCaptureIntent() is true.
@@ -641,6 +642,8 @@ public class PhotoModule
keepMediaProviderInstance();
+ mShutterButton = mActivity.getShutterButton();
+
mUI.initializeFirstTime();
MediaSaveService s = mActivity.getMediaSaveService();
// We set the listener only when both service and shutterbutton
@@ -1620,7 +1623,8 @@ public class PhotoModule
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_FOCUS:
- if (mActivity.isInCameraApp() && mFirstTimeInitialized) {
+ if (mActivity.isInCameraApp() && mFirstTimeInitialized &&
+ mShutterButton.getVisibility() == View.VISIBLE) {
if (event.getRepeatCount() == 0) {
onShutterButtonFocus(true);
}
@@ -1629,7 +1633,9 @@ public class PhotoModule
return false;
case KeyEvent.KEYCODE_CAMERA:
if (mFirstTimeInitialized && event.getRepeatCount() == 0) {
- onShutterButtonClick();
+ // Only capture when in full screen capture mode
+ if (mActivity.isInCameraApp() && mShutterButton.getVisibility() == View.VISIBLE)
+ onShutterButtonClick();
}
return true;
case KeyEvent.KEYCODE_DPAD_CENTER:
@@ -1653,7 +1659,8 @@ public class PhotoModule
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN:
- if (mActivity.isInCameraApp() && mFirstTimeInitialized) {
+ if (mActivity.isInCameraApp() && mFirstTimeInitialized &&
+ mShutterButton.getVisibility() == View.VISIBLE) {
onShutterButtonClick();
return true;
}
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index a26e1a088..ffa117642 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -465,6 +465,7 @@ public class PhotoUI implements PieListener,
mShutterButton.setVisibility(View.INVISIBLE);
Util.fadeIn(mReviewRetakeButton);
pauseFaceDetection();
+ enableGestures(false);
}
protected void hidePostCaptureAlert() {
@@ -474,6 +475,7 @@ public class PhotoUI implements PieListener,
mShutterButton.setVisibility(View.VISIBLE);
Util.fadeOut(mReviewRetakeButton);
resumeFaceDetection();
+ enableGestures(true);
}
public void setDisplayOrientation(int orientation) {