INNER CODE UNIT · Java
install
M66B/FairEmail · app/src/debug/java/eu.faircode.email/CoalMine.java:42
static void install(@NonNull Application app) {
AppWatcher.INSTANCE.manualInstall(app, TimeUnit.SECONDS.toMillis(5));
}
static void setup(boolean enabled) {
List<ObjectInspector> inspectors = new ArrayList<>(LeakCanary.getConfig().getObjectInspectors());
// https://square.github.io/leakcanary/recipes/#identifying-leaking-objects-and-labeling-objects
for (Class<?> clazz : new Class<?>[]{SimpleTask.class, TwoStateOwner.class, RunnableEx.class})
inspectors.add(new ObjectInspector() {
@Override
public void inspect(@NonNull ObjectReporter reporter) {
String className = clazz.getName();
reporter.whenInstanceOf(className, new Function2<ObjectReporter, HeapObject.HeapInstance, Unit>() {
@Override
public Unit invoke(ObjectReporter reporter, HeapObject.HeapInstance instance) {
HeapField hfName = instance.get(className, "name");
if (hfName != null) {