Remove unused, obsolete debug code

All these features have either been abandonned and left un-maintained
for years or can be replaced by systrace.

Change-Id: I42e4579a8078744047e5fe08a7a15254970b09bc
diff --git a/api/16.txt b/api/16.txt
index 81efd34..6aab939 100644
--- a/api/16.txt
+++ b/api/16.txt
@@ -24512,14 +24512,14 @@
   public class ViewDebug {
     ctor public ViewDebug();
     method public static void dumpCapturedView(java.lang.String, java.lang.Object);
-    method public static void startHierarchyTracing(java.lang.String, android.view.View);
-    method public static void startRecyclerTracing(java.lang.String, android.view.View);
-    method public static void stopHierarchyTracing();
-    method public static void stopRecyclerTracing();
-    method public static void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
-    method public static void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
-    field public static final boolean TRACE_HIERARCHY = false;
-    field public static final boolean TRACE_RECYCLER = false;
+    method public static deprecated void startHierarchyTracing(java.lang.String, android.view.View);
+    method public static deprecated void startRecyclerTracing(java.lang.String, android.view.View);
+    method public static deprecated void stopHierarchyTracing();
+    method public static deprecated void stopRecyclerTracing();
+    method public static deprecated void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
+    method public static deprecated void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
+    field public static final deprecated boolean TRACE_HIERARCHY = false;
+    field public static final deprecated boolean TRACE_RECYCLER = false;
   }
 
   public static abstract class ViewDebug.CapturedViewProperty implements java.lang.annotation.Annotation {
@@ -24531,7 +24531,7 @@
   public static abstract class ViewDebug.FlagToString implements java.lang.annotation.Annotation {
   }
 
-  public static final class ViewDebug.HierarchyTraceType extends java.lang.Enum {
+  public static final deprecated class ViewDebug.HierarchyTraceType extends java.lang.Enum {
     method public static android.view.ViewDebug.HierarchyTraceType valueOf(java.lang.String);
     method public static final android.view.ViewDebug.HierarchyTraceType[] values();
     enum_constant public static final android.view.ViewDebug.HierarchyTraceType BUILD_CACHE;
@@ -24547,7 +24547,7 @@
   public static abstract class ViewDebug.IntToString implements java.lang.annotation.Annotation {
   }
 
-  public static final class ViewDebug.RecyclerTraceType extends java.lang.Enum {
+  public static final deprecated class ViewDebug.RecyclerTraceType extends java.lang.Enum {
     method public static android.view.ViewDebug.RecyclerTraceType valueOf(java.lang.String);
     method public static final android.view.ViewDebug.RecyclerTraceType[] values();
     enum_constant public static final android.view.ViewDebug.RecyclerTraceType BIND_VIEW;
diff --git a/api/current.txt b/api/current.txt
index 81efd34..6aab939 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -24512,14 +24512,14 @@
   public class ViewDebug {
     ctor public ViewDebug();
     method public static void dumpCapturedView(java.lang.String, java.lang.Object);
-    method public static void startHierarchyTracing(java.lang.String, android.view.View);
-    method public static void startRecyclerTracing(java.lang.String, android.view.View);
-    method public static void stopHierarchyTracing();
-    method public static void stopRecyclerTracing();
-    method public static void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
-    method public static void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
-    field public static final boolean TRACE_HIERARCHY = false;
-    field public static final boolean TRACE_RECYCLER = false;
+    method public static deprecated void startHierarchyTracing(java.lang.String, android.view.View);
+    method public static deprecated void startRecyclerTracing(java.lang.String, android.view.View);
+    method public static deprecated void stopHierarchyTracing();
+    method public static deprecated void stopRecyclerTracing();
+    method public static deprecated void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
+    method public static deprecated void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
+    field public static final deprecated boolean TRACE_HIERARCHY = false;
+    field public static final deprecated boolean TRACE_RECYCLER = false;
   }
 
   public static abstract class ViewDebug.CapturedViewProperty implements java.lang.annotation.Annotation {
@@ -24531,7 +24531,7 @@
   public static abstract class ViewDebug.FlagToString implements java.lang.annotation.Annotation {
   }
 
-  public static final class ViewDebug.HierarchyTraceType extends java.lang.Enum {
+  public static final deprecated class ViewDebug.HierarchyTraceType extends java.lang.Enum {
     method public static android.view.ViewDebug.HierarchyTraceType valueOf(java.lang.String);
     method public static final android.view.ViewDebug.HierarchyTraceType[] values();
     enum_constant public static final android.view.ViewDebug.HierarchyTraceType BUILD_CACHE;
@@ -24547,7 +24547,7 @@
   public static abstract class ViewDebug.IntToString implements java.lang.annotation.Annotation {
   }
 
-  public static final class ViewDebug.RecyclerTraceType extends java.lang.Enum {
+  public static final deprecated class ViewDebug.RecyclerTraceType extends java.lang.Enum {
     method public static android.view.ViewDebug.RecyclerTraceType valueOf(java.lang.String);
     method public static final android.view.ViewDebug.RecyclerTraceType[] values();
     enum_constant public static final android.view.ViewDebug.RecyclerTraceType BIND_VIEW;
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 8cd8900..cb53422 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -645,10 +645,6 @@
         String process = null;
         
         String cmd = nextArgRequired();
-        if ("looper".equals(cmd)) {
-            cmd = nextArgRequired();
-            profileType = 1;
-        }
 
         if ("start".equals(cmd)) {
             start = true;
@@ -1295,8 +1291,8 @@
                 "       am broadcast <INTENT>\n" +
                 "       am instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]\n" +
                 "               [--no-window-animation] <COMPONENT>\n" +
-                "       am profile [looper] start <PROCESS> <FILE>\n" +
-                "       am profile [looper] stop [<PROCESS>]\n" +
+                "       am profile start <PROCESS> <FILE>\n" +
+                "       am profile stop [<PROCESS>]\n" +
                 "       am dumpheap [flags] <PROCESS> <FILE>\n" +
                 "       am set-debug-app [-w] [--persistent] <PACKAGE>\n" +
                 "       am clear-debug-app\n" +
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b29035d..33e639e 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3751,9 +3751,6 @@
         if (start) {
             try {
                 switch (profileType) {
-                    case 1:
-                        ViewDebug.startLooperProfiling(pcd.path, pcd.fd.getFileDescriptor());
-                        break;
                     default:                        
                         mProfiler.setProfiler(pcd.path, pcd.fd);
                         mProfiler.autoStopProfiler = false;
@@ -3772,9 +3769,6 @@
             }
         } else {
             switch (profileType) {
-                case 1:
-                    ViewDebug.stopLooperProfiling();
-                    break;
                 default:
                     mProfiler.stopProfiling();
                     break;
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index a06aadb..02135bc 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -127,29 +127,17 @@
                 return;
             }
 
-            long wallStart = 0;
-            long threadStart = 0;
-
             // This must be in a local variable, in case a UI event sets the logger
             Printer logging = me.mLogging;
             if (logging != null) {
                 logging.println(">>>>> Dispatching to " + msg.target + " " +
                         msg.callback + ": " + msg.what);
-                wallStart = SystemClock.currentTimeMicro();
-                threadStart = SystemClock.currentThreadTimeMicro();
             }
 
             msg.target.dispatchMessage(msg);
 
             if (logging != null) {
-                long wallTime = SystemClock.currentTimeMicro() - wallStart;
-                long threadTime = SystemClock.currentThreadTimeMicro() - threadStart;
-
                 logging.println("<<<<< Finished to " + msg.target + " " + msg.callback);
-                if (logging instanceof Profiler) {
-                    ((Profiler) logging).profile(msg, wallStart, wallTime,
-                            threadStart, threadTime);
-                }
             }
 
             // Make sure that during the course of dispatching the
@@ -290,12 +278,4 @@
     public String toString() {
         return "Looper{" + Integer.toHexString(System.identityHashCode(this)) + "}";
     }
-
-    /**
-     * @hide
-     */
-    public static interface Profiler {
-        void profile(Message message, long wallStart, long wallTime,
-                long threadStart, long threadTime);
-    }
 }
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index e25e2ef..f986d15 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -647,15 +647,10 @@
                 Log.d(LOG_TAG, "Disabling v-sync");
             }
 
-            //noinspection PointlessBooleanExpression,ConstantConditions
-            if (!ViewDebug.DEBUG_LATENCY) {
-                property = SystemProperties.get(PROFILE_PROPERTY, "false");
-                mProfileEnabled = "true".equalsIgnoreCase(property);
-                if (mProfileEnabled) {
-                    Log.d(LOG_TAG, "Profiling hardware renderer");
-                }
-            } else {
-                mProfileEnabled = true;
+            property = SystemProperties.get(PROFILE_PROPERTY, "false");
+            mProfileEnabled = "true".equalsIgnoreCase(property);
+            if (mProfileEnabled) {
+                Log.d(LOG_TAG, "Profiling hardware renderer");
             }
 
             if (mProfileEnabled) {
@@ -1132,11 +1127,6 @@
                             float total = (now - getDisplayListStartTime) * 0.000001f;
                             //noinspection PointlessArithmeticExpression
                             mProfileData[mProfileCurrentFrame] = total;
-
-                            if (ViewDebug.DEBUG_LATENCY) {
-                                Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- getDisplayList() took " +
-                                        total + "ms");
-                            }
                         }
 
                         if (displayList != null) {
@@ -1152,11 +1142,6 @@
                                 long now = System.nanoTime();
                                 float total = (now - drawDisplayListStartTime) * 0.000001f;
                                 mProfileData[mProfileCurrentFrame + 1] = total;
-
-                                if (ViewDebug.DEBUG_LATENCY) {
-                                    Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- drawDisplayList() took " +
-                                            total + "ms, status=" + status);
-                                }
                             }
 
                             handleFunctorStatus(attachInfo, status);
@@ -1198,11 +1183,6 @@
                         long now = System.nanoTime();
                         float total = (now - eglSwapBuffersStartTime) * 0.000001f;
                         mProfileData[mProfileCurrentFrame + 2] = total;
-
-                        if (ViewDebug.DEBUG_LATENCY) {
-                            Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- eglSwapBuffers() took " +
-                                    total + "ms");
-                        }
                     }
 
                     checkEglErrors();
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 6d60797..6adf656 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -9912,10 +9912,6 @@
      * @param dirty the rectangle representing the bounds of the dirty region
      */
     public void invalidate(Rect dirty) {
-        if (ViewDebug.TRACE_HIERARCHY) {
-            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
-        }
-
         if (skipInvalidate()) {
             return;
         }
@@ -9959,10 +9955,6 @@
      * @param b the bottom position of the dirty region
      */
     public void invalidate(int l, int t, int r, int b) {
-        if (ViewDebug.TRACE_HIERARCHY) {
-            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
-        }
-
         if (skipInvalidate()) {
             return;
         }
@@ -10015,10 +10007,6 @@
      * View's contents or dimensions have not changed.
      */
     void invalidate(boolean invalidateCache) {
-        if (ViewDebug.TRACE_HIERARCHY) {
-            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
-        }
-
         if (skipInvalidate()) {
             return;
         }
@@ -12391,10 +12379,6 @@
                 mDrawingCache == null : mUnscaledDrawingCache == null)) {
             mCachingFailed = false;
 
-            if (ViewDebug.TRACE_HIERARCHY) {
-                ViewDebug.trace(this, ViewDebug.HierarchyTraceType.BUILD_CACHE);
-            }
-
             int width = mRight - mLeft;
             int height = mBottom - mTop;
 
@@ -12514,9 +12498,6 @@
 
             // Fast path for layouts with no backgrounds
             if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
-                if (ViewDebug.TRACE_HIERARCHY) {
-                    ViewDebug.trace(this, ViewDebug.HierarchyTraceType.DRAW);
-                }
                 mPrivateFlags &= ~DIRTY_MASK;
                 dispatchDraw(canvas);
             } else {
@@ -13130,9 +13111,6 @@
                 if (!hasDisplayList) {
                     // Fast path for layouts with no backgrounds
                     if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
-                        if (ViewDebug.TRACE_HIERARCHY) {
-                            ViewDebug.trace(parent, ViewDebug.HierarchyTraceType.DRAW);
-                        }
                         mPrivateFlags &= ~DIRTY_MASK;
                         dispatchDraw(canvas);
                     } else {
@@ -13205,10 +13183,6 @@
      * @param canvas The Canvas to which the View is rendered.
      */
     public void draw(Canvas canvas) {
-        if (ViewDebug.TRACE_HIERARCHY) {
-            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.DRAW);
-        }
-
         final int privateFlags = mPrivateFlags;
         final boolean dirtyOpaque = (privateFlags & DIRTY_MASK) == DIRTY_OPAQUE &&
                 (mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState);
@@ -13552,10 +13526,6 @@
         int oldR = mRight;
         boolean changed = setFrame(l, t, r, b);
         if (changed || (mPrivateFlags & LAYOUT_REQUIRED) == LAYOUT_REQUIRED) {
-            if (ViewDebug.TRACE_HIERARCHY) {
-                ViewDebug.trace(this, ViewDebug.HierarchyTraceType.ON_LAYOUT);
-            }
-
             onLayout(changed, l, t, r, b);
             mPrivateFlags &= ~LAYOUT_REQUIRED;
 
@@ -14811,60 +14781,6 @@
     }
 
     /**
-     * @param consistency The type of consistency. See ViewDebug for more information.
-     *
-     * @hide
-     */
-    protected boolean dispatchConsistencyCheck(int consistency) {
-        return onConsistencyCheck(consistency);
-    }
-
-    /**
-     * Method that subclasses should implement to check their consistency. The type of
-     * consistency check is indicated by the bit field passed as a parameter.
-     *
-     * @param consistency The type of consistency. See ViewDebug for more information.
-     *
-     * @throws IllegalStateException if the view is in an inconsistent state.
-     *
-     * @hide
-     */
-    protected boolean onConsistencyCheck(int consistency) {
-        boolean result = true;
-
-        final boolean checkLayout = (consistency & ViewDebug.CONSISTENCY_LAYOUT) != 0;
-        final boolean checkDrawing = (consistency & ViewDebug.CONSISTENCY_DRAWING) != 0;
-
-        if (checkLayout) {
-            if (getParent() == null) {
-                result = false;
-                android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
-                        "View " + this + " does not have a parent.");
-            }
-
-            if (mAttachInfo == null) {
-                result = false;
-                android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
-                        "View " + this + " is not attached to a window.");
-            }
-        }
-
-        if (checkDrawing) {
-            // Do not check the DIRTY/DRAWN flags because views can call invalidate()
-            // from their draw() method
-
-            if ((mPrivateFlags & DRAWN) != DRAWN &&
-                    (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) {
-                result = false;
-                android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
-                        "View " + this + " was invalidated but its drawing cache is valid.");
-            }
-        }
-
-        return result;
-    }
-
-    /**
      * Prints information about this view in the log output, with the tag
      * {@link #VIEW_LOG_TAG}.
      *
@@ -14977,10 +14893,6 @@
      * tree.
      */
     public void requestLayout() {
-        if (ViewDebug.TRACE_HIERARCHY) {
-            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.REQUEST_LAYOUT);
-        }
-
         mPrivateFlags |= FORCE_LAYOUT;
         mPrivateFlags |= INVALIDATED;
 
@@ -15031,10 +14943,6 @@
             // first clears the measured dimension flag
             mPrivateFlags &= ~MEASURED_DIMENSION_SET;
 
-            if (ViewDebug.TRACE_HIERARCHY) {
-                ViewDebug.trace(this, ViewDebug.HierarchyTraceType.ON_MEASURE);
-            }
-
             // measure ourselves, this should set the measured dimension flag back
             onMeasure(widthMeasureSpec, heightMeasureSpec);
 
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index cb37a1c..2233ca9 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -22,24 +22,14 @@
 import android.graphics.Canvas;
 import android.graphics.Rect;
 import android.os.Debug;
-import android.os.Environment;
-import android.os.Looper;
-import android.os.Message;
-import android.os.ParcelFileDescriptor;
 import android.os.RemoteException;
-import android.os.SystemClock;
 import android.util.DisplayMetrics;
 import android.util.Log;
-import android.util.Printer;
 
 import java.io.BufferedOutputStream;
 import java.io.BufferedWriter;
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
@@ -51,14 +41,8 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.FileChannel;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -67,55 +51,18 @@
  */
 public class ViewDebug {
     /**
-     * Log tag used to log errors related to the consistency of the view hierarchy.
-     *
-     * @hide
+     * @deprecated This flag is now unused
      */
-    public static final String CONSISTENCY_LOG_TAG = "ViewConsistency";
-
-    /**
-     * Flag indicating the consistency check should check layout-related properties.
-     *
-     * @hide
-     */
-    public static final int CONSISTENCY_LAYOUT = 0x1;
-
-    /**
-     * Flag indicating the consistency check should check drawing-related properties.
-     *
-     * @hide
-     */
-    public static final int CONSISTENCY_DRAWING = 0x2;
-
-    /**
-     * Enables or disables view hierarchy tracing. Any invoker of
-     * {@link #trace(View, android.view.ViewDebug.HierarchyTraceType)} should first
-     * check that this value is set to true as not to affect performance.
-     */
+    @Deprecated
     public static final boolean TRACE_HIERARCHY = false;
 
     /**
-     * Enables or disables view recycler tracing. Any invoker of
-     * {@link #trace(View, android.view.ViewDebug.RecyclerTraceType, int[])} should first
-     * check that this value is set to true as not to affect performance.
+     * @deprecated This flag is now unused
      */
+    @Deprecated
     public static final boolean TRACE_RECYCLER = false;
 
     /**
-     * Profiles drawing times in the events log.
-     *
-     * @hide
-     */
-    public static final boolean DEBUG_PROFILE_DRAWING = false;
-
-    /**
-     * Profiles layout times in the events log.
-     *
-     * @hide
-     */
-    public static final boolean DEBUG_PROFILE_LAYOUT = false;
-
-    /**
      * Enables detailed logging of drag/drop operations.
      * @hide
      */
@@ -141,33 +88,6 @@
     public static final String DEBUG_LATENCY_TAG = "ViewLatency";
 
     /**
-     * Enables detailed logging of accessibility focus operations.
-     * @hide
-     */
-    public static final boolean DEBUG_ACCESSIBILITY_FOCUS = false;
-
-    /**
-     * Tag for logging of accessibility focus operations
-     * @hide
-     */
-    public static final String DEBUG_ACCESSIBILITY_FOCUS_TAG = "AccessibilityFocus";
-
-    /**
-     * <p>Enables or disables views consistency check. Even when this property is enabled,
-     * view consistency checks happen only if {@link false} is set
-     * to true. The value of this property can be configured externally in one of the
-     * following files:</p>
-     * <ul>
-     *  <li>/system/debug.prop</li>
-     *  <li>/debug.prop</li>
-     *  <li>/data/debug.prop</li>
-     * </ul>
-     * @hide
-     */
-    @Debug.DebugProperty
-    public static boolean consistencyCheckEnabled = false;
-
-    /**
      * This annotation can be used to mark fields and methods to be dumped by
      * the view server. Only non-void methods with no arguments can be annotated
      * by this annotation.
@@ -373,8 +293,9 @@
     private static HashMap<AccessibleObject, ExportedProperty> sAnnotations;
 
     /**
-     * Defines the type of hierarhcy trace to output to the hierarchy traces file.
+     * @deprecated This enum is now unused
      */
+    @Deprecated
     public enum HierarchyTraceType {
         INVALIDATE,
         INVALIDATE_CHILD,
@@ -386,13 +307,10 @@
         BUILD_CACHE
     }
 
-    private static BufferedWriter sHierarchyTraces;
-    private static ViewRootImpl sHierarchyRoot;
-    private static String sHierarchyTracePrefix;
-
     /**
-     * Defines the type of recycler trace to output to the recycler traces file.
+     * @deprecated This enum is now unused
      */
+    @Deprecated
     public enum RecyclerTraceType {
         NEW_VIEW,
         BIND_VIEW,
@@ -402,21 +320,6 @@
         MOVE_FROM_ACTIVE_TO_SCRAP_HEAP
     }
 
-    private static class RecyclerTrace {
-        public int view;
-        public RecyclerTraceType type;
-        public int position;
-        public int indexOnScreen;
-    }
-
-    private static View sRecyclerOwnerView;
-    private static List<View> sRecyclerViews;
-    private static List<RecyclerTrace> sRecyclerTraces;
-    private static String sRecyclerTracePrefix;
-
-    private static final ThreadLocal<LooperProfiler> sLooperProfilerStorage =
-            new ThreadLocal<LooperProfiler>();
-
     /**
      * Returns the number of instanciated Views.
      *
@@ -440,511 +343,50 @@
     }
 
     /**
-     * Starts profiling the looper associated with the current thread.
-     * You must call {@link #stopLooperProfiling} to end profiling
-     * and obtain the traces. Both methods must be invoked on the
-     * same thread.
-     * 
-     * @hide
+     * @deprecated This method is now unused and invoking it is a no-op
      */
-    public static void startLooperProfiling(String path, FileDescriptor fileDescriptor) {
-        if (sLooperProfilerStorage.get() == null) {
-            LooperProfiler profiler = new LooperProfiler(path, fileDescriptor);
-            sLooperProfilerStorage.set(profiler);
-            Looper.myLooper().setMessageLogging(profiler);
-        }
-    }    
-
-    /**
-     * Stops profiling the looper associated with the current thread.
-     * 
-     * @see #startLooperProfiling(String, java.io.FileDescriptor) 
-     * 
-     * @hide
-     */
-    public static void stopLooperProfiling() {
-        LooperProfiler profiler = sLooperProfilerStorage.get();
-        if (profiler != null) {
-            sLooperProfilerStorage.remove();
-            Looper.myLooper().setMessageLogging(null);
-            profiler.save();
-        }
-    }
-
-    private static class LooperProfiler implements Looper.Profiler, Printer {
-        private static final String LOG_TAG = "LooperProfiler";
-
-        private static final int TRACE_VERSION_NUMBER = 3;
-        private static final int ACTION_EXIT_METHOD = 0x1;
-        private static final int HEADER_SIZE = 32;
-        private static final String HEADER_MAGIC = "SLOW";
-        private static final short HEADER_RECORD_SIZE = (short) 14;
-
-        private final long mTraceWallStart;
-        private final long mTraceThreadStart;
-        
-        private final ArrayList<Entry> mTraces = new ArrayList<Entry>(512);
-
-        private final HashMap<String, Integer> mTraceNames = new HashMap<String, Integer>(32);
-        private int mTraceId = 0;
-
-        private final String mPath;
-        private ParcelFileDescriptor mFileDescriptor;
-
-        LooperProfiler(String path, FileDescriptor fileDescriptor) {
-            mPath = path;
-            try {
-                mFileDescriptor = ParcelFileDescriptor.dup(fileDescriptor);
-            } catch (IOException e) {
-                Log.e(LOG_TAG, "Could not write trace file " + mPath, e);
-                throw new RuntimeException(e);
-            }
-            mTraceWallStart = SystemClock.currentTimeMicro();
-            mTraceThreadStart = SystemClock.currentThreadTimeMicro();            
-        }
-
-        @Override
-        public void println(String x) {
-            // Ignore messages
-        }
-
-        @Override
-        public void profile(Message message, long wallStart, long wallTime,
-                long threadStart, long threadTime) {
-            Entry entry = new Entry();
-            entry.traceId = getTraceId(message);
-            entry.wallStart = wallStart;
-            entry.wallTime = wallTime;
-            entry.threadStart = threadStart;
-            entry.threadTime = threadTime;
-
-            mTraces.add(entry);
-        }
-
-        private int getTraceId(Message message) {
-            String name = message.getTarget().getMessageName(message);
-            Integer traceId = mTraceNames.get(name);
-            if (traceId == null) {
-                traceId = mTraceId++ << 4;
-                mTraceNames.put(name, traceId);
-            }
-            return traceId;
-        }
-
-        void save() {
-            // Don't block the UI thread
-            new Thread(new Runnable() {
-                @Override
-                public void run() {
-                    saveTraces();
-                }
-            }, "LooperProfiler[" + mPath + "]").start();
-        }
-
-        private void saveTraces() {
-            FileOutputStream fos = new FileOutputStream(mFileDescriptor.getFileDescriptor());
-            DataOutputStream out = new DataOutputStream(new BufferedOutputStream(fos));
-
-            try {
-                writeHeader(out, mTraceWallStart, mTraceNames, mTraces);
-                out.flush();
-
-                writeTraces(fos, out.size(), mTraceWallStart, mTraceThreadStart, mTraces);
-
-                Log.d(LOG_TAG, "Looper traces ready: " + mPath);
-            } catch (IOException e) {
-                Log.e(LOG_TAG, "Could not write trace file " + mPath, e);
-            } finally {
-                try {
-                    out.close();
-                } catch (IOException e) {
-                    Log.e(LOG_TAG, "Could not write trace file " + mPath, e);
-                }
-                try {
-                    mFileDescriptor.close();
-                } catch (IOException e) {
-                    Log.e(LOG_TAG, "Could not write trace file " + mPath, e);
-                }
-            }
-        }
-        
-        private static void writeTraces(FileOutputStream out, long offset, long wallStart,
-                long threadStart, ArrayList<Entry> entries) throws IOException {
-    
-            FileChannel channel = out.getChannel();
-    
-            // Header
-            ByteBuffer buffer = ByteBuffer.allocateDirect(HEADER_SIZE);
-            buffer.put(HEADER_MAGIC.getBytes());
-            buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);
-            buffer.putShort((short) TRACE_VERSION_NUMBER);    // version
-            buffer.putShort((short) HEADER_SIZE);             // offset to data
-            buffer.putLong(wallStart);                        // start time in usec
-            buffer.putShort(HEADER_RECORD_SIZE);              // size of a record in bytes
-            // padding to 32 bytes
-            for (int i = 0; i < HEADER_SIZE - 18; i++) {
-                buffer.put((byte) 0);
-            }
-    
-            buffer.flip();
-            channel.position(offset).write(buffer);
-            
-            buffer = ByteBuffer.allocateDirect(14).order(ByteOrder.LITTLE_ENDIAN);
-            for (Entry entry : entries) {
-                buffer.putShort((short) 1);   // we simulate only one thread
-                buffer.putInt(entry.traceId); // entering method
-                buffer.putInt((int) (entry.threadStart - threadStart));
-                buffer.putInt((int) (entry.wallStart - wallStart));
-    
-                buffer.flip();
-                channel.write(buffer);
-                buffer.clear();
-    
-                buffer.putShort((short) 1);
-                buffer.putInt(entry.traceId | ACTION_EXIT_METHOD); // exiting method
-                buffer.putInt((int) (entry.threadStart + entry.threadTime - threadStart));
-                buffer.putInt((int) (entry.wallStart + entry.wallTime - wallStart));
-    
-                buffer.flip();
-                channel.write(buffer);
-                buffer.clear();
-            }
-    
-            channel.close();
-        }
-    
-        private static void writeHeader(DataOutputStream out, long start,
-                HashMap<String, Integer> names, ArrayList<Entry> entries) throws IOException {
-    
-            Entry last = entries.get(entries.size() - 1);
-            long wallTotal = (last.wallStart + last.wallTime) - start;
-    
-            startSection("version", out);
-            addValue(null, Integer.toString(TRACE_VERSION_NUMBER), out);
-            addValue("data-file-overflow", "false", out);
-            addValue("clock", "dual", out);
-            addValue("elapsed-time-usec", Long.toString(wallTotal), out);
-            addValue("num-method-calls", Integer.toString(entries.size()), out);
-            addValue("clock-call-overhead-nsec", "1", out);
-            addValue("vm", "dalvik", out);
-    
-            startSection("threads", out);
-            addThreadId(1, "main", out);
-    
-            startSection("methods", out);
-            addMethods(names, out);
-    
-            startSection("end", out);
-        }
-    
-        private static void addMethods(HashMap<String, Integer> names, DataOutputStream out)
-                throws IOException {
-    
-            for (Map.Entry<String, Integer> name : names.entrySet()) {
-                out.writeBytes(String.format("0x%08x\tEventQueue\t%s\t()V\tLooper\t-2\n",
-                        name.getValue(), name.getKey()));
-            }
-        }
-    
-        private static void addThreadId(int id, String name, DataOutputStream out)
-                throws IOException {
-
-            out.writeBytes(Integer.toString(id) + '\t' + name + '\n');
-        }
-    
-        private static void addValue(String name, String value, DataOutputStream out)
-                throws IOException {
-    
-            if (name != null) {
-                out.writeBytes(name + "=");
-            }
-            out.writeBytes(value + '\n');
-        }
-    
-        private static void startSection(String name, DataOutputStream out) throws IOException {
-            out.writeBytes("*" + name + '\n');
-        }
-
-        static class Entry {
-            int traceId;
-            long wallStart;
-            long wallTime;
-            long threadStart;
-            long threadTime;
-        }
-    }
-
-    /**
-     * Outputs a trace to the currently opened recycler traces. The trace records the type of
-     * recycler action performed on the supplied view as well as a number of parameters.
-     *
-     * @param view the view to trace
-     * @param type the type of the trace
-     * @param parameters parameters depending on the type of the trace
-     */
+    @Deprecated
+    @SuppressWarnings({ "UnusedParameters", "deprecation" })
     public static void trace(View view, RecyclerTraceType type, int... parameters) {
-        if (sRecyclerOwnerView == null || sRecyclerViews == null) {
-            return;
-        }
-
-        if (!sRecyclerViews.contains(view)) {
-            sRecyclerViews.add(view);
-        }
-
-        final int index = sRecyclerViews.indexOf(view);
-
-        RecyclerTrace trace = new RecyclerTrace();
-        trace.view = index;
-        trace.type = type;
-        trace.position = parameters[0];
-        trace.indexOnScreen = parameters[1];
-
-        sRecyclerTraces.add(trace);
     }
 
     /**
-     * Starts tracing the view recycler of the specified view. The trace is identified by a prefix,
-     * used to build the traces files names: <code>/EXTERNAL/view-recycler/PREFIX.traces</code> and
-     * <code>/EXTERNAL/view-recycler/PREFIX.recycler</code>.
-     *
-     * Only one view recycler can be traced at the same time. After calling this method, any
-     * other invocation will result in a <code>IllegalStateException</code> unless
-     * {@link #stopRecyclerTracing()} is invoked before.
-     *
-     * Traces files are created only after {@link #stopRecyclerTracing()} is invoked.
-     *
-     * This method will return immediately if TRACE_RECYCLER is false.
-     *
-     * @param prefix the traces files name prefix
-     * @param view the view whose recycler must be traced
-     *
-     * @see #stopRecyclerTracing()
-     * @see #trace(View, android.view.ViewDebug.RecyclerTraceType, int[])
+     * @deprecated This method is now unused and invoking it is a no-op
      */
+    @Deprecated
+    @SuppressWarnings("UnusedParameters")
     public static void startRecyclerTracing(String prefix, View view) {
-        //noinspection PointlessBooleanExpression,ConstantConditions
-        if (!TRACE_RECYCLER) {
-            return;
-        }
-
-        if (sRecyclerOwnerView != null) {
-            throw new IllegalStateException("You must call stopRecyclerTracing() before running" +
-                " a new trace!");
-        }
-
-        sRecyclerTracePrefix = prefix;
-        sRecyclerOwnerView = view;
-        sRecyclerViews = new ArrayList<View>();
-        sRecyclerTraces = new LinkedList<RecyclerTrace>();
     }
 
     /**
-     * Stops the current view recycer tracing.
-     *
-     * Calling this method creates the file <code>/EXTERNAL/view-recycler/PREFIX.traces</code>
-     * containing all the traces (or method calls) relative to the specified view's recycler.
-     *
-     * Calling this method creates the file <code>/EXTERNAL/view-recycler/PREFIX.recycler</code>
-     * containing all of the views used by the recycler of the view supplied to
-     * {@link #startRecyclerTracing(String, View)}.
-     *
-     * This method will return immediately if TRACE_RECYCLER is false.
-     *
-     * @see #startRecyclerTracing(String, View)
-     * @see #trace(View, android.view.ViewDebug.RecyclerTraceType, int[])
+     * @deprecated This method is now unused and invoking it is a no-op
      */
+    @Deprecated
+    @SuppressWarnings("UnusedParameters")
     public static void stopRecyclerTracing() {
-        //noinspection PointlessBooleanExpression,ConstantConditions
-        if (!TRACE_RECYCLER) {
-            return;
-        }
-
-        if (sRecyclerOwnerView == null || sRecyclerViews == null) {
-            throw new IllegalStateException("You must call startRecyclerTracing() before" +
-                " stopRecyclerTracing()!");
-        }
-
-        File recyclerDump = new File(Environment.getExternalStorageDirectory(), "view-recycler/");
-        //noinspection ResultOfMethodCallIgnored
-        recyclerDump.mkdirs();
-
-        recyclerDump = new File(recyclerDump, sRecyclerTracePrefix + ".recycler");
-        try {
-            final BufferedWriter out = new BufferedWriter(new FileWriter(recyclerDump), 8 * 1024);
-
-            for (View view : sRecyclerViews) {
-                final String name = view.getClass().getName();
-                out.write(name);
-                out.newLine();
-            }
-
-            out.close();
-        } catch (IOException e) {
-            Log.e("View", "Could not dump recycler content");
-            return;
-        }
-
-        recyclerDump = new File(Environment.getExternalStorageDirectory(), "view-recycler/");
-        recyclerDump = new File(recyclerDump, sRecyclerTracePrefix + ".traces");
-        try {
-            if (recyclerDump.exists()) {
-                //noinspection ResultOfMethodCallIgnored
-                recyclerDump.delete();
-            }
-            final FileOutputStream file = new FileOutputStream(recyclerDump);
-            final DataOutputStream out = new DataOutputStream(file);
-
-            for (RecyclerTrace trace : sRecyclerTraces) {
-                out.writeInt(trace.view);
-                out.writeInt(trace.type.ordinal());
-                out.writeInt(trace.position);
-                out.writeInt(trace.indexOnScreen);
-                out.flush();
-            }
-
-            out.close();
-        } catch (IOException e) {
-            Log.e("View", "Could not dump recycler traces");
-            return;
-        }
-
-        sRecyclerViews.clear();
-        sRecyclerViews = null;
-
-        sRecyclerTraces.clear();
-        sRecyclerTraces = null;
-
-        sRecyclerOwnerView = null;
     }
 
     /**
-     * Outputs a trace to the currently opened traces file. The trace contains the class name
-     * and instance's hashcode of the specified view as well as the supplied trace type.
-     *
-     * @param view the view to trace
-     * @param type the type of the trace
+     * @deprecated This method is now unused and invoking it is a no-op
      */
+    @Deprecated
+    @SuppressWarnings({ "UnusedParameters", "deprecation" })
     public static void trace(View view, HierarchyTraceType type) {
-        if (sHierarchyTraces == null) {
-            return;
-        }
-
-        try {
-            sHierarchyTraces.write(type.name());
-            sHierarchyTraces.write(' ');
-            sHierarchyTraces.write(view.getClass().getName());
-            sHierarchyTraces.write('@');
-            sHierarchyTraces.write(Integer.toHexString(view.hashCode()));
-            sHierarchyTraces.newLine();
-        } catch (IOException e) {
-            Log.w("View", "Error while dumping trace of type " + type + " for view " + view);
-        }
     }
 
     /**
-     * Starts tracing the view hierarchy of the specified view. The trace is identified by a prefix,
-     * used to build the traces files names: <code>/EXTERNAL/view-hierarchy/PREFIX.traces</code> and
-     * <code>/EXTERNAL/view-hierarchy/PREFIX.tree</code>.
-     *
-     * Only one view hierarchy can be traced at the same time. After calling this method, any
-     * other invocation will result in a <code>IllegalStateException</code> unless
-     * {@link #stopHierarchyTracing()} is invoked before.
-     *
-     * Calling this method creates the file <code>/EXTERNAL/view-hierarchy/PREFIX.traces</code>
-     * containing all the traces (or method calls) relative to the specified view's hierarchy.
-     *
-     * This method will return immediately if TRACE_HIERARCHY is false.
-     *
-     * @param prefix the traces files name prefix
-     * @param view the view whose hierarchy must be traced
-     *
-     * @see #stopHierarchyTracing()
-     * @see #trace(View, android.view.ViewDebug.HierarchyTraceType)
+     * @deprecated This method is now unused and invoking it is a no-op
      */
+    @Deprecated
+    @SuppressWarnings("UnusedParameters")
     public static void startHierarchyTracing(String prefix, View view) {
-        //noinspection PointlessBooleanExpression,ConstantConditions
-        if (!TRACE_HIERARCHY) {
-            return;
-        }
-
-        if (sHierarchyRoot != null) {
-            throw new IllegalStateException("You must call stopHierarchyTracing() before running" +
-                " a new trace!");
-        }
-
-        File hierarchyDump = new File(Environment.getExternalStorageDirectory(), "view-hierarchy/");
-        //noinspection ResultOfMethodCallIgnored
-        hierarchyDump.mkdirs();
-
-        hierarchyDump = new File(hierarchyDump, prefix + ".traces");
-        sHierarchyTracePrefix = prefix;
-
-        try {
-            sHierarchyTraces = new BufferedWriter(new FileWriter(hierarchyDump), 8 * 1024);
-        } catch (IOException e) {
-            Log.e("View", "Could not dump view hierarchy");
-            return;
-        }
-
-        sHierarchyRoot = view.getViewRootImpl();
     }
 
     /**
-     * Stops the current view hierarchy tracing. This method closes the file
-     * <code>/EXTERNAL/view-hierarchy/PREFIX.traces</code>.
-     *
-     * Calling this method creates the file <code>/EXTERNAL/view-hierarchy/PREFIX.tree</code>
-     * containing the view hierarchy of the view supplied to
-     * {@link #startHierarchyTracing(String, View)}.
-     *
-     * This method will return immediately if TRACE_HIERARCHY is false.
-     *
-     * @see #startHierarchyTracing(String, View)
-     * @see #trace(View, android.view.ViewDebug.HierarchyTraceType)
+     * @deprecated This method is now unused and invoking it is a no-op
      */
+    @Deprecated
     public static void stopHierarchyTracing() {
-        //noinspection PointlessBooleanExpression,ConstantConditions
-        if (!TRACE_HIERARCHY) {
-            return;
-        }
-
-        if (sHierarchyRoot == null || sHierarchyTraces == null) {
-            throw new IllegalStateException("You must call startHierarchyTracing() before" +
-                " stopHierarchyTracing()!");
-        }
-
-        try {
-            sHierarchyTraces.close();
-        } catch (IOException e) {
-            Log.e("View", "Could not write view traces");
-        }
-        sHierarchyTraces = null;
-
-        File hierarchyDump = new File(Environment.getExternalStorageDirectory(), "view-hierarchy/");
-        //noinspection ResultOfMethodCallIgnored
-        hierarchyDump.mkdirs();
-        hierarchyDump = new File(hierarchyDump, sHierarchyTracePrefix + ".tree");
-
-        BufferedWriter out;
-        try {
-            out = new BufferedWriter(new FileWriter(hierarchyDump), 8 * 1024);
-        } catch (IOException e) {
-            Log.e("View", "Could not dump view hierarchy");
-            return;
-        }
-
-        View view = sHierarchyRoot.getView();
-        if (view instanceof ViewGroup) {
-            ViewGroup group = (ViewGroup) view;
-            dumpViewHierarchy(group, out, 0);
-            try {
-                out.close();
-            } catch (IOException e) {
-                Log.e("View", "Could not dump view hierarchy");
-            }
-        }
-
-        sHierarchyRoot = null;
     }
 
     static void dispatchCommand(View view, String command, String parameters,
@@ -1725,38 +1167,6 @@
         }
     }
 
-    private static void dumpViewHierarchy(ViewGroup group, BufferedWriter out, int level) {
-        if (!dumpView(group, out, level)) {
-            return;
-        }
-
-        final int count = group.getChildCount();
-        for (int i = 0; i < count; i++) {
-            final View view = group.getChildAt(i);
-            if (view instanceof ViewGroup) {
-                dumpViewHierarchy((ViewGroup) view, out, level + 1);
-            } else {
-                dumpView(view, out, level + 1);
-            }
-        }
-    }
-
-    private static boolean dumpView(Object view, BufferedWriter out, int level) {
-        try {
-            for (int i = 0; i < level; i++) {
-                out.write(' ');
-            }
-            out.write(view.getClass().getName());
-            out.write('@');
-            out.write(Integer.toHexString(view.hashCode()));
-            out.newLine();
-        } catch (IOException e) {
-            Log.w("View", "Error while dumping hierarchy tree");
-            return false;
-        }
-        return true;
-    }
-
     private static Field[] capturedViewGetPropertyFields(Class<?> klass) {
         if (mCapturedViewFieldsForClasses == null) {
             mCapturedViewFieldsForClasses = new HashMap<Class<?>, Field[]>();
@@ -1863,7 +1273,6 @@
     }
 
     private static String capturedViewExportFields(Object obj, Class<?> klass, String prefix) {
-
         if (obj == null) {
             return "null";
         }
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index b95ca5e..421109f 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -3949,10 +3949,6 @@
      * the view hierarchy.
      */
     public final void invalidateChild(View child, final Rect dirty) {
-        if (ViewDebug.TRACE_HIERARCHY) {
-            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE_CHILD);
-        }
-
         ViewParent parent = this;
 
         final AttachInfo attachInfo = mAttachInfo;
@@ -4045,10 +4041,6 @@
      * does not intersect with this ViewGroup's bounds.
      */
     public ViewParent invalidateChildInParent(final int[] location, final Rect dirty) {
-        if (ViewDebug.TRACE_HIERARCHY) {
-            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE_CHILD_IN_PARENT);
-        }
-
         if ((mPrivateFlags & DRAWN) == DRAWN ||
                 (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) {
             if ((mGroupFlags & (FLAG_OPTIMIZE_INVALIDATE | FLAG_ANIMATION_DONE)) !=
@@ -4631,61 +4623,6 @@
     }
 
     /**
-     * @hide
-     */
-    @Override
-    protected boolean dispatchConsistencyCheck(int consistency) {
-        boolean result = super.dispatchConsistencyCheck(consistency);
-
-        final int count = mChildrenCount;
-        final View[] children = mChildren;
-        for (int i = 0; i < count; i++) {
-            if (!children[i].dispatchConsistencyCheck(consistency)) result = false;
-        }
-
-        return result;
-    }
-
-    /**
-     * @hide
-     */
-    @Override
-    protected boolean onConsistencyCheck(int consistency) {
-        boolean result = super.onConsistencyCheck(consistency);
-
-        final boolean checkLayout = (consistency & ViewDebug.CONSISTENCY_LAYOUT) != 0;
-        final boolean checkDrawing = (consistency & ViewDebug.CONSISTENCY_DRAWING) != 0;
-
-        if (checkLayout) {
-            final int count = mChildrenCount;
-            final View[] children = mChildren;
-            for (int i = 0; i < count; i++) {
-                if (children[i].getParent() != this) {
-                    result = false;
-                    android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
-                            "View " + children[i] + " has no parent/a parent that is not " + this);
-                }
-            }
-        }
-
-        if (checkDrawing) {
-            // If this group is dirty, check that the parent is dirty as well
-            if ((mPrivateFlags & DIRTY_MASK) != 0) {
-                final ViewParent parent = getParent();
-                if (parent != null && !(parent instanceof ViewRootImpl)) {
-                    if ((((View) parent).mPrivateFlags & DIRTY_MASK) == 0) {
-                        result = false;
-                        android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
-                                "ViewGroup " + this + " is dirty but its parent is not: " + this);
-                    }
-                }
-            }
-        }
-
-        return result;
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 90179ff..449507d 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -55,7 +55,6 @@
 import android.os.Trace;
 import android.util.AndroidRuntimeException;
 import android.util.DisplayMetrics;
-import android.util.EventLog;
 import android.util.Log;
 import android.util.Slog;
 import android.util.TypedValue;
@@ -1865,28 +1864,12 @@
                     host.getMeasuredWidth() + ", " + host.getMeasuredHeight() + ")");
         }
 
-        final long startTime;
-        if (ViewDebug.DEBUG_PROFILE_LAYOUT) {
-            startTime = SystemClock.elapsedRealtime();
-        }
         Trace.traceBegin(Trace.TRACE_TAG_VIEW, "layout");
         try {
             host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());
         } finally {
             Trace.traceEnd(Trace.TRACE_TAG_VIEW);
         }
-
-        if (ViewDebug.DEBUG_PROFILE_LAYOUT) {
-            EventLog.writeEvent(60001, SystemClock.elapsedRealtime() - startTime);
-        }
-
-        if (false && ViewDebug.consistencyCheckEnabled) {
-            if (!host.dispatchConsistencyCheck(ViewDebug.CONSISTENCY_LAYOUT)) {
-                throw new IllegalStateException("The view hierarchy is an inconsistent state,"
-                        + "please refer to the logs with the tag "
-                        + ViewDebug.CONSISTENCY_LOG_TAG + " for more infomation.");
-            }
-        }
     }
 
     public void requestTransparentRegion(View child) {
@@ -2272,11 +2255,6 @@
                 //canvas.drawARGB(255, 255, 0, 0);
             }
 
-            long startTime = 0L;
-            if (ViewDebug.DEBUG_PROFILE_DRAWING) {
-                startTime = SystemClock.elapsedRealtime();
-            }
-
             // If this bitmap's format includes an alpha channel, we
             // need to clear it before drawing so that the child will
             // properly re-composite its drawing on a transparent
@@ -2329,14 +2307,6 @@
                     attachInfo.mIgnoreDirtyState = false;
                 }
             }
-
-            if (false && ViewDebug.consistencyCheckEnabled) {
-                mView.dispatchConsistencyCheck(ViewDebug.CONSISTENCY_DRAWING);
-            }
-
-            if (ViewDebug.DEBUG_PROFILE_DRAWING) {
-                EventLog.writeEvent(60000, SystemClock.elapsedRealtime() - startTime);
-            }
         } finally {
             final long unlockCanvasAndPostStartTime;
             if (ViewDebug.DEBUG_LATENCY) {
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 8643e9e..a8e1043 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2216,31 +2216,17 @@
 
         View child;
         if (scrapView != null) {
-            if (ViewDebug.TRACE_RECYCLER) {
-                ViewDebug.trace(scrapView, ViewDebug.RecyclerTraceType.RECYCLE_FROM_SCRAP_HEAP,
-                        position, -1);
-            }
-
             child = mAdapter.getView(position, scrapView, this);
 
             if (child.getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
                 child.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
             }
 
-            if (ViewDebug.TRACE_RECYCLER) {
-                ViewDebug.trace(child, ViewDebug.RecyclerTraceType.BIND_VIEW,
-                        position, getChildCount());
-            }
-
             if (child != scrapView) {
                 mRecycler.addScrapView(scrapView, position);
                 if (mCacheColorHint != 0) {
                     child.setDrawingCacheBackgroundColor(mCacheColorHint);
                 }
-                if (ViewDebug.TRACE_RECYCLER) {
-                    ViewDebug.trace(scrapView, ViewDebug.RecyclerTraceType.MOVE_TO_SCRAP_HEAP,
-                            position, -1);
-                }
             } else {
                 isScrap[0] = true;
                 child.dispatchFinishTemporaryDetach();
@@ -2255,10 +2241,6 @@
             if (mCacheColorHint != 0) {
                 child.setDrawingCacheBackgroundColor(mCacheColorHint);
             }
-            if (ViewDebug.TRACE_RECYCLER) {
-                ViewDebug.trace(child, ViewDebug.RecyclerTraceType.NEW_VIEW,
-                        position, getChildCount());
-            }
         }
 
         if (mAdapterHasStableIds) {
@@ -4939,12 +4921,6 @@
                     int position = firstPosition + i;
                     if (position >= headerViewsCount && position < footerViewsStart) {
                         mRecycler.addScrapView(child, position);
-
-                        if (ViewDebug.TRACE_RECYCLER) {
-                            ViewDebug.trace(child,
-                                    ViewDebug.RecyclerTraceType.MOVE_TO_SCRAP_HEAP,
-                                    firstPosition + i, -1);
-                        }
                     }
                 }
             }
@@ -4963,12 +4939,6 @@
                     int position = firstPosition + i;
                     if (position >= headerViewsCount && position < footerViewsStart) {
                         mRecycler.addScrapView(child, position);
-
-                        if (ViewDebug.TRACE_RECYCLER) {
-                            ViewDebug.trace(child,
-                                    ViewDebug.RecyclerTraceType.MOVE_TO_SCRAP_HEAP,
-                                    firstPosition + i, -1);
-                        }
                     }
                 }
             }
@@ -5912,63 +5882,6 @@
         removeAllViewsInLayout();
     }
 
-    /**
-     * @hide
-     */
-    @Override
-    protected boolean onConsistencyCheck(int consistency) {
-        boolean result = super.onConsistencyCheck(consistency);
-
-        final boolean checkLayout = (consistency & ViewDebug.CONSISTENCY_LAYOUT) != 0;
-
-        if (checkLayout) {
-            // The active recycler must be empty
-            final View[] activeViews = mRecycler.mActiveViews;
-            int count = activeViews.length;
-            for (int i = 0; i < count; i++) {
-                if (activeViews[i] != null) {
-                    result = false;
-                    Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
-                            "AbsListView " + this + " has a view in its active recycler: " +
-                                    activeViews[i]);
-                }
-            }
-
-            // All views in the recycler must NOT be on screen and must NOT have a parent
-            final ArrayList<View> scrap = mRecycler.mCurrentScrap;
-            if (!checkScrap(scrap)) result = false;
-            final ArrayList<View>[] scraps = mRecycler.mScrapViews;
-            count = scraps.length;
-            for (int i = 0; i < count; i++) {
-                if (!checkScrap(scraps[i])) result = false;
-            }
-        }
-
-        return result;
-    }
-
-    private boolean checkScrap(ArrayList<View> scrap) {
-        if (scrap == null) return true;
-        boolean result = true;
-
-        final int count = scrap.size();
-        for (int i = 0; i < count; i++) {
-            final View view = scrap.get(i);
-            if (view.getParent() != null) {
-                result = false;
-                Log.d(ViewDebug.CONSISTENCY_LOG_TAG, "AbsListView " + this +
-                        " has a view in its scrap heap still attached to a parent: " + view);
-            }
-            if (indexOfChild(view) >= 0) {
-                result = false;
-                Log.d(ViewDebug.CONSISTENCY_LOG_TAG, "AbsListView " + this +
-                        " has a view in its scrap heap that is also a direct child: " + view);
-            }
-        }
-
-        return result;
-    }
-
     private void finishGlows() {
         if (mEdgeGlowTop != null) {
             mEdgeGlowTop.finish();
@@ -6524,12 +6437,6 @@
                     if (hasListener) {
                         mRecyclerListener.onMovedToScrapHeap(victim);
                     }
-
-                    if (ViewDebug.TRACE_RECYCLER) {
-                        ViewDebug.trace(victim,
-                                ViewDebug.RecyclerTraceType.MOVE_FROM_ACTIVE_TO_SCRAP_HEAP,
-                                mFirstActivePosition + i, -1);
-                    }
                 }
             }
 
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 5098523..c62b62b 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -1557,10 +1557,6 @@
             if (dataChanged) {
                 for (int i = 0; i < childCount; i++) {
                     recycleBin.addScrapView(getChildAt(i), firstPosition+i);
-                    if (ViewDebug.TRACE_RECYCLER) {
-                        ViewDebug.trace(getChildAt(i),
-                                ViewDebug.RecyclerTraceType.MOVE_TO_SCRAP_HEAP, index, i);
-                    }
                 }
             } else {
                 recycleBin.fillActiveViews(childCount, firstPosition);
@@ -1757,11 +1753,6 @@
             // Try to use an existing view for this position
             child = mRecycler.getActiveView(position);
             if (child != null) {
-                if (ViewDebug.TRACE_RECYCLER) {
-                    ViewDebug.trace(child, ViewDebug.RecyclerTraceType.RECYCLE_FROM_ACTIVE_HEAP,
-                            position, getChildCount());
-                }
-
                 // Found it -- we're using an existing child
                 // This just needs to be positioned
                 setupChild(child, position, y, flow, childrenLeft, selected, true);