am 40fa4070: am 4a66bbf7: am 5f96eb0c: am 6fdb85d3: am 120fc2c7: Merge "Disable fingerprint when remotely reset by DPM" into mnc-dev

* commit '40fa4070c70d9ddde681b2fb28627b8a4889080e':
  Disable fingerprint when remotely reset by DPM
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 5183c35..55d85206 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -557,6 +557,7 @@
 
     private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
 
+        @Override
         public void onReceive(Context context, Intent intent) {
             final String action = intent.getAction();
             if (DEBUG) Log.d(TAG, "received broadcast " + action);
@@ -610,6 +611,7 @@
 
     private final BroadcastReceiver mBroadcastAllReceiver = new BroadcastReceiver() {
 
+        @Override
         public void onReceive(Context context, Intent intent) {
             final String action = intent.getAction();
             if (AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED.equals(action)) {
@@ -724,6 +726,7 @@
             return new SimData(state, slotId, subId);
         }
 
+        @Override
         public String toString() {
             return "SimData{state=" + simState + ",slotId=" + slotId + ",subId=" + subId + "}";
         }
@@ -939,7 +942,9 @@
     }
 
     private boolean shouldListenForFingerprint() {
-        return mKeyguardIsVisible && !mSwitchingUser;
+        return mKeyguardIsVisible && !mSwitchingUser &&
+                mTrustManager.hasUserAuthenticatedSinceBoot(
+                        ActivityManager.getCurrentUser());
     }
 
     private void startListeningForFingerprint() {
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index 07fc23f..43f4047 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -579,8 +579,14 @@
     private void clearUserHasAuthenticated(int userId) {
         if (userId == UserHandle.USER_ALL) {
             mUserHasAuthenticated.clear();
+            synchronized (mUserHasAuthenticatedSinceBoot) {
+                mUserHasAuthenticatedSinceBoot.clear();
+            }
         } else {
             mUserHasAuthenticated.put(userId, false);
+            synchronized (mUserHasAuthenticatedSinceBoot) {
+                mUserHasAuthenticatedSinceBoot.put(userId, false);
+            }
         }
     }