Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +24 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; } } }; Loading Loading @@ -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); Loading Loading @@ -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)); } } }; Loading Loading @@ -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(); Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +5 −0 Original line number Diff line number Diff line Loading @@ -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) { } } packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +16 −7 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private LockPatternUtils mLockPatternUtils; private FlashlightController mFlashlightController; private PreviewInflater mPreviewInflater; private boolean mFaceUnlockRunning; public KeyguardBottomAreaView(Context context) { super(context); Loading Loading @@ -105,7 +106,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL updatePhoneVisibility(); mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); mUnlockMethodCache.addListener(this); updateTrust(); updateLockIcon(); setClipChildren(false); setClipToPadding(false); mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext)); Loading Loading @@ -226,21 +227,23 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); if (changedView == this && visibility == VISIBLE) { updateTrust(); updateLockIcon(); updateCameraVisibility(); } } private void updateTrust() { private void updateLockIcon() { if (getVisibility() != VISIBLE) { return; } int iconRes = mUnlockMethodCache.isMethodInsecure() ? R.drawable.ic_lock_open_24dp // TODO: Real icon for facelock. int iconRes = mFaceUnlockRunning ? R.drawable.ic_account_circle : mUnlockMethodCache.isMethodInsecure() ? R.drawable.ic_lock_open_24dp : R.drawable.ic_lock_24dp; mLockIcon.setImageResource(iconRes); boolean trustManaged = mUnlockMethodCache.isTrustManaged(); mLockIcon.setBackgroundResource(trustManaged ? R.drawable.trust_circle : 0); mLockIcon.setBackgroundResource(trustManaged && !mFaceUnlockRunning ? R.drawable.trust_circle : 0); } public KeyguardAffordanceView getPhoneView() { Loading Loading @@ -274,7 +277,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public void onMethodSecureChanged(boolean methodSecure) { updateTrust(); updateLockIcon(); updateCameraVisibility(); } Loading Loading @@ -308,5 +311,11 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL public void onUserSwitchComplete(int userId) { updateCameraVisibility(); } @Override public void onFaceUnlockStateChanged(boolean running) { mFaceUnlockRunning = running; updateLockIcon(); } }; } Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +24 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; } } }; Loading Loading @@ -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); Loading Loading @@ -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)); } } }; Loading Loading @@ -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(); Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +5 −0 Original line number Diff line number Diff line Loading @@ -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) { } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +16 −7 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private LockPatternUtils mLockPatternUtils; private FlashlightController mFlashlightController; private PreviewInflater mPreviewInflater; private boolean mFaceUnlockRunning; public KeyguardBottomAreaView(Context context) { super(context); Loading Loading @@ -105,7 +106,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL updatePhoneVisibility(); mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); mUnlockMethodCache.addListener(this); updateTrust(); updateLockIcon(); setClipChildren(false); setClipToPadding(false); mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext)); Loading Loading @@ -226,21 +227,23 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); if (changedView == this && visibility == VISIBLE) { updateTrust(); updateLockIcon(); updateCameraVisibility(); } } private void updateTrust() { private void updateLockIcon() { if (getVisibility() != VISIBLE) { return; } int iconRes = mUnlockMethodCache.isMethodInsecure() ? R.drawable.ic_lock_open_24dp // TODO: Real icon for facelock. int iconRes = mFaceUnlockRunning ? R.drawable.ic_account_circle : mUnlockMethodCache.isMethodInsecure() ? R.drawable.ic_lock_open_24dp : R.drawable.ic_lock_24dp; mLockIcon.setImageResource(iconRes); boolean trustManaged = mUnlockMethodCache.isTrustManaged(); mLockIcon.setBackgroundResource(trustManaged ? R.drawable.trust_circle : 0); mLockIcon.setBackgroundResource(trustManaged && !mFaceUnlockRunning ? R.drawable.trust_circle : 0); } public KeyguardAffordanceView getPhoneView() { Loading Loading @@ -274,7 +277,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public void onMethodSecureChanged(boolean methodSecure) { updateTrust(); updateLockIcon(); updateCameraVisibility(); } Loading Loading @@ -308,5 +311,11 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL public void onUserSwitchComplete(int userId) { updateCameraVisibility(); } @Override public void onFaceUnlockStateChanged(boolean running) { mFaceUnlockRunning = running; updateLockIcon(); } }; }