summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Colonna <bcolonna@google.com>2011-09-26 13:52:25 -0400
committerBrian Colonna <bcolonna@google.com>2011-09-27 12:45:13 -0400
commit267cb2b284626f910cf64352bfc494d0f8d3dc42 (patch)
tree8bde36d869b3485f8bc3a63219e3f0f3403ffa5d
parent64061c38f064e89822475a152b675dea87bd9eb0 (diff)
downloadframeworks_base-267cb2b284626f910cf64352bfc494d0f8d3dc42.zip
frameworks_base-267cb2b284626f910cf64352bfc494d0f8d3dc42.tar.gz
frameworks_base-267cb2b284626f910cf64352bfc494d0f8d3dc42.tar.bz2
Fix 5323545 - FaceLock no longer appears when taking a call
Prior to this fix if the screen was off and a call was received, the onScreenTurnedOn() callback would bring up the FaceLock service, which would cover the phone interface. It now requires the call state to be CALL_STATE_IDLE to start FaceLock. When the phone interface closes, the user is left at the backup lock screen. Bringing FaceLock up after a call ends does not seem like the correct thing to do. While working near the FaceLock callback code, the sleepDevice() callback was removed because it is no longer used (Fix 5327896). Some cleanup was also done with regards to KeyguardViewManager. FaceLock calls were being made from the KeyguardViewManager in onScreenTurnedOn() and onScreenTurnedOff() via an interface to LockPatternKeyguardView. This level of indirection was removed because it can just be handled inside of the corresponding calls in LockPatternKeyguardView. Likewise the FaceLock functionality inside of hide() in KeyguardViewManager is now in onDetachedFromWindow() in LockPatternKeyguardView. Overall this is much cleaner, especially considering interfacing through KeyguardViewBase was a bit of a hack. Patch Set 2: - Now using KeyguardUpdateMonitor to get phone state - Removed unnecessary wrapper functions for hiding / viewing FaceLock area - These were really only there because at one point I was calling them from KeyguardViewManager and the naming was confusing - Removed if(DEBUG) from a couple of log messages that are actually warnings that shouldn't show up and I want to know if they happen even if I don't have DEBUG set to true Change-Id: Id7befc47dd421156ff6cdb3aaf62fc76fe9cfad2
-rw-r--r--core/java/com/android/internal/policy/IFaceLockCallback.aidl1
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java3
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewBase.java9
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewManager.java12
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java56
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 1eadc41..4f76c71 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 ec24f97..10cf3aa 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 2fcf1dc3..74dde9c 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 91f1527..f15812b 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 ffb4838..f24991c 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
}
};
}