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

Commit 205fa2ac authored by Donghyun Cho's avatar Donghyun Cho
Browse files

Turn on HDMI-related logs conditionally for better debugging

This change will make debug messages from HDMI logger to be shown when
developers set log.tag.HDMI system property as DEBUG or VERBOSE. It will
allow much easier debugging for HDMI issues.

Bug: 27955073
Change-Id: If9ddd1150db6c647737190bc89a5534b3a173d66
parent 3527a2f1
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Build;
import android.os.SystemClock;
import android.util.Pair;
import android.util.Slog;
import android.util.Log;

import java.util.HashMap;

@@ -42,6 +43,7 @@ final class HdmiLogger {
    // Logging duration for same error message.
    private static final long ERROR_LOG_DURATTION_MILLIS = 20 * 1000;  // 20s

    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
    private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);

    private static final ThreadLocal<HdmiLogger> sLogger = new ThreadLocal<>();
@@ -83,11 +85,10 @@ final class HdmiLogger {
    }

    private void debugInternal(String logMessage) {
        if (true || IS_USER_BUILD) {
            return;
        }
        if (DEBUG) {
            Slog.d(TAG, logMessage);
        }
    }

    private static final String toLogString(String logMessage, Object[] objs) {
        if (objs.length > 0) {