Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f337a48a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Turn off automatic heap dump notifications in SysUI" into rvc-dev am:...

Merge "Turn off automatic heap dump notifications in SysUI" into rvc-dev am: 194bf138 am: 189ffac3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11893823

Change-Id: I6dabda073559b9b2e34afd562617918f782ab031
parents e38820dc 189ffac3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -477,7 +477,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, 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;
+27 −13
Original line number Diff line number Diff line
@@ -62,22 +62,38 @@ 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
    // Feature switches
    // ================

    // 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);
    private static final String FORCE_ENABLE_LEAK_REPORTING = "sysui_force_enable_leak_reporting";
    public static final String FORCE_ENABLE_LEAK_REPORTING = "sysui_force_enable_leak_reporting";

    private static final boolean HEAP_TRACKING_ENABLED = Build.IS_DEBUGGABLE;
    // 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;

    // 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";
    // Tell QSTileHost.java to toss this into the default tileset?
    public static final boolean ADD_MEMORY_TILE_TO_DEFAULT_ON_DEBUGGABLE_BUILDS = true;

    private static final String TAG = "GarbageMonitor";
    // 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 long GARBAGE_INSPECTION_INTERVAL =
            15 * DateUtils.MINUTE_IN_MILLIS; // 15 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<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 final ActivityStarter mActivityStarter;
        private ProcessMemInfo pmi;