summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard/src/com
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2014-08-06 16:41:21 +0200
committerJorim Jaggi <jjaggi@google.com>2014-08-06 16:41:21 +0200
commite7b1252e244eee31a0e4ae29135667ed26f1e4b2 (patch)
treef4b46d25e232c837605bafb260ab5659f0294dc8 /packages/Keyguard/src/com
parent7c7bc7f6917484250974c5da00af9ef756844b0a (diff)
downloadframeworks_base-e7b1252e244eee31a0e4ae29135667ed26f1e4b2.zip
frameworks_base-e7b1252e244eee31a0e4ae29135667ed26f1e4b2.tar.gz
frameworks_base-e7b1252e244eee31a0e4ae29135667ed26f1e4b2.tar.bz2
Implement face unlock running indicator on Keyguard.
Icon is still dummy. Bug: 16502879 Change-Id: Ibea1e594f322e919049a42a26ff858d2169415e7
Diffstat (limited to 'packages/Keyguard/src/com')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java24
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java5
2 files changed, 29 insertions, 0 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index e4d7850..58cbaba 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -83,6 +83,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static final int FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 3;
private static final int LOW_BATTERY_THRESHOLD = 20;
+ private static final String ACTION_FACE_UNLOCK_STARTED
+ = "com.android.facelock.FACE_UNLOCK_STARTED";
+ private static final String ACTION_FACE_UNLOCK_STOPPED
+ = "com.android.facelock.FACE_UNLOCK_STOPPED";
+
// Callback messages
private static final int MSG_TIME_UPDATE = 301;
private static final int MSG_BATTERY_UPDATE = 302;
@@ -107,6 +112,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322;
private static final int MSG_FINGERPRINT_PROCESSED = 323;
private static final int MSG_FINGERPRINT_ACQUIRED = 324;
+ private static final int MSG_FACE_UNLOCK_STATE_CHANGED = 325;
private static KeyguardUpdateMonitor sInstance;
@@ -211,6 +217,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
case MSG_FINGERPRINT_PROCESSED:
handleFingerprintProcessed(msg.arg1);
break;
+ case MSG_FACE_UNLOCK_STATE_CHANGED:
+ handleFaceUnlockStateChanged(msg.arg1 != 0);
+ break;
}
}
};
@@ -285,6 +294,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
}
}
+ private void handleFaceUnlockStateChanged(boolean running) {
+ for (int i = 0; i < mCallbacks.size(); i++) {
+ KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
+ if (cb != null) {
+ cb.onFaceUnlockStateChanged(running);
+ }
+ }
+ }
+
private boolean isTrustDisabled(int userId) {
final DevicePolicyManager dpm =
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
@@ -376,6 +394,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0), 0));
} else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
dispatchBootCompleted();
+ } else if (ACTION_FACE_UNLOCK_STARTED.equals(action)) {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_FACE_UNLOCK_STATE_CHANGED, 1, 0));
+ } else if (ACTION_FACE_UNLOCK_STOPPED.equals(action)) {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_FACE_UNLOCK_STATE_CHANGED, 0, 0));
}
}
};
@@ -588,6 +610,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
filter.addAction(Intent.ACTION_USER_REMOVED);
filter.addAction(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED);
+ filter.addAction(ACTION_FACE_UNLOCK_STARTED);
+ filter.addAction(ACTION_FACE_UNLOCK_STOPPED);
context.registerReceiver(mBroadcastReceiver, filter);
final IntentFilter bootCompleteFilter = new IntentFilter();
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 0aefa2d..4827e79 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -188,4 +188,9 @@ public class KeyguardUpdateMonitorCallback {
* Called when fingerprint is acquired but not yet recognized
*/
public void onFingerprintAcquired(int info) { }
+
+ /**
+ * Called when the state of face unlock changed.
+ */
+ public void onFaceUnlockStateChanged(boolean running) { }
}