summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Camera.java
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-10-09 21:58:49 +0200
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-10-09 22:25:42 +0200
commita6149d3035480e777301aa678b2f8dd7d10d10a7 (patch)
treedf31a5c8faaa1a4729a4f1f22622d1fdfa8fedde /src/com/android/camera/Camera.java
parentb03ba46b3fb4897041ec6be499b000c7f54e2dde (diff)
downloadLegacyCamera-master.zip
LegacyCamera-master.tar.gz
LegacyCamera-master.tar.bz2
make Camera work on lock screen (secure mode)HEADmaster
Change-Id: I2ea9993738430f8c59f9e69cd2f75e6acccdc9eb
Diffstat (limited to 'src/com/android/camera/Camera.java')
-rw-r--r--src/com/android/camera/Camera.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 2ca7944..f7de7f6 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -100,6 +100,10 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
private static final int SHOW_TAP_TO_FOCUS_TOAST = 6;
private static final int UPDATE_THUMBNAIL = 7;
+ // This is the delay before we execute onResume tasks when coming
+ // from the lock screen, to allow time for onPause to execute.
+ private static final int ON_RESUME_TASKS_DELAY_MSEC = 20;
+
// The subset of parameters we need to update in setCameraParameters().
private static final int UPDATE_PARAM_INITIALIZE = 1;
private static final int UPDATE_PARAM_ZOOM = 2;
@@ -1345,7 +1349,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
@OnClickAttr
public void onThumbnailClicked(View v) {
- if (isCameraIdle() && mThumbnail != null) {
+ if (isCameraIdle() && mThumbnail != null && !isCameraSecure()) {
showSharePopup();
}
}
@@ -2318,4 +2322,27 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mAeLockSupported = mInitialParams.isAutoExposureLockSupported();
mAwbLockSupported = mInitialParams.isAutoWhiteBalanceLockSupported();
}
+
+ @Override
+ public void onResumeAfterSuper() {
+ // Add delay on resume from lock screen only, in order to to speed up
+ // the onResume --> onPause --> onResume cycle from lock screen.
+ // Don't do always because letting go of thread can cause delay.
+ String action = getIntent().getAction();
+ if (isCameraSecure()) {
+ Log.v(TAG, "On resume, from lock screen.");
+ // Note: onPauseAfterSuper() will delete this runnable, so we will
+ // at most have 1 copy queued up.
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ doOnResume();
+ }
+ }, ON_RESUME_TASKS_DELAY_MSEC);
+ // show on lock screen
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+ } else {
+ Log.v(TAG, "On resume.");
+ doOnResume();
+ }
+ }
}