Automatically trace messages on shared loopers.
There are a handful of looper threads in the system_process that
are shared by dozens of different internal services. To help track
down what these operations are, tag the processing of each message
with a string that tries describing where it originated from: the
class name of the Handler, and the message number or class name of the
Runnable.
Bug: 28046299
Change-Id: I409ec43fea8daaae4fd70df05d4fed929a7249ae
diff --git a/services/core/java/com/android/server/UiThread.java b/services/core/java/com/android/server/UiThread.java
index 0beb77f..c06afc2 100644
--- a/services/core/java/com/android/server/UiThread.java
+++ b/services/core/java/com/android/server/UiThread.java
@@ -17,6 +17,7 @@
package com.android.server;
import android.os.Handler;
+import android.os.Trace;
/**
* Shared singleton thread for showing UI. This is a foreground thread, and in
@@ -35,6 +36,7 @@
if (sInstance == null) {
sInstance = new UiThread();
sInstance.start();
+ sInstance.getLooper().setTraceTag(Trace.TRACE_TAG_ACTIVITY_MANAGER);
sHandler = new Handler(sInstance.getLooper());
}
}