From 0acc1931d364fabb32e2051f58bfbbc5f2505176 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 12 Apr 2013 17:49:17 -0700 Subject: Add a little more resource load tracing. Change-Id: Id797adb67ab411d5b1a1c223863d3bb4655d10b1 --- .../java/android/graphics/drawable/Drawable.java | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'graphics') diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index c90f400..d5183d5 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -17,6 +17,7 @@ package android.graphics.drawable; import android.graphics.Insets; +import android.os.Trace; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -745,7 +746,12 @@ public abstract class Drawable { * Create a drawable from an inputstream */ public static Drawable createFromStream(InputStream is, String srcName) { - return createFromResourceStream(null, null, is, srcName, null); + Trace.traceBegin(Trace.TRACE_TAG_RESOURCES, srcName != null ? srcName : "Unknown drawable"); + try { + return createFromResourceStream(null, null, is, srcName, null); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_RESOURCES); + } } /** @@ -754,7 +760,12 @@ public abstract class Drawable { */ public static Drawable createFromResourceStream(Resources res, TypedValue value, InputStream is, String srcName) { - return createFromResourceStream(res, value, is, srcName, null); + Trace.traceBegin(Trace.TRACE_TAG_RESOURCES, srcName != null ? srcName : "Unknown drawable"); + try { + return createFromResourceStream(res, value, is, srcName, null); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_RESOURCES); + } } /** @@ -900,9 +911,14 @@ public abstract class Drawable { return null; } - Bitmap bm = BitmapFactory.decodeFile(pathName); - if (bm != null) { - return drawableFromBitmap(null, bm, null, null, null, pathName); + Trace.traceBegin(Trace.TRACE_TAG_RESOURCES, pathName); + try { + Bitmap bm = BitmapFactory.decodeFile(pathName); + if (bm != null) { + return drawableFromBitmap(null, bm, null, null, null, pathName); + } + } finally { + Trace.traceEnd(Trace.TRACE_TAG_RESOURCES); } return null; -- cgit v1.1