summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorSteven Ross <stross@google.com>2011-09-30 11:08:47 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-30 11:08:47 -0700
commitd42825f40e5a08a030a2f8f7ca2998e43d5d6f81 (patch)
tree40b18c121d618ec6ab14fb049e053b1abf07eb21 /core/java/com
parenteba3d923415431ea8b301d4e77c8f2b7225fed30 (diff)
parent329979c9e6cecbcec470ec6f3ac41da82ca58d3f (diff)
downloadframeworks_base-d42825f40e5a08a030a2f8f7ca2998e43d5d6f81.zip
frameworks_base-d42825f40e5a08a030a2f8f7ca2998e43d5d6f81.tar.gz
frameworks_base-d42825f40e5a08a030a2f8f7ca2998e43d5d6f81.tar.bz2
Merge "calling back SetupFaceLock to clean up temporary gallery"
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java52
1 files changed, 51 insertions, 1 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 81e7c34..3795a7c 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -23,6 +23,7 @@ import com.google.android.collect.Lists;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.Intent;
import android.os.FileObserver;
import android.os.IBinder;
import android.os.RemoteException;
@@ -125,6 +126,8 @@ public class LockPatternUtils {
private static FileObserver sPasswordObserver;
+ private static boolean mLastAttemptWasBiometric = false;
+
private static class PasswordFileObserver extends FileObserver {
public PasswordFileObserver(String path, int mask) {
super(path, mask);
@@ -371,7 +374,8 @@ public class LockPatternUtils {
/**
* Clear any lock pattern or password.
*/
- public void clearLock() {
+ public void clearLock(boolean isFallback) {
+ if(!isFallback) deleteGallery();
saveLockPassword(null, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
setLockPatternEnabled(false);
saveLockPattern(null);
@@ -390,6 +394,13 @@ public class LockPatternUtils {
}
/**
+ * Sets whether the last lockscreen setup attempt was biometric
+ */
+ public static void setLastAttemptWasBiometric(boolean val) {
+ mLastAttemptWasBiometric = val;
+ }
+
+ /**
* Determine if LockScreen can be disabled. This is used, for example, to tell if we should
* show LockScreen or go straight to the home screen.
*
@@ -408,6 +419,41 @@ public class LockPatternUtils {
}
/**
+ * Calls back SetupFaceLock to save the temporary gallery file if this is the backup lock.
+ * This doesn't have to verify that biometric is enabled because it's only called in that case
+ */
+ void moveTempGallery() {
+ Intent intent = new Intent().setClassName("com.android.facelock",
+ "com.android.facelock.SetupFaceLock");
+ intent.putExtra("moveTempGallery", true);
+ mContext.startActivity(intent);
+ }
+
+ /**
+ * Calls back SetupFaceLock to delete the temporary gallery file if this is the backup lock.
+ */
+ public void deleteTempGallery() {
+ //if(mLastAttemptWasBiometric) {
+ Intent intent = new Intent().setClassName("com.android.facelock",
+ "com.android.facelock.SetupFaceLock");
+ intent.putExtra("deleteTempGallery", true);
+ mContext.startActivity(intent);
+ //}
+ }
+
+ /**
+ * Calls back SetupFaceLock to delete the gallery file when the lock type is changed
+ */
+ void deleteGallery() {
+ if(isBiometricEnabled()) {
+ Intent intent = new Intent().setClassName("com.android.facelock",
+ "com.android.facelock.SetupFaceLock");
+ intent.putExtra("deleteGallery", true);
+ mContext.startActivity(intent);
+ }
+ }
+
+ /**
* Save a lock pattern.
* @param pattern The new pattern to save.
* @param isFallback Specifies if this is a fallback to biometric weak
@@ -431,11 +477,13 @@ public class LockPatternUtils {
keyStore.password(patternToString(pattern));
setBoolean(PATTERN_EVER_CHOSEN_KEY, true);
if (!isFallback) {
+ deleteGallery();
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
} else {
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
setLong(PASSWORD_TYPE_ALTERNATE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
+ moveTempGallery();
}
dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, pattern
.size(), 0, 0, 0, 0, 0, 0);
@@ -547,10 +595,12 @@ public class LockPatternUtils {
int computedQuality = computePasswordQuality(password);
if (!isFallback) {
+ deleteGallery();
setLong(PASSWORD_TYPE_KEY, Math.max(quality, computedQuality));
} else {
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
setLong(PASSWORD_TYPE_ALTERNATE_KEY, Math.max(quality, computedQuality));
+ moveTempGallery();
}
if (computedQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
int letters = 0;