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

Commit ae6346e3 authored by Michal Brzezinski's avatar Michal Brzezinski Committed by Michał Brzeziński
Browse files

Adding general KeyguardLogger and more logs to keyguard status bar

Extra logs to help with solving b/237743330. The logs will be removed after the bug is fixed, probably except dump section.
Adding extra info in bugreports using newly added KeyguardLogger and dumping more info to dumpsys.

Bug: 237743330
Test: generating bug report and checking more logs present
Change-Id: I37f3c53477f003d8a350f7bd9905f32e8de53d6f
parent 3826d3df
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
package com.android.keyguard.logging

import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel
import com.android.systemui.log.LogLevel.DEBUG
import com.android.systemui.log.LogLevel.ERROR
import com.android.systemui.log.LogLevel.VERBOSE
import com.android.systemui.log.LogLevel.WARNING
import com.android.systemui.log.MessageInitializer
import com.android.systemui.log.MessagePrinter
import com.android.systemui.log.dagger.KeyguardLog
import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject

private const val TAG = "KeyguardLog"

class KeyguardLogger @Inject constructor(@KeyguardLog private val buffer: LogBuffer) {
    fun d(@CompileTimeConstant msg: String) = log(msg, DEBUG)

    fun e(@CompileTimeConstant msg: String) = log(msg, ERROR)

    fun v(@CompileTimeConstant msg: String) = log(msg, VERBOSE)

    fun w(@CompileTimeConstant msg: String) = log(msg, WARNING)

    fun log(msg: String, level: LogLevel) = buffer.log(TAG, level, msg)

    private fun debugLog(messageInitializer: MessageInitializer, messagePrinter: MessagePrinter) {
        buffer.log(TAG, DEBUG, messageInitializer, messagePrinter)
    }

    // TODO: remove after b/237743330 is fixed
    fun logStatusBarCalculatedAlpha(alpha: Float) {
        debugLog({ double1 = alpha.toDouble() }, { "Calculated new alpha: $double1" })
    }

    // TODO: remove after b/237743330 is fixed
    fun logStatusBarExplicitAlpha(alpha: Float) {
        debugLog({ double1 = alpha.toDouble() }, { "new mExplicitAlpha value: $double1" })
    }

    // TODO: remove after b/237743330 is fixed
    fun logStatusBarAlphaVisibility(visibility: Int, alpha: Float, state: String) {
        debugLog(
            {
                int1 = visibility
                double1 = alpha.toDouble()
                str1 = state
            },
            { "changing visibility to $int1 with alpha $double1 in state: $str1" }
        )
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ class KeyguardUpdateMonitorLogger @Inject constructor(

    fun e(@CompileTimeConstant msg: String) = log(msg, ERROR)

    fun v(@CompileTimeConstant msg: String) = log(msg, ERROR)
    fun v(@CompileTimeConstant msg: String) = log(msg, VERBOSE)

    fun w(@CompileTimeConstant msg: String) = log(msg, WARNING)

+10 −0
Original line number Diff line number Diff line
package com.android.systemui.log.dagger

import javax.inject.Qualifier

/**
 * A [com.android.systemui.log.LogBuffer] for keyguard-related stuff. Should be used mostly for
 * adding temporary logs or logging from smaller classes when creating new separate log class might
 * be an overkill.
 */
@Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class KeyguardLog
+10 −0
Original line number Diff line number Diff line
@@ -344,4 +344,14 @@ public class LogModule {
    public static LogBuffer provideUdfpsLogBuffer(LogBufferFactory factory) {
        return factory.create("UdfpsLog", 1000);
    }

    /**
     * Provides a {@link LogBuffer} for general keyguard-related logs.
     */
    @Provides
    @SysUISingleton
    @KeyguardLog
    public static LogBuffer provideKeyguardLogBuffer(LogBufferFactory factory) {
        return factory.create("KeyguardLog", 250);
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -4684,6 +4684,8 @@ public final class NotificationPanelViewController extends PanelViewController {
                if (!animatingUnlockedShadeToKeyguard) {
                    // Only make the status bar visible if we're not animating the screen off, since
                    // we only want to be showing the clock/notifications during the animation.
                    mShadeLog.v("Updating keyguard status bar state to "
                            + (keyguardShowing ? "visible" : "invisible"));
                    mKeyguardStatusBarViewController.updateViewState(
                            /* alpha= */ 1f,
                            keyguardShowing ? View.VISIBLE : View.INVISIBLE);
Loading