summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-09-27 17:18:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-09-27 17:18:07 +0000
commita3dfb5f2c45933d76b9bd22ab65f79b3ee56cbeb (patch)
treef3f44d705685da8ef0b11711d9869aceeb61efd4 /core/java/android
parent5e7736022ecc48b1a2addc8b5e6771ac3d1719b8 (diff)
parent4bc790d2326a097ed0e8db789f9afc0ec552c722 (diff)
Merge "Integrate pooled lambda with systrace."
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/Handler.java4
-rw-r--r--core/java/android/os/TraceNameSupplier.java31
2 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java
index 9af9edae9a3f..45a9cf5ab869 100644
--- a/core/java/android/os/Handler.java
+++ b/core/java/android/os/Handler.java
@@ -295,6 +295,10 @@ public class Handler {
/** {@hide} */
@NonNull
public String getTraceName(@NonNull Message message) {
+ if (message.callback instanceof TraceNameSupplier) {
+ return ((TraceNameSupplier) message.callback).getTraceName();
+ }
+
final StringBuilder sb = new StringBuilder();
sb.append(getClass().getName()).append(": ");
if (message.callback != null) {
diff --git a/core/java/android/os/TraceNameSupplier.java b/core/java/android/os/TraceNameSupplier.java
new file mode 100644
index 000000000000..e4b3a4edce38
--- /dev/null
+++ b/core/java/android/os/TraceNameSupplier.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.os;
+
+import android.annotation.NonNull;
+
+/**
+ * Supplier for custom trace messages.
+ *
+ * @hide
+ */
+public interface TraceNameSupplier {
+
+ /**
+ * Gets the name used for trace messages.
+ */
+ @NonNull String getTraceName();
+}