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

Commit a604b5ab authored by Chandru's avatar Chandru
Browse files

Change KeyguardUpdateMonitorLogger to accept nullable params

Being conservative to avoid any other breakages due to null value in non-primitive Java types.
Adds @NonNull to some Java params.

Fixes: 254860286
Test: atest KeyguardUpdateMonitorTest
Change-Id: Ie0cfc5c45c8b8384ba01409af2d2bf974d1af730
parent b0d01823
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2429,7 +2429,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
     * Attempts to trigger active unlock from trust agent.
     */
    private void requestActiveUnlock(
            ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN requestOrigin,
            @NonNull ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN requestOrigin,
            String reason,
            boolean dismissKeyguard
    ) {
@@ -2459,7 +2459,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
     * Only dismisses the keyguard under certain conditions.
     */
    public void requestActiveUnlock(
            ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN requestOrigin,
            @NonNull ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN requestOrigin,
            String extraReason
    ) {
        final boolean canFaceBypass = isFaceEnrolled() && mKeyguardBypassController != null
@@ -2726,7 +2726,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        return shouldListen;
    }

    private void maybeLogListenerModelData(KeyguardListenModel model) {
    private void maybeLogListenerModelData(@NonNull KeyguardListenModel model) {
        mLogger.logKeyguardListenerModel(model);

        if (model instanceof KeyguardActiveUnlockModel) {
+10 −10
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ class KeyguardUpdateMonitorLogger @Inject constructor(

    fun log(@CompileTimeConstant msg: String, level: LogLevel) = logBuffer.log(TAG, level, msg)

    fun logActiveUnlockTriggered(reason: String) {
    fun logActiveUnlockTriggered(reason: String?) {
        logBuffer.log("ActiveUnlock", DEBUG,
                { str1 = reason },
                { "initiate active unlock triggerReason=$str1" })
@@ -101,14 +101,14 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
                { "Face authenticated for wrong user: $int1" })
    }

    fun logFaceAuthHelpMsg(msgId: Int, helpMsg: String) {
    fun logFaceAuthHelpMsg(msgId: Int, helpMsg: String?) {
        logBuffer.log(TAG, DEBUG, {
                    int1 = msgId
                    str1 = helpMsg
                }, { "Face help received, msgId: $int1 msg: $str1" })
    }

    fun logFaceAuthRequested(userInitiatedRequest: Boolean, reason: String) {
    fun logFaceAuthRequested(userInitiatedRequest: Boolean, reason: String?) {
        logBuffer.log(TAG, DEBUG, {
            bool1 = userInitiatedRequest
            str1 = reason
@@ -187,7 +187,7 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
                { "No Profile Owner or Device Owner supervision app found for User $int1" })
    }

    fun logPhoneStateChanged(newState: String) {
    fun logPhoneStateChanged(newState: String?) {
        logBuffer.log(TAG, DEBUG,
                { str1 = newState },
                { "handlePhoneStateChanged($str1)" })
@@ -240,7 +240,7 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
        }, { "handleServiceStateChange(subId=$int1, serviceState=$str1)" })
    }

    fun logServiceStateIntent(action: String, serviceState: ServiceState?, subId: Int) {
    fun logServiceStateIntent(action: String?, serviceState: ServiceState?, subId: Int) {
        logBuffer.log(TAG, VERBOSE, {
            str1 = action
            str2 = "$serviceState"
@@ -256,7 +256,7 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
        }, { "handleSimStateChange(subId=$int1, slotId=$int2, state=$long1)" })
    }

    fun logSimStateFromIntent(action: String, extraSimState: String, slotId: Int, subId: Int) {
    fun logSimStateFromIntent(action: String?, extraSimState: String?, slotId: Int, subId: Int) {
        logBuffer.log(TAG, VERBOSE, {
            str1 = action
            str2 = extraSimState
@@ -289,7 +289,7 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
                { "SubInfo:$str1" })
    }

    fun logTimeFormatChanged(newTimeFormat: String) {
    fun logTimeFormatChanged(newTimeFormat: String?) {
        logBuffer.log(TAG, DEBUG,
                { str1 = newTimeFormat },
                { "handleTimeFormatUpdate timeFormat=$str1" })
@@ -338,18 +338,18 @@ class KeyguardUpdateMonitorLogger @Inject constructor(

    fun logUserRequestedUnlock(
        requestOrigin: ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN,
        reason: String,
        reason: String?,
        dismissKeyguard: Boolean
    ) {
        logBuffer.log("ActiveUnlock", DEBUG, {
                    str1 = requestOrigin.name
                    str1 = requestOrigin?.name
                    str2 = reason
                    bool1 = dismissKeyguard
                }, { "reportUserRequestedUnlock origin=$str1 reason=$str2 dismissKeyguard=$bool1" })
    }

    fun logShowTrustGrantedMessage(
            message: String
            message: String?
    ) {
        logBuffer.log(TAG, DEBUG, {
            str1 = message