summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorBrian Colonna <bcolonna@google.com>2012-05-14 15:16:14 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-14 15:16:14 -0700
commit5a1c0cf492b0b2a96f779479d9aec4f4c3009847 (patch)
tree225f001f152a10985feb6d0ca4daab956aa1a827 /policy
parent8e96d58146b3cde7aef9dbebaa2c7a6fec2b5571 (diff)
parent88240596fce58afe79a4d06752cd8f6c086e2600 (diff)
downloadframeworks_base-5a1c0cf492b0b2a96f779479d9aec4f4c3009847.zip
frameworks_base-5a1c0cf492b0b2a96f779479d9aec4f4c3009847.tar.gz
frameworks_base-5a1c0cf492b0b2a96f779479d9aec4f4c3009847.tar.bz2
Merge "Fix 6437474: Fixed black box appearing on rotation" into jb-dev
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java3
-rw-r--r--policy/src/com/android/internal/policy/impl/FaceUnlock.java1
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java81
3 files changed, 52 insertions, 33 deletions
diff --git a/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java b/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java
index a13ccc2..f476f82 100644
--- a/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java
+++ b/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java
@@ -21,8 +21,7 @@ import android.view.View;
interface BiometricSensorUnlock {
/**
* Initializes the view provided for the biometric unlock UI to work within. The provided area
- * completely covers the backup unlock mechanism. The view is then displayed in the same manner
- * as if {@link BiometricSensorUnlock#show(long)} was called with a timeout of 0.
+ * completely covers the backup unlock mechanism.
* @param biometricUnlockView View provided for the biometric unlock UI.
*/
public void initializeView(View biometricUnlockView);
diff --git a/policy/src/com/android/internal/policy/impl/FaceUnlock.java b/policy/src/com/android/internal/policy/impl/FaceUnlock.java
index ffdeeb1..a08b615 100644
--- a/policy/src/com/android/internal/policy/impl/FaceUnlock.java
+++ b/policy/src/com/android/internal/policy/impl/FaceUnlock.java
@@ -101,7 +101,6 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
public void initializeView(View biometricUnlockView) {
Log.d(TAG, "initializeView()");
mFaceUnlockView = biometricUnlockView;
- show(0);
}
/**
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 8320b1d..049e6ac 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -414,12 +414,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
}
};
- // Indicates whether a biometric unlock method is in use
- private boolean isBiometricUnlockInstalledAndSelected() {
- return (mLockPatternUtils.usingBiometricWeak() &&
- mLockPatternUtils.isBiometricWeakInstalled());
- }
-
/**
* @param context Used to inflate, and create views.
* @param callback Keyguard callback object for pokewakelock(), etc.
@@ -443,14 +437,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
sIsFirstAppearanceAfterBoot = false;
mPluggedIn = mUpdateMonitor.isDevicePluggedIn();
mScreenOn = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).isScreenOn();
-
- // If the biometric unlock is not being used, we don't bother constructing it. Then we can
- // simply check if it is null when deciding whether we should make calls to it.
- if (isBiometricUnlockInstalledAndSelected()) {
- mBiometricUnlock = new FaceUnlock(context, updateMonitor, lockPatternUtils,
- mKeyguardScreenCallback);
- }
-
mUpdateMonitor.registerInfoCallback(mInfoCallback);
/**
@@ -848,19 +834,11 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
}
}
- // Re-create the unlock screen if necessary. This is primarily required to properly handle
- // SIM state changes. This typically happens when this method is called by reset()
+ // Re-create the unlock screen if necessary.
final UnlockMode unlockMode = getUnlockMode();
if (mode == Mode.UnlockScreen && unlockMode != UnlockMode.Unknown) {
if (force || mUnlockScreen == null || unlockMode != mUnlockScreenMode) {
- boolean restartBiometricUnlock = false;
- if (mBiometricUnlock != null) {
- restartBiometricUnlock = mBiometricUnlock.stop();
- }
recreateUnlockScreen(unlockMode);
- if (mBiometricUnlock != null && restartBiometricUnlock) {
- maybeStartBiometricUnlock();
- }
}
}
@@ -973,13 +951,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
throw new IllegalArgumentException("unknown unlock mode " + unlockMode);
}
initializeTransportControlView(unlockView);
-
- if (mBiometricUnlock != null) {
- // TODO: make faceLockAreaView a more general biometricUnlockView
- // We will need to add our Face Unlock specific child views programmatically in
- // initializeView rather than having them in the XML files.
- mBiometricUnlock.initializeView(unlockView.findViewById(R.id.faceLockAreaView));
- }
+ initializeBiometricUnlockView(unlockView);
mUnlockScreenMode = unlockMode;
return unlockView;
@@ -997,6 +969,55 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
}
/**
+ * This returns false if there is any condition that indicates that the biometric unlock should
+ * not be used before the next time the unlock screen is recreated. In other words, if this
+ * returns false there is no need to even construct the biometric unlock.
+ */
+ private boolean useBiometricUnlock() {
+ final UnlockMode unlockMode = getUnlockMode();
+ final boolean backupIsTimedOut = (mUpdateMonitor.getFailedAttempts() >=
+ LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT);
+ return (mLockPatternUtils.usingBiometricWeak() &&
+ mLockPatternUtils.isBiometricWeakInstalled() &&
+ !mUpdateMonitor.getMaxBiometricUnlockAttemptsReached() &&
+ !backupIsTimedOut &&
+ (unlockMode == UnlockMode.Pattern || unlockMode == UnlockMode.Password));
+ }
+
+ private void initializeBiometricUnlockView(View view) {
+ boolean restartBiometricUnlock = false;
+
+ if (mBiometricUnlock != null) {
+ restartBiometricUnlock = mBiometricUnlock.stop();
+ }
+
+ // If the biometric unlock is not being used, we don't bother constructing it. Then we can
+ // simply check if it is null when deciding whether we should make calls to it.
+ mBiometricUnlock = null;
+ if (useBiometricUnlock()) {
+ // TODO: make faceLockAreaView a more general biometricUnlockView
+ // We will need to add our Face Unlock specific child views programmatically in
+ // initializeView rather than having them in the XML files.
+ View biometricUnlockView = view.findViewById(R.id.faceLockAreaView);
+ if (biometricUnlockView != null) {
+ mBiometricUnlock = new FaceUnlock(mContext, mUpdateMonitor, mLockPatternUtils,
+ mKeyguardScreenCallback);
+ mBiometricUnlock.initializeView(biometricUnlockView);
+
+ // If this is being called because the screen turned off, we want to cover the
+ // backup lock so it is covered when the screen turns back on.
+ if (!mScreenOn) mBiometricUnlock.show(0);
+ } else {
+ Log.w(TAG, "Couldn't find biometric unlock view");
+ }
+ }
+
+ if (mBiometricUnlock != null && restartBiometricUnlock) {
+ maybeStartBiometricUnlock();
+ }
+ }
+
+ /**
* Given the current state of things, what should be the initial mode of
* the lock screen (lock or unlock).
*/