Loading telecomm/java/android/telecom/Log.java +18 −1 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class Log { private static final Object sSingletonSync = new Object(); private static final Object sSingletonSync = new Object(); private static EventManager sEventManager; private static EventManager sEventManager; private static SessionManager sSessionManager; private static SessionManager sSessionManager; private static Object sLock = null; /** /** * Tracks whether user-activated extended logging is enabled. * Tracks whether user-activated extended logging is enabled. Loading Loading @@ -387,6 +388,19 @@ public class Log { ERROR = isLoggable(android.util.Log.ERROR); ERROR = isLoggable(android.util.Log.ERROR); } } /** * Sets the main telecom sync lock used within Telecom. This is used when building log messages * so that we can identify places in the code where we are doing something outside of the * Telecom lock. * @param lock The lock. */ public static void setLock(Object lock) { // Don't do lock monitoring on user builds. if (!Build.IS_USER) { sLock = lock; } } /** /** * If user enabled extended logging is enabled and the time limit has passed, disables the * If user enabled extended logging is enabled and the time limit has passed, disables the * extended logging. * extended logging. Loading Loading @@ -512,7 +526,10 @@ public class Log { args.length); args.length); msg = format + " (An error occurred while formatting the message.)"; msg = format + " (An error occurred while formatting the message.)"; } } return String.format(Locale.US, "%s: %s%s", prefix, msg, sessionPostfix); // If a lock was set, check if this thread holds that lock and output an emoji that lets // the developer know whether a log message came from within the Telecom lock or not. String isLocked = sLock != null ? (Thread.holdsLock(sLock) ? "\uD83D\uDD12" : "❗") : ""; return String.format(Locale.US, "%s: %s%s%s", prefix, msg, sessionPostfix, isLocked); } } /** /** Loading Loading
telecomm/java/android/telecom/Log.java +18 −1 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class Log { private static final Object sSingletonSync = new Object(); private static final Object sSingletonSync = new Object(); private static EventManager sEventManager; private static EventManager sEventManager; private static SessionManager sSessionManager; private static SessionManager sSessionManager; private static Object sLock = null; /** /** * Tracks whether user-activated extended logging is enabled. * Tracks whether user-activated extended logging is enabled. Loading Loading @@ -387,6 +388,19 @@ public class Log { ERROR = isLoggable(android.util.Log.ERROR); ERROR = isLoggable(android.util.Log.ERROR); } } /** * Sets the main telecom sync lock used within Telecom. This is used when building log messages * so that we can identify places in the code where we are doing something outside of the * Telecom lock. * @param lock The lock. */ public static void setLock(Object lock) { // Don't do lock monitoring on user builds. if (!Build.IS_USER) { sLock = lock; } } /** /** * If user enabled extended logging is enabled and the time limit has passed, disables the * If user enabled extended logging is enabled and the time limit has passed, disables the * extended logging. * extended logging. Loading Loading @@ -512,7 +526,10 @@ public class Log { args.length); args.length); msg = format + " (An error occurred while formatting the message.)"; msg = format + " (An error occurred while formatting the message.)"; } } return String.format(Locale.US, "%s: %s%s", prefix, msg, sessionPostfix); // If a lock was set, check if this thread holds that lock and output an emoji that lets // the developer know whether a log message came from within the Telecom lock or not. String isLocked = sLock != null ? (Thread.holdsLock(sLock) ? "\uD83D\uDD12" : "❗") : ""; return String.format(Locale.US, "%s: %s%s%s", prefix, msg, sessionPostfix, isLocked); } } /** /** Loading