diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2016-04-06 17:40:54 -0600 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2016-04-07 00:14:53 -0600 |
| commit | 74cd3de6f4889d54a3da930de5e7ad00b97f03e9 (patch) | |
| tree | d7785e17d2689827aafcb9310ab297f8804ed69d /core/java/android/os/Handler.java | |
| parent | feef8b62ee60c8418bd7238522c06098e61eecff (diff) | |
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
Diffstat (limited to 'core/java/android/os/Handler.java')
| -rw-r--r-- | core/java/android/os/Handler.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java index 878b7a0e8e10..3c7c962eaa12 100644 --- a/core/java/android/os/Handler.java +++ b/core/java/android/os/Handler.java @@ -231,6 +231,18 @@ public class Handler { mAsynchronous = async; } + /** {@hide} */ + public String getTraceName(Message message) { + final StringBuilder sb = new StringBuilder(); + sb.append(getClass().getName()).append(": "); + if (message.callback != null) { + sb.append(message.callback.getClass().getName()); + } else { + sb.append("#").append(message.what); + } + return sb.toString(); + } + /** * Returns a string representing the name of the specified message. * The default implementation will either return the class name of the @@ -739,8 +751,8 @@ public class Handler { message.callback.run(); } - final MessageQueue mQueue; final Looper mLooper; + final MessageQueue mQueue; final Callback mCallback; final boolean mAsynchronous; IMessenger mMessenger; |
