From a5df2171fce934a7547c0af425456126ddc0a392 Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Wed, 28 Apr 2021 12:53:00 -0400 Subject: [PATCH] Fix longstanding 0B in heap tile Also adds the number of views and ExpandableNotificationRows to the subtext. The former is likely to be in the 1000s for a healthy SystemUI process; the latter should be roughly equivalent to the number of notifications (otherwise there is a leak). Fixes: 159917121 Test: make, pull down QS, examine tile Change-Id: I97b17fb8e991264db612b8a6689051b8d83b4222 --- .../com/android/systemui/util/leak/GarbageMonitor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java index 08cdebd5d80a0..d2bbcd50d0e20 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java @@ -34,6 +34,7 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Build; +import android.os.Debug; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -59,6 +60,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.logging.QSLogger; import com.android.systemui.qs.tileimpl.QSTileImpl; +import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -489,12 +491,16 @@ public class GarbageMonitor implements Dumpable { ? "Dumping..." : mContext.getString(R.string.heap_dump_tile_name); if (pmi != null) { + final long views = Debug.countInstancesOfClass(View.class); + final long enrs = Debug.countInstancesOfClass(ExpandableNotificationRow.class); + Log.v(TAG, String.format("updating tile state; rss=%d", pmi.currentRss)); + Log.v(TAG, String.format("views: %d; ExpandableNotificationRows: %d", views, enrs)); icon.setRss(pmi.currentRss); state.secondaryLabel = String.format( - "rss: %s / %s", + "rss=%s views=%d\nenr=%d", formatBytes(pmi.currentRss * 1024), - formatBytes(gm.mHeapLimit * 1024)); + views, enrs); } else { icon.setRss(0); state.secondaryLabel = null;