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

Commit a58c35f3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add extra logs to Keyguard" into tm-qpr-dev am: 533edebe

parents cecb02a1 533edebe
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -466,6 +466,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    FACE_AUTH_TRIGGERED_TRUST_DISABLED);
        }

        mLogger.logTrustChanged(wasTrusted, enabled, userId);
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
@@ -487,6 +488,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    }
                }
            }

            if (message != null) {
                mLogger.logShowTrustGrantedMessage(message.toString());
            }
            for (int i = 0; i < mCallbacks.size(); i++) {
                KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
                if (cb != null) {
@@ -743,6 +748,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mFingerprintCancelSignal = null;
        updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
                FACE_AUTH_UPDATED_FP_AUTHENTICATED);
        mLogger.d("onFingerprintAuthenticated");
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
@@ -986,6 +992,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mFaceCancelSignal = null;
        updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
                FACE_AUTH_UPDATED_ON_FACE_AUTHENTICATED);
        mLogger.d("onFaceAuthenticated");
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
@@ -3445,6 +3452,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mUserFaceAuthenticated.clear();
        mTrustManager.clearAllBiometricRecognized(BiometricSourceType.FINGERPRINT, unlockedUser);
        mTrustManager.clearAllBiometricRecognized(BiometricSourceType.FACE, unlockedUser);
        mLogger.d("clearBiometricRecognized");

        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -3694,6 +3702,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    @Override
    public void dump(PrintWriter pw, String[] args) {
        pw.println("KeyguardUpdateMonitor state:");
        pw.println("  getUserHasTrust()=" + getUserHasTrust(getCurrentUser()));
        pw.println("  getUserUnlockedWithBiometric()="
                + getUserUnlockedWithBiometric(getCurrentUser()));
        pw.println("  SIM States:");
        for (SimData data : mSimDatas.values()) {
            pw.println("    " + data.toString());
+36 −0
Original line number Diff line number Diff line
@@ -340,4 +340,40 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
                    bool1 = dismissKeyguard
                }, { "reportUserRequestedUnlock origin=$str1 reason=$str2 dismissKeyguard=$bool1" })
    }

    fun logShowTrustGrantedMessage(
            message: String
    ) {
        logBuffer.log(TAG, DEBUG, {
            str1 = message
        }, { "showTrustGrantedMessage message$str1" })
    }

    fun logTrustChanged(
            wasTrusted: Boolean,
            isNowTrusted: Boolean,
            userId: Int
    ) {
        logBuffer.log(TAG, DEBUG, {
            bool1 = wasTrusted
            bool2 = isNowTrusted
            int1 = userId
        }, { "onTrustChanged[user=$int1] wasTrusted=$bool1 isNowTrusted=$bool2" })
    }

    fun logKeyguardStateUpdate(
            secure: Boolean,
            canDismissLockScreen: Boolean,
            trusted: Boolean,
            trustManaged: Boolean

    ) {
        logBuffer.log("KeyguardState", DEBUG, {
            bool1 = secure
            bool2 = canDismissLockScreen
            bool3 = trusted
            bool4 = trustManaged
        }, { "#update secure=$bool1 canDismissKeyguard=$bool2" +
                " trusted=$bool3 trustManaged=$bool4" })
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.logging.KeyguardUpdateMonitorLogger;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
@@ -60,6 +61,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
    private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
            new UpdateMonitorCallback();
    private final Lazy<KeyguardUnlockAnimationController> mUnlockAnimationControllerLazy;
    private final KeyguardUpdateMonitorLogger mLogger;

    private boolean mCanDismissLockScreen;
    private boolean mShowing;
@@ -107,8 +109,10 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            LockPatternUtils lockPatternUtils,
            Lazy<KeyguardUnlockAnimationController> keyguardUnlockAnimationController,
            KeyguardUpdateMonitorLogger logger,
            DumpManager dumpManager) {
        mContext = context;
        mLogger = logger;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mLockPatternUtils = lockPatternUtils;
        mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
@@ -245,6 +249,8 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
            mTrusted = trusted;
            mTrustManaged = trustManaged;
            mFaceAuthEnabled = faceAuthEnabled;
            mLogger.logKeyguardStateUpdate(
                    mSecure, mCanDismissLockScreen, mTrusted, mTrustManaged);
            notifyUnlockedChanged();
        }
        Trace.endSection();
+4 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import androidx.test.filters.SmallTest;

import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.logging.KeyguardUpdateMonitorLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
@@ -57,6 +58,8 @@ public class KeyguardStateControllerTest extends SysuiTestCase {
    private DumpManager mDumpManager;
    @Mock
    private Lazy<KeyguardUnlockAnimationController> mKeyguardUnlockAnimationControllerLazy;
    @Mock
    private KeyguardUpdateMonitorLogger mLogger;

    @Before
    public void setup() {
@@ -66,6 +69,7 @@ public class KeyguardStateControllerTest extends SysuiTestCase {
                mKeyguardUpdateMonitor,
                mLockPatternUtils,
                mKeyguardUnlockAnimationControllerLazy,
                mLogger,
                mDumpManager);
    }