diff options
Diffstat (limited to 'core/java/android/util')
-rw-r--r-- | core/java/android/util/DebugUtils.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/util/DebugUtils.java b/core/java/android/util/DebugUtils.java index 56f389c..65fc35c 100644 --- a/core/java/android/util/DebugUtils.java +++ b/core/java/android/util/DebugUtils.java @@ -101,4 +101,23 @@ public class DebugUtils { return match; } + /** @hide */ + public static void buildShortClassTag(Object cls, StringBuilder out) { + if (cls == null) { + out.append("null"); + } else { + String simpleName = cls.getClass().getSimpleName(); + if (simpleName == null || simpleName.isEmpty()) { + simpleName = cls.getClass().getName(); + int end = simpleName.lastIndexOf('.'); + if (end > 0) { + simpleName = simpleName.substring(end+1); + } + } + out.append(simpleName); + out.append('{'); + out.append(Integer.toHexString(System.identityHashCode(cls))); + } + } + } |