Skip to content

Commit 13b9073

Browse files
author
Romain Guy
committed
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
1 parent d7e4ae4 commit 13b9073

File tree

12 files changed

+51
-979
lines changed

12 files changed

+51
-979
lines changed

api/16.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24512,14 +24512,14 @@ package android.view {
2451224512
public class ViewDebug {
2451324513
ctor public ViewDebug();
2451424514
method public static void dumpCapturedView(java.lang.String, java.lang.Object);
24515-
method public static void startHierarchyTracing(java.lang.String, android.view.View);
24516-
method public static void startRecyclerTracing(java.lang.String, android.view.View);
24517-
method public static void stopHierarchyTracing();
24518-
method public static void stopRecyclerTracing();
24519-
method public static void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
24520-
method public static void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
24521-
field public static final boolean TRACE_HIERARCHY = false;
24522-
field public static final boolean TRACE_RECYCLER = false;
24515+
method public static deprecated void startHierarchyTracing(java.lang.String, android.view.View);
24516+
method public static deprecated void startRecyclerTracing(java.lang.String, android.view.View);
24517+
method public static deprecated void stopHierarchyTracing();
24518+
method public static deprecated void stopRecyclerTracing();
24519+
method public static deprecated void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
24520+
method public static deprecated void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
24521+
field public static final deprecated boolean TRACE_HIERARCHY = false;
24522+
field public static final deprecated boolean TRACE_RECYCLER = false;
2452324523
}
2452424524

2452524525
public static abstract class ViewDebug.CapturedViewProperty implements java.lang.annotation.Annotation {
@@ -24531,7 +24531,7 @@ package android.view {
2453124531
public static abstract class ViewDebug.FlagToString implements java.lang.annotation.Annotation {
2453224532
}
2453324533

24534-
public static final class ViewDebug.HierarchyTraceType extends java.lang.Enum {
24534+
public static final deprecated class ViewDebug.HierarchyTraceType extends java.lang.Enum {
2453524535
method public static android.view.ViewDebug.HierarchyTraceType valueOf(java.lang.String);
2453624536
method public static final android.view.ViewDebug.HierarchyTraceType[] values();
2453724537
enum_constant public static final android.view.ViewDebug.HierarchyTraceType BUILD_CACHE;
@@ -24547,7 +24547,7 @@ package android.view {
2454724547
public static abstract class ViewDebug.IntToString implements java.lang.annotation.Annotation {
2454824548
}
2454924549

24550-
public static final class ViewDebug.RecyclerTraceType extends java.lang.Enum {
24550+
public static final deprecated class ViewDebug.RecyclerTraceType extends java.lang.Enum {
2455124551
method public static android.view.ViewDebug.RecyclerTraceType valueOf(java.lang.String);
2455224552
method public static final android.view.ViewDebug.RecyclerTraceType[] values();
2455324553
enum_constant public static final android.view.ViewDebug.RecyclerTraceType BIND_VIEW;

api/current.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24512,14 +24512,14 @@ package android.view {
2451224512
public class ViewDebug {
2451324513
ctor public ViewDebug();
2451424514
method public static void dumpCapturedView(java.lang.String, java.lang.Object);
24515-
method public static void startHierarchyTracing(java.lang.String, android.view.View);
24516-
method public static void startRecyclerTracing(java.lang.String, android.view.View);
24517-
method public static void stopHierarchyTracing();
24518-
method public static void stopRecyclerTracing();
24519-
method public static void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
24520-
method public static void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
24521-
field public static final boolean TRACE_HIERARCHY = false;
24522-
field public static final boolean TRACE_RECYCLER = false;
24515+
method public static deprecated void startHierarchyTracing(java.lang.String, android.view.View);
24516+
method public static deprecated void startRecyclerTracing(java.lang.String, android.view.View);
24517+
method public static deprecated void stopHierarchyTracing();
24518+
method public static deprecated void stopRecyclerTracing();
24519+
method public static deprecated void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
24520+
method public static deprecated void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
24521+
field public static final deprecated boolean TRACE_HIERARCHY = false;
24522+
field public static final deprecated boolean TRACE_RECYCLER = false;
2452324523
}
2452424524

2452524525
public static abstract class ViewDebug.CapturedViewProperty implements java.lang.annotation.Annotation {
@@ -24531,7 +24531,7 @@ package android.view {
2453124531
public static abstract class ViewDebug.FlagToString implements java.lang.annotation.Annotation {
2453224532
}
2453324533

24534-
public static final class ViewDebug.HierarchyTraceType extends java.lang.Enum {
24534+
public static final deprecated class ViewDebug.HierarchyTraceType extends java.lang.Enum {
2453524535
method public static android.view.ViewDebug.HierarchyTraceType valueOf(java.lang.String);
2453624536
method public static final android.view.ViewDebug.HierarchyTraceType[] values();
2453724537
enum_constant public static final android.view.ViewDebug.HierarchyTraceType BUILD_CACHE;
@@ -24547,7 +24547,7 @@ package android.view {
2454724547
public static abstract class ViewDebug.IntToString implements java.lang.annotation.Annotation {
2454824548
}
2454924549

24550-
public static final class ViewDebug.RecyclerTraceType extends java.lang.Enum {
24550+
public static final deprecated class ViewDebug.RecyclerTraceType extends java.lang.Enum {
2455124551
method public static android.view.ViewDebug.RecyclerTraceType valueOf(java.lang.String);
2455224552
method public static final android.view.ViewDebug.RecyclerTraceType[] values();
2455324553
enum_constant public static final android.view.ViewDebug.RecyclerTraceType BIND_VIEW;

cmds/am/src/com/android/commands/am/Am.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,6 @@ private void runProfile() throws Exception {
645645
String process = null;
646646

647647
String cmd = nextArgRequired();
648-
if ("looper".equals(cmd)) {
649-
cmd = nextArgRequired();
650-
profileType = 1;
651-
}
652648

653649
if ("start".equals(cmd)) {
654650
start = true;
@@ -1295,8 +1291,8 @@ private static void showUsage() {
12951291
" am broadcast <INTENT>\n" +
12961292
" am instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]\n" +
12971293
" [--no-window-animation] <COMPONENT>\n" +
1298-
" am profile [looper] start <PROCESS> <FILE>\n" +
1299-
" am profile [looper] stop [<PROCESS>]\n" +
1294+
" am profile start <PROCESS> <FILE>\n" +
1295+
" am profile stop [<PROCESS>]\n" +
13001296
" am dumpheap [flags] <PROCESS> <FILE>\n" +
13011297
" am set-debug-app [-w] [--persistent] <PACKAGE>\n" +
13021298
" am clear-debug-app\n" +

core/java/android/app/ActivityThread.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,9 +3751,6 @@ final void handleProfilerControl(boolean start, ProfilerControlData pcd, int pro
37513751
if (start) {
37523752
try {
37533753
switch (profileType) {
3754-
case 1:
3755-
ViewDebug.startLooperProfiling(pcd.path, pcd.fd.getFileDescriptor());
3756-
break;
37573754
default:
37583755
mProfiler.setProfiler(pcd.path, pcd.fd);
37593756
mProfiler.autoStopProfiler = false;
@@ -3772,9 +3769,6 @@ final void handleProfilerControl(boolean start, ProfilerControlData pcd, int pro
37723769
}
37733770
} else {
37743771
switch (profileType) {
3775-
case 1:
3776-
ViewDebug.stopLooperProfiling();
3777-
break;
37783772
default:
37793773
mProfiler.stopProfiling();
37803774
break;

core/java/android/os/Looper.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,29 +127,17 @@ public static void loop() {
127127
return;
128128
}
129129

130-
long wallStart = 0;
131-
long threadStart = 0;
132-
133130
// This must be in a local variable, in case a UI event sets the logger
134131
Printer logging = me.mLogging;
135132
if (logging != null) {
136133
logging.println(">>>>> Dispatching to " + msg.target + " " +
137134
msg.callback + ": " + msg.what);
138-
wallStart = SystemClock.currentTimeMicro();
139-
threadStart = SystemClock.currentThreadTimeMicro();
140135
}
141136

142137
msg.target.dispatchMessage(msg);
143138

144139
if (logging != null) {
145-
long wallTime = SystemClock.currentTimeMicro() - wallStart;
146-
long threadTime = SystemClock.currentThreadTimeMicro() - threadStart;
147-
148140
logging.println("<<<<< Finished to " + msg.target + " " + msg.callback);
149-
if (logging instanceof Profiler) {
150-
((Profiler) logging).profile(msg, wallStart, wallTime,
151-
threadStart, threadTime);
152-
}
153141
}
154142

155143
// Make sure that during the course of dispatching the
@@ -290,12 +278,4 @@ public void dump(Printer pw, String prefix) {
290278
public String toString() {
291279
return "Looper{" + Integer.toHexString(System.identityHashCode(this)) + "}";
292280
}
293-
294-
/**
295-
* @hide
296-
*/
297-
public static interface Profiler {
298-
void profile(Message message, long wallStart, long wallTime,
299-
long threadStart, long threadTime);
300-
}
301281
}

core/java/android/view/HardwareRenderer.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,10 @@ static abstract class GlRenderer extends HardwareRenderer {
647647
Log.d(LOG_TAG, "Disabling v-sync");
648648
}
649649

650-
//noinspection PointlessBooleanExpression,ConstantConditions
651-
if (!ViewDebug.DEBUG_LATENCY) {
652-
property = SystemProperties.get(PROFILE_PROPERTY, "false");
653-
mProfileEnabled = "true".equalsIgnoreCase(property);
654-
if (mProfileEnabled) {
655-
Log.d(LOG_TAG, "Profiling hardware renderer");
656-
}
657-
} else {
658-
mProfileEnabled = true;
650+
property = SystemProperties.get(PROFILE_PROPERTY, "false");
651+
mProfileEnabled = "true".equalsIgnoreCase(property);
652+
if (mProfileEnabled) {
653+
Log.d(LOG_TAG, "Profiling hardware renderer");
659654
}
660655

661656
if (mProfileEnabled) {
@@ -1132,11 +1127,6 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba
11321127
float total = (now - getDisplayListStartTime) * 0.000001f;
11331128
//noinspection PointlessArithmeticExpression
11341129
mProfileData[mProfileCurrentFrame] = total;
1135-
1136-
if (ViewDebug.DEBUG_LATENCY) {
1137-
Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- getDisplayList() took " +
1138-
total + "ms");
1139-
}
11401130
}
11411131

11421132
if (displayList != null) {
@@ -1152,11 +1142,6 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba
11521142
long now = System.nanoTime();
11531143
float total = (now - drawDisplayListStartTime) * 0.000001f;
11541144
mProfileData[mProfileCurrentFrame + 1] = total;
1155-
1156-
if (ViewDebug.DEBUG_LATENCY) {
1157-
Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- drawDisplayList() took " +
1158-
total + "ms, status=" + status);
1159-
}
11601145
}
11611146

11621147
handleFunctorStatus(attachInfo, status);
@@ -1198,11 +1183,6 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba
11981183
long now = System.nanoTime();
11991184
float total = (now - eglSwapBuffersStartTime) * 0.000001f;
12001185
mProfileData[mProfileCurrentFrame + 2] = total;
1201-
1202-
if (ViewDebug.DEBUG_LATENCY) {
1203-
Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- eglSwapBuffers() took " +
1204-
total + "ms");
1205-
}
12061186
}
12071187

12081188
checkEglErrors();

core/java/android/view/View.java

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -9912,10 +9912,6 @@ private boolean skipInvalidate() {
99129912
* @param dirty the rectangle representing the bounds of the dirty region
99139913
*/
99149914
public void invalidate(Rect dirty) {
9915-
if (ViewDebug.TRACE_HIERARCHY) {
9916-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
9917-
}
9918-
99199915
if (skipInvalidate()) {
99209916
return;
99219917
}
@@ -9959,10 +9955,6 @@ public void invalidate(Rect dirty) {
99599955
* @param b the bottom position of the dirty region
99609956
*/
99619957
public void invalidate(int l, int t, int r, int b) {
9962-
if (ViewDebug.TRACE_HIERARCHY) {
9963-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
9964-
}
9965-
99669958
if (skipInvalidate()) {
99679959
return;
99689960
}
@@ -10015,10 +10007,6 @@ public void invalidate() {
1001510007
* View's contents or dimensions have not changed.
1001610008
*/
1001710009
void invalidate(boolean invalidateCache) {
10018-
if (ViewDebug.TRACE_HIERARCHY) {
10019-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
10020-
}
10021-
1002210010
if (skipInvalidate()) {
1002310011
return;
1002410012
}
@@ -12391,10 +12379,6 @@ public void buildDrawingCache(boolean autoScale) {
1239112379
mDrawingCache == null : mUnscaledDrawingCache == null)) {
1239212380
mCachingFailed = false;
1239312381

12394-
if (ViewDebug.TRACE_HIERARCHY) {
12395-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.BUILD_CACHE);
12396-
}
12397-
1239812382
int width = mRight - mLeft;
1239912383
int height = mBottom - mTop;
1240012384

@@ -12514,9 +12498,6 @@ public void buildDrawingCache(boolean autoScale) {
1251412498

1251512499
// Fast path for layouts with no backgrounds
1251612500
if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
12517-
if (ViewDebug.TRACE_HIERARCHY) {
12518-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.DRAW);
12519-
}
1252012501
mPrivateFlags &= ~DIRTY_MASK;
1252112502
dispatchDraw(canvas);
1252212503
} else {
@@ -13130,9 +13111,6 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1313013111
if (!hasDisplayList) {
1313113112
// Fast path for layouts with no backgrounds
1313213113
if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
13133-
if (ViewDebug.TRACE_HIERARCHY) {
13134-
ViewDebug.trace(parent, ViewDebug.HierarchyTraceType.DRAW);
13135-
}
1313613114
mPrivateFlags &= ~DIRTY_MASK;
1313713115
dispatchDraw(canvas);
1313813116
} else {
@@ -13205,10 +13183,6 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1320513183
* @param canvas The Canvas to which the View is rendered.
1320613184
*/
1320713185
public void draw(Canvas canvas) {
13208-
if (ViewDebug.TRACE_HIERARCHY) {
13209-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.DRAW);
13210-
}
13211-
1321213186
final int privateFlags = mPrivateFlags;
1321313187
final boolean dirtyOpaque = (privateFlags & DIRTY_MASK) == DIRTY_OPAQUE &&
1321413188
(mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState);
@@ -13552,10 +13526,6 @@ public void layout(int l, int t, int r, int b) {
1355213526
int oldR = mRight;
1355313527
boolean changed = setFrame(l, t, r, b);
1355413528
if (changed || (mPrivateFlags & LAYOUT_REQUIRED) == LAYOUT_REQUIRED) {
13555-
if (ViewDebug.TRACE_HIERARCHY) {
13556-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.ON_LAYOUT);
13557-
}
13558-
1355913529
onLayout(changed, l, t, r, b);
1356013530
mPrivateFlags &= ~LAYOUT_REQUIRED;
1356113531

@@ -14810,60 +14780,6 @@ private void setKeyedTag(int key, Object tag) {
1481014780
mKeyedTags.put(key, tag);
1481114781
}
1481214782

14813-
/**
14814-
* @param consistency The type of consistency. See ViewDebug for more information.
14815-
*
14816-
* @hide
14817-
*/
14818-
protected boolean dispatchConsistencyCheck(int consistency) {
14819-
return onConsistencyCheck(consistency);
14820-
}
14821-
14822-
/**
14823-
* Method that subclasses should implement to check their consistency. The type of
14824-
* consistency check is indicated by the bit field passed as a parameter.
14825-
*
14826-
* @param consistency The type of consistency. See ViewDebug for more information.
14827-
*
14828-
* @throws IllegalStateException if the view is in an inconsistent state.
14829-
*
14830-
* @hide
14831-
*/
14832-
protected boolean onConsistencyCheck(int consistency) {
14833-
boolean result = true;
14834-
14835-
final boolean checkLayout = (consistency & ViewDebug.CONSISTENCY_LAYOUT) != 0;
14836-
final boolean checkDrawing = (consistency & ViewDebug.CONSISTENCY_DRAWING) != 0;
14837-
14838-
if (checkLayout) {
14839-
if (getParent() == null) {
14840-
result = false;
14841-
android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
14842-
"View " + this + " does not have a parent.");
14843-
}
14844-
14845-
if (mAttachInfo == null) {
14846-
result = false;
14847-
android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
14848-
"View " + this + " is not attached to a window.");
14849-
}
14850-
}
14851-
14852-
if (checkDrawing) {
14853-
// Do not check the DIRTY/DRAWN flags because views can call invalidate()
14854-
// from their draw() method
14855-
14856-
if ((mPrivateFlags & DRAWN) != DRAWN &&
14857-
(mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) {
14858-
result = false;
14859-
android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
14860-
"View " + this + " was invalidated but its drawing cache is valid.");
14861-
}
14862-
}
14863-
14864-
return result;
14865-
}
14866-
1486714783
/**
1486814784
* Prints information about this view in the log output, with the tag
1486914785
* {@link #VIEW_LOG_TAG}.
@@ -14977,10 +14893,6 @@ public int getBaseline() {
1497714893
* tree.
1497814894
*/
1497914895
public void requestLayout() {
14980-
if (ViewDebug.TRACE_HIERARCHY) {
14981-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.REQUEST_LAYOUT);
14982-
}
14983-
1498414896
mPrivateFlags |= FORCE_LAYOUT;
1498514897
mPrivateFlags |= INVALIDATED;
1498614898

@@ -15031,10 +14943,6 @@ public final void measure(int widthMeasureSpec, int heightMeasureSpec) {
1503114943
// first clears the measured dimension flag
1503214944
mPrivateFlags &= ~MEASURED_DIMENSION_SET;
1503314945

15034-
if (ViewDebug.TRACE_HIERARCHY) {
15035-
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.ON_MEASURE);
15036-
}
15037-
1503814946
// measure ourselves, this should set the measured dimension flag back
1503914947
onMeasure(widthMeasureSpec, heightMeasureSpec);
1504014948

0 commit comments

Comments
 (0)