我试图使用ViewDebug.startHierarchyTracing
方法,但它不做任何事情,因为它检查ViewDebug.TRACE_HIERARCHY
,如果它是false
,则立即返回。 其实这是根据JavaDoc预期的行为:如何使用android.view.ViewDebug静态方法?
如果TRACE_HIERARCHY为false,此方法将立即返回。
的问题是,TRACE_HIERARCHY
在源声明为与false
的值的布尔常数:
/**
* 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.
*/
public static final boolean TRACE_HIERARCHY = false;
另外还有startRecyclerTracing
,startMotionEventTracing
方法依赖于TRACE_RECYCLER
(从公共API隐藏)和TRACE_MOTION_EVENTS
常量(它们也被设置为false)。
所以我想知道是否可以使用ViewDebug
类,或者它只打算用于定制的Android构建?如果是这样的话,那么可以使用Emulator的这种定制(调试?)构建?