diff options
| author | 2011-09-28 06:13:44 -0700 | |
|---|---|---|
| committer | 2011-09-28 06:13:44 -0700 | |
| commit | 0c66f0526751ad3f97636b834ea957659a65048b (patch) | |
| tree | 0a81fedbec68928ed6f0b8feaa572ca0df212223 | |
| parent | d83baa4ef3a2903214ea9b5c943db67751858e90 (diff) | |
| parent | 267cb2b284626f910cf64352bfc494d0f8d3dc42 (diff) | |
Merge "Fix 5323545 - FaceLock no longer appears when taking a call"
5 files changed, 31 insertions, 50 deletions
diff --git a/core/java/com/android/internal/policy/IFaceLockCallback.aidl b/core/java/com/android/internal/policy/IFaceLockCallback.aidl index 1eadc412810b..4f76c7131f48 100644 --- a/core/java/com/android/internal/policy/IFaceLockCallback.aidl +++ b/core/java/com/android/internal/policy/IFaceLockCallback.aidl @@ -21,5 +21,4 @@ import android.os.IBinder; oneway interface IFaceLockCallback { void unlock(); void cancel(); - void sleepDevice(); } diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java index ec24f97a1a8c..10cf3aaf5c0f 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java @@ -593,4 +593,7 @@ public class KeyguardUpdateMonitor { return mClockVisible; } + public int getPhoneState() { + return mPhoneState; + } } diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java index 2fcf1dc3ebc2..74dde9c93f5d 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java @@ -127,15 +127,6 @@ public abstract class KeyguardViewBase extends FrameLayout { */ abstract public void cleanUp(); - /** - * These were added to support FaceLock because the KeyguardViewManager needs to tell the - * LockPatternKeyguardView when to bind and and unbind with FaceLock service. Although - * implemented in LockPatternKeyguardView, these are not implemented in anything else - * derived from KeyguardViewBase - */ - abstract public void bindToFaceLock(); - abstract public void stopAndUnbindFromFaceLock(); - @Override public boolean dispatchKeyEvent(KeyEvent event) { if (shouldEventKeepScreenOnWhileKeyguardShowing(event)) { diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java index 91f152724b54..f15812b27390 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java @@ -205,9 +205,6 @@ public class KeyguardViewManager implements KeyguardWindowController { mScreenOn = false; if (mKeyguardView != null) { mKeyguardView.onScreenTurnedOff(); - - // When screen is turned off, need to unbind from FaceLock service if using FaceLock - mKeyguardView.stopAndUnbindFromFaceLock(); } } @@ -218,9 +215,6 @@ public class KeyguardViewManager implements KeyguardWindowController { if (mKeyguardView != null) { mKeyguardView.onScreenTurnedOn(); - // When screen is turned on, need to bind to FaceLock service if we are using FaceLock - mKeyguardView.bindToFaceLock(); - // Caller should wait for this window to be shown before turning // on the screen. if (mKeyguardHost.getVisibility() == View.VISIBLE) { @@ -277,12 +271,6 @@ public class KeyguardViewManager implements KeyguardWindowController { public synchronized void hide() { if (DEBUG) Log.d(TAG, "hide()"); - if (mKeyguardView != null) { - // When view is hidden, need to unbind from FaceLock service if we are using FaceLock - // e.g., when device becomes unlocked - mKeyguardView.stopAndUnbindFromFaceLock(); - } - if (mKeyguardHost != null) { mKeyguardHost.setVisibility(View.GONE); // Don't do this right away, so we can let the view continue to animate diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index ffb48381e9f6..f24991c524e6 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -504,6 +504,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } else { ((KeyguardScreen) mUnlockScreen).onPause(); } + + // When screen is turned off, need to unbind from FaceLock service if using FaceLock + stopAndUnbindFromFaceLock(); } @Override @@ -514,6 +517,14 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } else { ((KeyguardScreen) mUnlockScreen).onResume(); } + + // When screen is turned on, need to bind to FaceLock service if we are using FaceLock + // But only if not dealing with a call + if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE) { + bindToFaceLock(); + } else { + mHandler.sendEmptyMessage(MSG_HIDE_FACELOCK_AREA_VIEW); + } } private void recreateLockScreen() { @@ -543,6 +554,11 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler @Override protected void onDetachedFromWindow() { removeCallbacks(mRecreateRunnable); + + // When view is hidden, need to unbind from FaceLock service if we are using FaceLock + // e.g., when device becomes unlocked + stopAndUnbindFromFaceLock(); + super.onDetachedFromWindow(); } @@ -952,8 +968,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler // Everything below pertains to FaceLock - might want to separate this out // Only pattern and pin unlock screens actually have a view for the FaceLock area, so it's not - // uncommon for it to not exist. But if it does exist, we need to make sure it's showing if - // FaceLock is enabled, and make sure it's not showing if FaceLock is disabled + // uncommon for it to not exist. But if it does exist, we need to make sure it's shown (hiding + // the fallback) if FaceLock is enabled, and make sure it's hidden (showing the unlock) if + // FaceLock is disabled private void initializeFaceLockAreaView(View view) { mFaceLockAreaView = view.findViewById(R.id.faceLockAreaView); if (mFaceLockAreaView == null) { @@ -997,9 +1014,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler if (DEBUG) Log.d(TAG, "after bind to FaceLock service"); mBoundToFaceLockService = true; } else { - // On startup I've seen onScreenTurnedOn() get called twice without - // onScreenTurnedOff() being called in between, which can cause this (bcolonna) - if (DEBUG) Log.w(TAG, "Attempt to bind to FaceLock when already bound"); + Log.w(TAG, "Attempt to bind to FaceLock when already bound"); } } } @@ -1017,7 +1032,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } else { // This could probably happen after the session when someone activates FaceLock // because it wasn't active when the phone was turned on - if (DEBUG) Log.w(TAG, "Attempt to unbind from FaceLock when not bound"); + Log.w(TAG, "Attempt to unbind from FaceLock when not bound"); } } } @@ -1048,7 +1063,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler mFaceLockService = null; mFaceLockServiceRunning = false; } - if (DEBUG) Log.w(TAG, "Unexpected disconnect from FaceLock service"); + Log.w(TAG, "Unexpected disconnect from FaceLock service"); } }; @@ -1099,36 +1114,21 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler // Stops the FaceLock UI and indicates that the phone should be unlocked @Override public void unlock() { - if (DEBUG) Log.d(TAG, "FaceLock unlock"); - // Note that we don't hide the client FaceLockAreaView because we want to keep the - // lock screen covered while the phone is unlocked - + if (DEBUG) Log.d(TAG, "FaceLock unlock()"); + mHandler.sendEmptyMessage(MSG_SHOW_FACELOCK_AREA_VIEW); // Keep fallback covered stopFaceLock(); + mKeyguardScreenCallback.keyguardDone(true); mKeyguardScreenCallback.reportSuccessfulUnlockAttempt(); } // Stops the FaceLock UI and exposes the backup method without unlocking + // This means either the user has cancelled out or FaceLock failed to recognize them @Override public void cancel() { - // In this case, either the user has cancelled out, or FaceLock failed to recognize them - if (DEBUG) Log.d(TAG, "FaceLock cancel"); - // Here we hide the client FaceLockViewArea to expose the underlying backup method - mHandler.sendEmptyMessage(MSG_HIDE_FACELOCK_AREA_VIEW); - stopFaceLock(); - } - - // Stops the FaceLock UI and puts the phone to sleep - @Override - public void sleepDevice() { - // In this case, it appears the phone has been turned on accidentally - if (DEBUG) Log.d(TAG, "FaceLock accidental turn on"); - // Here we hide the client FaceLockViewArea to expose the underlying backup method - mHandler.sendEmptyMessage(MSG_HIDE_FACELOCK_AREA_VIEW); + if (DEBUG) Log.d(TAG, "FaceLock cancel()"); + mHandler.sendEmptyMessage(MSG_HIDE_FACELOCK_AREA_VIEW); // Expose fallback stopFaceLock(); - // TODO(bcolonna): how do we put the phone back to sleep (i.e., turn off the screen) - // TODO(bcolonna): this should be removed once the service is no longer calling it - // because we are just going to let the lockscreen timeout } }; } |