You get a memory tile, and you get a memory tile.
Turn on the SysUI memory QS tile for all debuggable builds. This has the side effect of enabling ActivityManager heap tracking for com.android.systemui, so don't be surprised when you start seeing notifications saying "here's a heap dump!" Bug: 133671238 Test: runtest systemui Change-Id: Ib40850bdcc0d67bfbcaf797886d53f2ae706bd72
This commit is contained in:
@@ -19,6 +19,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.UserHandle;
|
||||
@@ -48,6 +49,7 @@ import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBarIconController;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
import com.android.systemui.tuner.TunerService.Tunable;
|
||||
import com.android.systemui.util.leak.GarbageMonitor;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -364,6 +366,10 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
||||
if (tile.equals("default")) {
|
||||
if (!addedDefault) {
|
||||
tiles.addAll(Arrays.asList(defaultTileList.split(",")));
|
||||
if (Build.IS_DEBUGGABLE
|
||||
&& GarbageMonitor.MemoryTile.ADD_TO_DEFAULT_ON_DEBUGGABLE_BUILDS) {
|
||||
tiles.add(GarbageMonitor.MemoryTile.TILE_SPEC);
|
||||
}
|
||||
addedDefault = true;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -66,7 +66,11 @@ public class GarbageMonitor {
|
||||
private static final String FORCE_ENABLE_LEAK_REPORTING = "sysui_force_enable_leak_reporting";
|
||||
|
||||
private static final boolean HEAP_TRACKING_ENABLED = Build.IS_DEBUGGABLE;
|
||||
private static final boolean ENABLE_AM_HEAP_LIMIT = true; // use ActivityManager.setHeapLimit
|
||||
|
||||
// whether to use ActivityManager.setHeapLimit
|
||||
private static final boolean ENABLE_AM_HEAP_LIMIT = Build.IS_DEBUGGABLE;
|
||||
// heap limit value, in KB (overrides R.integer.watch_heap_limit)
|
||||
private static final String SETTINGS_KEY_AM_HEAP_LIMIT = "systemui_am_heap_limit";
|
||||
|
||||
private static final String TAG = "GarbageMonitor";
|
||||
|
||||
@@ -112,7 +116,9 @@ public class GarbageMonitor {
|
||||
mDumpTruck = new DumpTruck(mContext);
|
||||
|
||||
if (ENABLE_AM_HEAP_LIMIT) {
|
||||
mHeapLimit = mContext.getResources().getInteger(R.integer.watch_heap_limit);
|
||||
mHeapLimit = Settings.Global.getInt(context.getContentResolver(),
|
||||
SETTINGS_KEY_AM_HEAP_LIMIT,
|
||||
mContext.getResources().getInteger(R.integer.watch_heap_limit));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,6 +349,9 @@ public class GarbageMonitor {
|
||||
public static class MemoryTile extends QSTileImpl<QSTile.State> {
|
||||
public static final String TILE_SPEC = "dbg:mem";
|
||||
|
||||
// Tell QSTileHost.java to toss this into the default tileset?
|
||||
public static final boolean ADD_TO_DEFAULT_ON_DEBUGGABLE_BUILDS = true;
|
||||
|
||||
private final GarbageMonitor gm;
|
||||
private ProcessMemInfo pmi;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user