Clearer scanning state and debug logs

Always show scanning state, even on lock screen.
Also added some logs to make it easier to debug face auth.

Fixes: 133342103
Fixes: 133873875
Test: logcat
Test: manual
Change-Id: I1e5c1825a3fc33b5c9862b4f72a7652a89779514
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 873874f..26d3d86 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -111,6 +111,7 @@
     private static final String TAG = "KeyguardUpdateMonitor";
     private static final boolean DEBUG = KeyguardConstants.DEBUG;
     private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
+    private static final boolean DEBUG_FACE = true;
     private static final int LOW_BATTERY_THRESHOLD = 20;
 
     private static final String ACTION_FACE_UNLOCK_STARTED
@@ -182,6 +183,7 @@
      * Prudently disable lockscreen.
      */
     public static final boolean CORE_APPS_ONLY;
+
     static {
         try {
             CORE_APPS_ONLY = IPackageManager.Stub.asInterface(
@@ -734,6 +736,7 @@
         if (acquireInfo != FaceManager.FACE_ACQUIRED_GOOD) {
             return;
         }
+        if (DEBUG_FACE) Log.d(TAG, "Face acquired");
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -760,6 +763,7 @@
                 Log.d(TAG, "Face authentication disabled by DPM for userId: " + userId);
                 return;
             }
+            if (DEBUG_FACE) Log.d(TAG, "Face auth succeeded for user " + userId);
             onFaceAuthenticated(userId);
         } finally {
             setFaceRunningState(BIOMETRIC_STATE_STOPPED);
@@ -768,6 +772,7 @@
     }
 
     private void handleFaceHelp(int msgId, String helpString) {
+        if (DEBUG_FACE) Log.d(TAG, "Face help received: " + helpString);
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -786,6 +791,7 @@
     };
 
     private void handleFaceError(int msgId, String errString) {
+        if (DEBUG_FACE) Log.d(TAG, "Face error received: " + errString);
         if (msgId == FaceManager.FACE_ERROR_CANCELED
                 && mFaceRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING) {
             setFaceRunningState(BIOMETRIC_STATE_STOPPED);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 25bde3b..812c1bb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -741,13 +741,5 @@
                 updateIndication(false);
             }
         }
-
-        @Override
-        public void onKeyguardBouncerChanged(boolean bouncer) {
-            if (mLockIcon == null) {
-                return;
-            }
-            mLockIcon.setBouncerVisible(bouncer);
-        }
-    };
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index c7f778d..3143971 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -90,11 +90,9 @@
     private int mDensity;
     private boolean mPulsing;
     private boolean mDozing;
-    private boolean mBouncerVisible;
     private boolean mDocked;
     private boolean mLastDozing;
     private boolean mLastPulsing;
-    private boolean mLastBouncerVisible;
     private int mIconColor;
     private float mDozeAmount;
     private int mIconRes;
@@ -252,9 +250,9 @@
         int state = getState();
         mIsFaceUnlockState = state == STATE_SCANNING_FACE;
         if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing
-                || mLastScreenOn != mScreenOn || mLastBouncerVisible != mBouncerVisible || force) {
+                || mLastScreenOn != mScreenOn || force) {
             @LockAnimIndex final int lockAnimIndex = getAnimationIndexForTransition(mLastState,
-                    state, mLastPulsing, mPulsing, mLastDozing, mDozing, mBouncerVisible);
+                    state, mLastPulsing, mPulsing, mLastDozing, mDozing);
             boolean isAnim = lockAnimIndex != -1;
 
             int iconRes = isAnim ? getThemedAnimationResId(lockAnimIndex) : getIconForState(state);
@@ -302,7 +300,6 @@
             mLastScreenOn = mScreenOn;
             mLastDozing = mDozing;
             mLastPulsing = mPulsing;
-            mLastBouncerVisible = mBouncerVisible;
         }
 
         boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked);
@@ -371,8 +368,7 @@
     }
 
     private int getAnimationIndexForTransition(int oldState, int newState,
-            boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing,
-            boolean bouncerVisible) {
+            boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing) {
 
         // Never animate when screen is off
         if (dozing && !pulsing && !mWasPulsingOnThisFrame) {
@@ -391,7 +387,7 @@
             return UNLOCK;
         } else if (justLocked) {
             return LOCK;
-        } else if (newState == STATE_SCANNING_FACE && bouncerVisible) {
+        } else if (newState == STATE_SCANNING_FACE) {
             return SCANNING;
         } else if ((nowPulsing || turningOn) && newState != STATE_LOCK_OPEN) {
             return LOCK_IN;
@@ -496,17 +492,6 @@
         setImageTintList(ColorStateList.valueOf(color));
     }
 
-    /**
-     * If bouncer is visible or not.
-     */
-    public void setBouncerVisible(boolean bouncerVisible) {
-        if (mBouncerVisible == bouncerVisible) {
-            return;
-        }
-        mBouncerVisible = bouncerVisible;
-        update();
-    }
-
     @Override
     public void onDensityOrFontScaleChanged() {
         ViewGroup.LayoutParams lp = getLayoutParams();