diff options
| author | Romain Guy <romainguy@android.com> | 2009-05-12 17:56:14 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@android.com> | 2009-05-13 15:42:23 -0700 |
| commit | 13922e03037d71a538f24ddf61c0b61bb4eb5af0 (patch) | |
| tree | e962dca19eee7c51affdfd8df7cf1fed0f541a8b /core/java/android/view/ViewDebug.java | |
| parent | a2a34a5711bde03475b40edfe3cc052ece02700a (diff) | |
Fixes #1836075. Adds consistency checks for the View hierarchy. To enable them, you need a debug build and ViewDebug.sConsistencyCheckEnabled set to true in debug.prop. This change also lets you easily enable drawing and layout profiling in ViewRoot by setting ViewRoot.sProfileDrawing, ViewRoot.sProfileLayout and ViewRoot.sShowFps in debug.prop with a debug build.
Diffstat (limited to 'core/java/android/view/ViewDebug.java')
| -rw-r--r-- | core/java/android/view/ViewDebug.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index 367c9a22d953..4436f4b6e62c 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -54,6 +54,27 @@ import java.lang.reflect.AccessibleObject; */ public class ViewDebug { /** + * Log tag used to log errors related to the consistency of the view hierarchy. + * + * @hide + */ + 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. @@ -80,6 +101,49 @@ public class ViewDebug { static final String SYSTEM_PROPERTY_CAPTURE_EVENT = "debug.captureevent"; /** + * Profiles drawing times in the events log. + * + * @hide + */ + @Debug.DebugProperty + public static boolean profileDrawing = false; + + /** + * Profiles layout times in the events log. + * + * @hide + */ + @Debug.DebugProperty + public static boolean profileLayout = false; + + /** + * Profiles real fps (times between draws) and displays the result. + * + * @hide + */ + @Debug.DebugProperty + public static boolean showFps = false; + + /** + * <p>Enables or disables views consistency check. Even when this property is enabled, + * view consistency checks happen only if {@link android.util.Config#DEBUG} 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; + + static { + Debug.setFieldsOn(ViewDebug.class, true); + } + + /** * 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. |
