diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-10-26 19:40:16 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-26 19:40:16 -0700 |
commit | 86bace6c94d86cd662f7bff7a58e90dd43577bb4 (patch) | |
tree | 07b8c62ef72b0e82cda950d803ca839302805375 /src/com | |
parent | 6b3a61edf6cfc87473ad8e97c39988260d2e2a3a (diff) | |
parent | 8853039421ae9b129ef40c8e71a347eac321d921 (diff) | |
download | packages_apps_LegacyCamera-86bace6c94d86cd662f7bff7a58e90dd43577bb4.zip packages_apps_LegacyCamera-86bace6c94d86cd662f7bff7a58e90dd43577bb4.tar.gz packages_apps_LegacyCamera-86bace6c94d86cd662f7bff7a58e90dd43577bb4.tar.bz2 |
Merge "Fix camera app still opens the camera in lock screen sometimes." into ics-mr1
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/ActivityBase.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/camera/ActivityBase.java b/src/com/android/camera/ActivityBase.java index b2ef481..439f830 100644 --- a/src/com/android/camera/ActivityBase.java +++ b/src/com/android/camera/ActivityBase.java @@ -61,11 +61,16 @@ abstract public class ActivityBase extends Activity { // Don't grab the camera if in use by lockscreen. For example, face // unlock may be using the camera. Camera may be already opened in // onCreate. doOnResume should continue if mCameraDevice != null. - if (mCameraDevice == null && !hasWindowFocus() && isKeyguardLocked()) { - if (LOGV) Log.v(TAG, "onRsume. mOnResumePending=true"); + // Suppose camera app is in the foreground. If users turn off and turn + // on the screen very fast, camera app can still have the focus when the + // lock screen shows up. The keyguard takes input focus, so the caemra + // app will lose focus when it is displayed. + if (LOGV) Log.v(TAG, "onResume. hasWindowFocus()=" + hasWindowFocus()); + if (mCameraDevice == null && isKeyguardLocked()) { + if (LOGV) Log.v(TAG, "onResume. mOnResumePending=true"); mOnResumePending = true; } else { - if (LOGV) Log.v(TAG, "onRsume. mOnResumePending=false"); + if (LOGV) Log.v(TAG, "onResume. mOnResumePending=false"); doOnResume(); mOnResumePending = false; } @@ -124,6 +129,12 @@ abstract public class ActivityBase extends Activity { private boolean isKeyguardLocked() { KeyguardManager kgm = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); + if (LOGV) { + if (kgm != null) { + Log.v(TAG, "kgm.isKeyguardLocked()="+kgm.isKeyguardLocked() + + ". kgm.isKeyguardSecure()="+kgm.isKeyguardSecure()); + } + } // isKeyguardSecure excludes the slide lock case. return (kgm != null) && kgm.isKeyguardLocked() && kgm.isKeyguardSecure(); } |