Loading services/core/java/com/android/server/biometrics/AuthenticationStatsCollector.java +19 −7 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.PackageManager; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; import android.os.UserHandle; import android.util.Slog; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -54,6 +55,7 @@ public class AuthenticationStatsCollector { private final float mThreshold; private final int mModality; private boolean mPersisterInitialized = false; @NonNull private final Map<Integer, AuthenticationStats> mUserAuthenticationStatsMap; Loading Loading @@ -85,10 +87,16 @@ public class AuthenticationStatsCollector { } private void initializeUserAuthenticationStatsMap() { try { mAuthenticationStatsPersister = new AuthenticationStatsPersister(mContext); for (AuthenticationStats stats : mAuthenticationStatsPersister.getAllFrrStats(mModality)) { for (AuthenticationStats stats : mAuthenticationStatsPersister.getAllFrrStats(mModality)) { mUserAuthenticationStatsMap.put(stats.getUserId(), stats); } mPersisterInitialized = true; } catch (IllegalStateException e) { Slog.w(TAG, "Failed to initialize AuthenticationStatsPersister.", e); } } /** Update total authentication and rejected attempts. */ Loading @@ -108,7 +116,9 @@ public class AuthenticationStatsCollector { authenticationStats.authenticate(authenticated); if (mPersisterInitialized) { persistDataIfNeeded(userId); } sendNotificationIfNeeded(userId); } Loading Loading @@ -166,12 +176,14 @@ public class AuthenticationStatsCollector { } private void onUserRemoved(final int userId) { if (mAuthenticationStatsPersister == null) { if (!mPersisterInitialized) { initializeUserAuthenticationStatsMap(); } if (mPersisterInitialized) { mUserAuthenticationStatsMap.remove(userId); mAuthenticationStatsPersister.removeFrrStats(userId); } } /** * Only being used in tests. Callers should not make any changes to the returned Loading Loading
services/core/java/com/android/server/biometrics/AuthenticationStatsCollector.java +19 −7 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.PackageManager; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; import android.os.UserHandle; import android.util.Slog; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -54,6 +55,7 @@ public class AuthenticationStatsCollector { private final float mThreshold; private final int mModality; private boolean mPersisterInitialized = false; @NonNull private final Map<Integer, AuthenticationStats> mUserAuthenticationStatsMap; Loading Loading @@ -85,10 +87,16 @@ public class AuthenticationStatsCollector { } private void initializeUserAuthenticationStatsMap() { try { mAuthenticationStatsPersister = new AuthenticationStatsPersister(mContext); for (AuthenticationStats stats : mAuthenticationStatsPersister.getAllFrrStats(mModality)) { for (AuthenticationStats stats : mAuthenticationStatsPersister.getAllFrrStats(mModality)) { mUserAuthenticationStatsMap.put(stats.getUserId(), stats); } mPersisterInitialized = true; } catch (IllegalStateException e) { Slog.w(TAG, "Failed to initialize AuthenticationStatsPersister.", e); } } /** Update total authentication and rejected attempts. */ Loading @@ -108,7 +116,9 @@ public class AuthenticationStatsCollector { authenticationStats.authenticate(authenticated); if (mPersisterInitialized) { persistDataIfNeeded(userId); } sendNotificationIfNeeded(userId); } Loading Loading @@ -166,12 +176,14 @@ public class AuthenticationStatsCollector { } private void onUserRemoved(final int userId) { if (mAuthenticationStatsPersister == null) { if (!mPersisterInitialized) { initializeUserAuthenticationStatsMap(); } if (mPersisterInitialized) { mUserAuthenticationStatsMap.remove(userId); mAuthenticationStatsPersister.removeFrrStats(userId); } } /** * Only being used in tests. Callers should not make any changes to the returned Loading