Selectively log some buffers
Excluded some very verbose buffers, and added annotations around status bar state to improve readability of traces. Bug: 207049735 Test: adb shell perfetto Change-Id: I00420b7048c1dfa00db7958d83b75a4964b32b8f
This commit is contained in:
@@ -66,11 +66,12 @@ import java.util.Locale
|
||||
* @param poolSize The maximum amount that the size of the buffer is allowed to flex in response to
|
||||
* sequential calls to [document] that aren't immediately followed by a matching call to [push].
|
||||
*/
|
||||
class LogBuffer(
|
||||
class LogBuffer @JvmOverloads constructor(
|
||||
private val name: String,
|
||||
private val maxLogs: Int,
|
||||
private val poolSize: Int,
|
||||
private val logcatEchoTracker: LogcatEchoTracker
|
||||
private val logcatEchoTracker: LogcatEchoTracker,
|
||||
private val systrace: Boolean = true
|
||||
) {
|
||||
init {
|
||||
if (maxLogs < poolSize) {
|
||||
@@ -175,6 +176,10 @@ class LogBuffer(
|
||||
buffer.removeFirst()
|
||||
}
|
||||
buffer.add(message as LogMessageImpl)
|
||||
if (systrace) {
|
||||
val messageStr = message.printer(message)
|
||||
Trace.instantForTrack(Trace.TRACE_TAG_APP, "UI Events", "$name - $messageStr")
|
||||
}
|
||||
if (logcatEchoTracker.isBufferLoggable(name, message.level) ||
|
||||
logcatEchoTracker.isTagLoggable(message.tag, message.level)) {
|
||||
echo(message)
|
||||
@@ -237,7 +242,6 @@ class LogBuffer(
|
||||
LogLevel.ERROR -> Log.e(message.tag, strMessage)
|
||||
LogLevel.WTF -> Log.wtf(message.tag, strMessage)
|
||||
}
|
||||
Trace.instantForTrack(Trace.TRACE_TAG_APP, "UI Events", strMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,13 @@ class LogBufferFactory @Inject constructor(
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun create(name: String, maxPoolSize: Int, flexSize: Int = 10): LogBuffer {
|
||||
val buffer = LogBuffer(name, poolLimit(maxPoolSize), flexSize, logcatEchoTracker)
|
||||
fun create(
|
||||
name: String,
|
||||
maxPoolSize: Int,
|
||||
flexSize: Int = 10,
|
||||
systrace: Boolean = true
|
||||
): LogBuffer {
|
||||
val buffer = LogBuffer(name, poolLimit(maxPoolSize), flexSize, logcatEchoTracker, systrace)
|
||||
dumpManager.registerBuffer(name, buffer)
|
||||
return buffer
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ public class LogModule {
|
||||
@SysUISingleton
|
||||
@NotificationLog
|
||||
public static LogBuffer provideNotificationsLogBuffer(LogBufferFactory factory) {
|
||||
return factory.create("NotifLog", 1000);
|
||||
return factory.create("NotifLog", 1000 /* maxPoolSize */,
|
||||
10 /* flexSize */, false /* systrace */);
|
||||
}
|
||||
|
||||
/** Provides a logging buffer for all logs related to the data layer of notifications. */
|
||||
@@ -65,7 +66,8 @@ public class LogModule {
|
||||
@SysUISingleton
|
||||
@NotificationSectionLog
|
||||
public static LogBuffer provideNotificationSectionLogBuffer(LogBufferFactory factory) {
|
||||
return factory.create("NotifSectionLog", 1000);
|
||||
return factory.create("NotifSectionLog", 1000 /* maxPoolSize */,
|
||||
10 /* flexSize */, false /* systrace */);
|
||||
}
|
||||
|
||||
/** Provides a logging buffer for all logs related to the data layer of notifications. */
|
||||
@@ -81,7 +83,8 @@ public class LogModule {
|
||||
@SysUISingleton
|
||||
@QSLog
|
||||
public static LogBuffer provideQuickSettingsLogBuffer(LogBufferFactory factory) {
|
||||
return factory.create("QSLog", 500);
|
||||
return factory.create("QSLog", 500 /* maxPoolSize */,
|
||||
10 /* flexSize */, false /* systrace */);
|
||||
}
|
||||
|
||||
/** Provides a logging buffer for {@link com.android.systemui.broadcast.BroadcastDispatcher} */
|
||||
@@ -89,7 +92,8 @@ public class LogModule {
|
||||
@SysUISingleton
|
||||
@BroadcastDispatcherLog
|
||||
public static LogBuffer provideBroadcastDispatcherLogBuffer(LogBufferFactory factory) {
|
||||
return factory.create("BroadcastDispatcherLog", 500);
|
||||
return factory.create("BroadcastDispatcherLog", 500 /* maxPoolSize */,
|
||||
10 /* flexSize */, false /* systrace */);
|
||||
}
|
||||
|
||||
/** Provides a logging buffer for all logs related to Toasts shown by SystemUI. */
|
||||
@@ -127,7 +131,8 @@ public class LogModule {
|
||||
@SysUISingleton
|
||||
@QSFragmentDisableLog
|
||||
public static LogBuffer provideQSFragmentDisableLogBuffer(LogBufferFactory factory) {
|
||||
return factory.create("QSFragmentDisableFlagsLog", 10);
|
||||
return factory.create("QSFragmentDisableFlagsLog", 10 /* maxPoolSize */,
|
||||
10 /* flexSize */, false /* systrace */);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
@@ -193,6 +194,7 @@ public class StatusBarStateControllerImpl implements
|
||||
mState = state;
|
||||
mUpcomingState = state;
|
||||
mUiEventLogger.log(StatusBarStateEvent.fromState(mState));
|
||||
Trace.instantForTrack(Trace.TRACE_TAG_APP, "UI Events", "StatusBarState " + tag);
|
||||
for (RankedListener rl : new ArrayList<>(mListeners)) {
|
||||
rl.mListener.onStateChanged(mState);
|
||||
}
|
||||
|
||||
@@ -171,6 +171,8 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
||||
if (mShowing == showing && mOccluded == occluded) return;
|
||||
mShowing = showing;
|
||||
mOccluded = occluded;
|
||||
Trace.instantForTrack(Trace.TRACE_TAG_APP, "UI Events",
|
||||
"Keyguard showing: " + showing + " occluded: " + occluded);
|
||||
notifyKeyguardChanged();
|
||||
|
||||
// Update the dismiss amount to the full 0f/1f if we explicitly show or hide the keyguard.
|
||||
|
||||
Reference in New Issue
Block a user