FingerprintController: Make sure to reset the fingerprint mode when going to sleep

Fixes an issue where the fingerprint controller could be stuck indefinitely, causing
the status bar to be in the SHADE state instead of the KEYGUARD state.
Now reset when going to sleep.

Also adds logging.

May also fix a second bug where the scrims were stuck in a bad state.

Change-Id: I55d456c5d157f92758267f684de2bd216ef07d94
Fixes: 64598807
Bug: 64594986
Test: mp sysuig; unlock with fingerprint; verify transition still works
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
index cb96dea..316d229 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
@@ -32,6 +32,8 @@
 import com.android.systemui.keyguard.ScreenLifecycle;
 import com.android.systemui.keyguard.WakefulnessLifecycle;
 
+import java.io.PrintWriter;
+
 /**
  * Controller which coordinates all the fingerprint unlocking actions with the UI.
  */
@@ -264,6 +266,7 @@
 
     @Override
     public void onStartedGoingToSleep(int why) {
+        resetMode();
         mPendingAuthenticatedUserId = -1;
     }
 
@@ -346,6 +349,10 @@
     }
 
     public void finishKeyguardFadingAway() {
+        resetMode();
+    }
+
+    private void resetMode() {
         mMode = MODE_NONE;
         mStatusBarWindowManager.setForceDozeBrightness(false);
         if (mStatusBar.getNavigationBarView() != null) {
@@ -375,4 +382,10 @@
     public boolean hasScreenTurnedOnSinceAuthenticating() {
         return mHasScreenTurnedOnSinceAuthenticating;
     }
+
+    public void dump(PrintWriter pw) {
+        pw.println(" FingerprintUnlockController:");
+        pw.print("   mMode="); pw.println(mMode);
+        pw.print("   mWakeLock="); pw.println(mWakeLock);
+    }
 }