diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java index 858a7e2e30e03..1f3967c03a41c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java @@ -477,7 +477,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener, D tiles.addAll(Arrays.asList(defaultTileList.split(","))); if (Build.IS_DEBUGGABLE - && GarbageMonitor.MemoryTile.ADD_TO_DEFAULT_ON_DEBUGGABLE_BUILDS) { + && GarbageMonitor.ADD_MEMORY_TILE_TO_DEFAULT_ON_DEBUGGABLE_BUILDS) { tiles.add(GarbageMonitor.MemoryTile.TILE_SPEC); } return tiles; 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 2e0c035b8547a..b12224bf583d1 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java @@ -62,23 +62,39 @@ import javax.inject.Inject; import javax.inject.Singleton; /** + * Suite of tools to periodically inspect the System UI heap and possibly prompt the user to + * capture heap dumps and report them. Includes the implementation of the "Dump SysUI Heap" + * quick settings tile. */ @Singleton public class GarbageMonitor implements Dumpable { - private static final boolean LEAK_REPORTING_ENABLED = - Build.IS_DEBUGGABLE - && SystemProperties.getBoolean("debug.enable_leak_reporting", false); - private static final String FORCE_ENABLE_LEAK_REPORTING = "sysui_force_enable_leak_reporting"; + // Feature switches + // ================ - private static final boolean HEAP_TRACKING_ENABLED = Build.IS_DEBUGGABLE; + // Whether to use TrackedGarbage to trigger LeakReporter. Off by default unless you set the + // appropriate sysprop on a userdebug device. + public static final boolean LEAK_REPORTING_ENABLED = Build.IS_DEBUGGABLE + && SystemProperties.getBoolean("debug.enable_leak_reporting", false); + public static final String FORCE_ENABLE_LEAK_REPORTING = "sysui_force_enable_leak_reporting"; - // 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) + // Heap tracking: watch the current memory levels and update the MemoryTile if available. + // On for all userdebug devices. + public static final boolean HEAP_TRACKING_ENABLED = Build.IS_DEBUGGABLE; + + // Tell QSTileHost.java to toss this into the default tileset? + public static final boolean ADD_MEMORY_TILE_TO_DEFAULT_ON_DEBUGGABLE_BUILDS = true; + + // whether to use ActivityManager.setHeapLimit (and post a notification to the user asking + // to dump the heap). Off by default unless you set the appropriate sysprop on userdebug + private static final boolean ENABLE_AM_HEAP_LIMIT = Build.IS_DEBUGGABLE + && SystemProperties.getBoolean("debug.enable_sysui_heap_limit", false); + + // Tuning params + // ============= + + // threshold for setHeapLimit(), 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"; - private static final long GARBAGE_INSPECTION_INTERVAL = 15 * DateUtils.MINUTE_IN_MILLIS; // 15 min private static final long HEAP_TRACK_INTERVAL = 1 * DateUtils.MINUTE_IN_MILLIS; // 1 min @@ -89,6 +105,7 @@ public class GarbageMonitor implements Dumpable { private static final int GARBAGE_ALLOWANCE = 5; + private static final String TAG = "GarbageMonitor"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private final Handler mHandler; @@ -378,9 +395,6 @@ public class GarbageMonitor implements Dumpable { public static class MemoryTile extends QSTileImpl { 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 final ActivityStarter mActivityStarter; private ProcessMemInfo pmi;