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

Commit ed5c8f02 authored by Michal Karpinski's avatar Michal Karpinski
Browse files

Log strength of auth method used into security log

As approved by Android Security team, added logging of
strength of auth method as well as logging of fingerprint
keyguard actions.

Bug: 26841997
Change-Id: Ic8e3f125f775a7585fe56003f4c6442390edea61
parent 00a6750d
Loading
Loading
Loading
Loading
+30 −4
Original line number Original line Diff line number Diff line
@@ -3022,14 +3022,40 @@ public class DevicePolicyManager {
        }
        }
    }
    }


    /**
     * @hide
     */
    public void reportFailedFingerprintAttempt(int userHandle) {
        if (mService != null) {
            try {
                mService.reportFailedFingerprintAttempt(userHandle);
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
        }
    }

    /**
     * @hide
     */
    public void reportSuccessfulFingerprintAttempt(int userHandle) {
        if (mService != null) {
            try {
                mService.reportSuccessfulFingerprintAttempt(userHandle);
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
        }
    }

    /**
    /**
     * Should be called when keyguard has been dismissed.
     * Should be called when keyguard has been dismissed.
     * @hide
     * @hide
     */
     */
    public void reportKeyguardDismissed() {
    public void reportKeyguardDismissed(int userHandle) {
        if (mService != null) {
        if (mService != null) {
            try {
            try {
                mService.reportKeyguardDismissed();
                mService.reportKeyguardDismissed(userHandle);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
            }
@@ -3040,10 +3066,10 @@ public class DevicePolicyManager {
     * Should be called when keyguard view has been shown to the user.
     * Should be called when keyguard view has been shown to the user.
     * @hide
     * @hide
     */
     */
    public void reportKeyguardSecured() {
    public void reportKeyguardSecured(int userHandle) {
        if (mService != null) {
        if (mService != null) {
            try {
            try {
                mService.reportKeyguardSecured();
                mService.reportKeyguardSecured(userHandle);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
                Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e);
            }
            }
+4 −3
Original line number Original line Diff line number Diff line
@@ -116,9 +116,10 @@ interface IDevicePolicyManager {
        int numbers, int symbols, int nonletter, int userHandle);
        int numbers, int symbols, int nonletter, int userHandle);
    void reportFailedPasswordAttempt(int userHandle);
    void reportFailedPasswordAttempt(int userHandle);
    void reportSuccessfulPasswordAttempt(int userHandle);
    void reportSuccessfulPasswordAttempt(int userHandle);

    void reportFailedFingerprintAttempt(int userHandle);
    void reportKeyguardDismissed();
    void reportSuccessfulFingerprintAttempt(int userHandle);
    void reportKeyguardSecured();
    void reportKeyguardDismissed(int userHandle);
    void reportKeyguardSecured(int userHandle);


    boolean setDeviceOwner(in ComponentName who, String ownerName, int userId);
    boolean setDeviceOwner(in ComponentName who, String ownerName, int userId);
    ComponentName getDeviceOwnerComponent(boolean callingUserOnly);
    ComponentName getDeviceOwnerComponent(boolean callingUserOnly);
+4 −2
Original line number Original line Diff line number Diff line
@@ -77,8 +77,10 @@ public class SecurityLog {
            SecurityLogTags.SECURITY_KEYGUARD_DISMISSED;
            SecurityLogTags.SECURITY_KEYGUARD_DISMISSED;
    /**
    /**
     * Indicate that there has been an authentication attempt to dismiss the keyguard. The log entry
     * Indicate that there has been an authentication attempt to dismiss the keyguard. The log entry
     * contains the attempt result (integer, 1 for successful, 0 for unsuccessful), accessible via
     * contains the following information about the attempt in order, accessible via
     * {@link SecurityEvent#getData()}}
     * {@link SecurityEvent#getData()}}: attempt result (integer, 1 for successful, 0 for
     * unsuccessful), strength of auth method (integer, 1 if strong auth method was used,
     * 0 otherwise)
     */
     */
    public static final int TAG_KEYGUARD_DISMISS_AUTH_ATTEMPT =
    public static final int TAG_KEYGUARD_DISMISS_AUTH_ATTEMPT =
            SecurityLogTags.SECURITY_KEYGUARD_DISMISS_AUTH_ATTEMPT;
            SecurityLogTags.SECURITY_KEYGUARD_DISMISS_AUTH_ATTEMPT;
+1 −1
Original line number Original line Diff line number Diff line
@@ -8,5 +8,5 @@ option java_package android.auditing
210004 security_adb_sync_send                   (path|3)
210004 security_adb_sync_send                   (path|3)
210005 security_app_process_start               (process|3),(start_time|2|3),(uid|1),(pid|1),(seinfo|3),(sha256|3)
210005 security_app_process_start               (process|3),(start_time|2|3),(uid|1),(pid|1),(seinfo|3),(sha256|3)
210006 security_keyguard_dismissed
210006 security_keyguard_dismissed
210007 security_keyguard_dismiss_auth_attempt   (success|1)
210007 security_keyguard_dismiss_auth_attempt   (success|1),(method_strength|1)
210008 security_keyguard_secured
210008 security_keyguard_secured
+23 −4
Original line number Original line Diff line number Diff line
@@ -475,6 +475,23 @@ public class KeyguardViewMediator extends SystemUI {
                    break;
                    break;
            }
            }
        }
        }

        @Override
        public void onFingerprintAuthFailed() {
            final int currentUser = KeyguardUpdateMonitor.getCurrentUser();
            if (mLockPatternUtils.isSecure(currentUser)) {
                mLockPatternUtils.getDevicePolicyManager().reportFailedFingerprintAttempt(
                        currentUser);
            }
        }

        @Override
        public void onFingerprintAuthenticated(int userId) {
            if (mLockPatternUtils.isSecure(userId)) {
                mLockPatternUtils.getDevicePolicyManager().reportSuccessfulFingerprintAttempt(
                        userId);
            }
        }
    };
    };


    ViewMediatorCallback mViewMediatorCallback = new ViewMediatorCallback() {
    ViewMediatorCallback mViewMediatorCallback = new ViewMediatorCallback() {
@@ -1370,8 +1387,9 @@ public class KeyguardViewMediator extends SystemUI {
     * @see #KEYGUARD_DONE
     * @see #KEYGUARD_DONE
     */
     */
    private void handleKeyguardDone(boolean authenticated) {
    private void handleKeyguardDone(boolean authenticated) {
        if (mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) {
        final int currentUser = KeyguardUpdateMonitor.getCurrentUser();
            mLockPatternUtils.getDevicePolicyManager().reportKeyguardDismissed();
        if (mLockPatternUtils.isSecure(currentUser)) {
            mLockPatternUtils.getDevicePolicyManager().reportKeyguardDismissed(currentUser);
        }
        }
        if (DEBUG) Log.d(TAG, "handleKeyguardDone");
        if (DEBUG) Log.d(TAG, "handleKeyguardDone");
        synchronized (this) {
        synchronized (this) {
@@ -1484,8 +1502,9 @@ public class KeyguardViewMediator extends SystemUI {
     * @see #SHOW
     * @see #SHOW
     */
     */
    private void handleShow(Bundle options) {
    private void handleShow(Bundle options) {
        if (mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) {
        final int currentUser = KeyguardUpdateMonitor.getCurrentUser();
            mLockPatternUtils.getDevicePolicyManager().reportKeyguardSecured();
        if (mLockPatternUtils.isSecure(currentUser)) {
            mLockPatternUtils.getDevicePolicyManager().reportKeyguardSecured(currentUser);
        }
        }
        synchronized (KeyguardViewMediator.this) {
        synchronized (KeyguardViewMediator.this) {
            if (!mSystemReady) {
            if (!mSystemReady) {
Loading