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
This commit is contained in:
Dan Sandler
2021-04-28 12:53:00 -04:00
committed by Daniel Sandler
parent 1d52698759
commit a5df2171fc

View File

@@ -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;