summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
authormingwax <mingwax@codeaurora.org>2016-08-16 10:27:36 +0800
committermingwax <mingwax@codeaurora.org>2016-08-16 11:30:44 +0800
commitee5d17ff56388a99a8216a984ccca2eaa4fc6662 (patch)
tree1f6f8ae11d7a06426825aab49b4e00693e2bd75a /src/com/android/camera/VideoModule.java
parentbec67f460a2acb5d239ab5455a8eb0b8a66cfe23 (diff)
downloadandroid_packages_apps_Snap-ee5d17ff56388a99a8216a984ccca2eaa4fc6662.tar.gz
android_packages_apps_Snap-ee5d17ff56388a99a8216a984ccca2eaa4fc6662.tar.bz2
android_packages_apps_Snap-ee5d17ff56388a99a8216a984ccca2eaa4fc6662.zip
SnapdragonCamera: Fix camera flash blink after unlock device
RootCause: when lock the screen and unlock the screen quickly,the system could show the last recent app when the lockscreen is not ready.when the lockscreen is ready now,system could dismiss the last recent app.When camera show,run onResume method,flash could be opened.And when camera run onPause method,flash could be closed,it caused flash blink. Add delay time avoid when camera be opened and closed quickly caused flash blink Change-Id: Id32eaf5186020edd1c835315efa9a2671db9f952 CRs-Fixed: 1034366
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--[-rwxr-xr-x]src/com/android/camera/VideoModule.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index a93cff611..dcee0c743 100755..100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -98,6 +98,7 @@ public class VideoModule implements CameraModule,
private static final int SHOW_TAP_TO_SNAPSHOT_TOAST = 7;
private static final int SWITCH_CAMERA = 8;
private static final int SWITCH_CAMERA_START_ANIMATION = 9;
+ private static final int HANDLE_FLASH_TORCH_DELAY = 10;
private static final int SCREEN_DELAY = 2 * 60 * 1000;
@@ -415,6 +416,11 @@ public class VideoModule implements CameraModule,
break;
}
+ case HANDLE_FLASH_TORCH_DELAY: {
+ forceFlashOff(!mPreviewFocused);
+ break;
+ }
+
default:
Log.v(TAG, "Unhandled message: " + msg.what);
break;
@@ -1218,7 +1224,7 @@ public class VideoModule implements CameraModule,
setDisplayOrientation();
mCameraDevice.setDisplayOrientation(mCameraDisplayOrientation);
- setCameraParameters();
+ setCameraParameters(true);
try {
mCameraDevice.setPreviewDisplay(sh);
@@ -1313,6 +1319,7 @@ public class VideoModule implements CameraModule,
mHandler.removeMessages(CHECK_DISPLAY_ROTATION);
mHandler.removeMessages(SWITCH_CAMERA);
mHandler.removeMessages(SWITCH_CAMERA_START_ANIMATION);
+ mHandler.removeMessages(HANDLE_FLASH_TORCH_DELAY);
mPendingSwitchCameraId = -1;
mSwitchingCamera = false;
mPreferenceRead = false;
@@ -2589,7 +2596,7 @@ public class VideoModule implements CameraModule,
}
@SuppressWarnings("deprecation")
- private void setCameraParameters() {
+ private void setCameraParameters(boolean isFlashDelay) {
Log.d(TAG,"Preview dimension in App->"+mDesiredPreviewWidth+"X"+mDesiredPreviewHeight);
mParameters.setPreviewSize(mDesiredPreviewWidth, mDesiredPreviewHeight);
mParameters.set("video-size", mProfile.videoFrameWidth+"x"+mProfile.videoFrameHeight);
@@ -2602,7 +2609,11 @@ public class VideoModule implements CameraModule,
mParameters.setPreviewFrameRate(mProfile.videoFrameRate);
}
- forceFlashOffIfSupported(!mPreviewFocused);
+ if (isFlashDelay) {
+ mHandler.sendEmptyMessageDelayed(HANDLE_FLASH_TORCH_DELAY, 800);
+ } else {
+ forceFlashOffIfSupported(!mPreviewFocused);
+ }
videoWidth = mProfile.videoFrameWidth;
videoHeight = mProfile.videoFrameHeight;
@@ -2777,7 +2788,7 @@ public class VideoModule implements CameraModule,
resizeForPreviewAspectRatio();
startPreview(); // Parameters will be set in startPreview().
} else {
- setCameraParameters();
+ setCameraParameters(false);
}
mRestartPreview = false;
mUI.updateOnScreenIndicators(mParameters, mPreferences);
@@ -2906,7 +2917,7 @@ public class VideoModule implements CameraModule,
@Override
public void onPreviewFocusChanged(boolean previewFocused) {
mUI.onPreviewFocusChanged(previewFocused);
- forceFlashOff(!previewFocused);
+ mHandler.sendEmptyMessageDelayed(HANDLE_FLASH_TORCH_DELAY, 800);
mPreviewFocused = previewFocused;
}