Merge "Logging of unlock attempts and device locking to security log"

This commit is contained in:
Michal Karpinski
2016-01-22 22:48:17 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ package com.android.keyguard;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
import android.auditing.SecurityLog;
import android.content.Context;
import android.os.UserHandle;
import android.util.AttributeSet;
@@ -423,6 +424,11 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
}
public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) {
if (SecurityLog.isLoggingEnabled()) {
SecurityLog.writeEvent(SecurityLog.TAG_DEVICE_UNLOCK_ATTEMPT,
(success ? 1 : 0),
mCurrentSecuritySelection.name());
}
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
if (success) {
monitor.clearFailedUnlockAttempts();

View File

@@ -24,6 +24,7 @@ import android.app.PendingIntent;
import android.app.SearchManager;
import android.app.StatusBarManager;
import android.app.trust.TrustManager;
import android.auditing.SecurityLog;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -1352,6 +1353,11 @@ public class KeyguardViewMediator extends SystemUI {
* @see #KEYGUARD_DONE
*/
private void handleKeyguardDone(boolean authenticated) {
if (SecurityLog.isLoggingEnabled()
&& mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) {
SecurityLog.writeEvent(SecurityLog.TAG_DEVICE_UNLOCK_ATTEMPT,
(authenticated ? 1 : 0), "Unknown");
}
if (DEBUG) Log.d(TAG, "handleKeyguardDone");
synchronized (this) {
resetKeyguardDonePendingLocked();
@@ -1463,6 +1469,10 @@ public class KeyguardViewMediator extends SystemUI {
* @see #SHOW
*/
private void handleShow(Bundle options) {
if (SecurityLog.isLoggingEnabled()
&& mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) {
SecurityLog.writeEvent(SecurityLog.TAG_DEVICE_LOCKED, "");
}
synchronized (KeyguardViewMediator.this) {
if (!mSystemReady) {
if (DEBUG) Log.d(TAG, "ignoring handleShow because system is not ready.");