Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 727aa9c2 authored by Michal Karpinski's avatar Michal Karpinski Committed by Android (Google) Code Review
Browse files

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

parents 731bf243 779aad94
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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();
+10 −0
Original line number Diff line number Diff line
@@ -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.");