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

Commit d4066f58 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Support for counting activity creations" into ub-launcher3-rvc-dev

parents df5d99f4 921f9fd2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public abstract class AbstractLauncherUiTest {
    private static String sStrictmodeDetectedActivityLeak;
    private static boolean sActivityLeakReported;
    private static final String SYSTEMUI_PACKAGE = "com.android.systemui";
    private static final ActivityLeakTracker ACTIVITY_LEAK_TRACKER = new ActivityLeakTracker();
    protected static final ActivityLeakTracker ACTIVITY_LEAK_TRACKER = new ActivityLeakTracker();

    protected LooperExecutor mMainThreadExecutor = MAIN_EXECUTOR;
    protected final UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
+9 −2
Original line number Diff line number Diff line
@@ -26,9 +26,11 @@ import com.android.launcher3.tapl.TestHelpers;

import java.util.WeakHashMap;

class ActivityLeakTracker implements Application.ActivityLifecycleCallbacks {
public class ActivityLeakTracker implements Application.ActivityLifecycleCallbacks {
    private final WeakHashMap<Activity, Boolean> mActivities = new WeakHashMap<>();

    private int mActivitiesCreated;

    ActivityLeakTracker() {
        if (!TestHelpers.isInLauncherProcess()) return;
        final Application app =
@@ -36,9 +38,14 @@ class ActivityLeakTracker implements Application.ActivityLifecycleCallbacks {
        app.registerActivityLifecycleCallbacks(this);
    }

    public int getActivitiesCreated() {
        return mActivitiesCreated;
    }

    @Override
    public void onActivityCreated(Activity activity, Bundle bundle) {
        mActivities.put(activity, true);
        ++mActivitiesCreated;
    }

    @Override