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

Commit abe8e3a9 authored by vadimt's avatar vadimt
Browse files

Not generating memory dump for intentional leak tests

Memory dump can be generated only once, so generating it in the intentional leak test leaves us without a meaningful dump if a real leak happens later, and produces a confusing message that the dump was already generated.

Bug: 195319692
Test: presubmit
Change-Id: I35932deba0c46ddb27362467109daf74d75cbff4
parent 3ed9d508
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -126,10 +126,12 @@ public abstract class AbstractLauncherUiTest {
    private static String getActivityLeakErrorMessage(LauncherInstrumentation launcher) {
        sActivityLeakReported = true;
        return "Activity leak detector has found leaked activities, "
                + dumpHprofData(launcher) + ".";
                + dumpHprofData(launcher, false) + ".";
    }

    public static String dumpHprofData(LauncherInstrumentation launcher) {
    public static String dumpHprofData(LauncherInstrumentation launcher, boolean intentionalLeak) {
        if (intentionalLeak) return "intentional leak; not generating dump";

        String result;
        if (sDumpWasGenerated) {
            Log.d("b/195319692", "dump has already been generated by another test",