protected void onHandleIntent(Intent intent) { HeapDump heapDump = (HeapDump) intent.getSerializableExtra(HEAPDUMP_EXTRA); AbstractAnalysisResultService.sendResultToListener(this, intent.getStringExtra (LISTENER_CLASS_EXTRA), heapDump, new HeapAnalyzer(AndroidExcludedRefs .createAndroidDefaults().build(), heapDump.excludedRefs).checkForLeak(heapDump .heapDumpFile, heapDump.referenceKey)); }
private void initializeLeakCanary() { if (LeakCanary.isInAnalyzerProcess(getApplicationContext())) { // This process is dedicated to LeakCanary for heap analysis. // You should not init your app in this process. mRefWatcher = RefWatcher.DISABLED; } else { // Ignore known Android SDK leaks ExcludedRefs excludedRefs = AndroidExcludedRefs.createAppDefaults() .build(); mRefWatcher = LeakCanary.refWatcher(getApplicationContext()) .excludedRefs(excludedRefs) .buildAndInstall(); } }
public static RefWatcher install(Application application) { if (BuildConfig.DEBUG) { ExcludedRefs excludedRefs = AndroidExcludedRefs.createAppDefaults() //exclude InputMethodManager .clazz("android.view.inputmethod.InputMethodManager") .build(); return LeakCanary.refWatcher(application) .listenerServiceClass(DisplayLeakService.class) .excludedRefs(excludedRefs) .buildAndInstall(); } else { return LeakCanary.install(application); } }
public static void setupLeakCanary(Application application) { LeakCanary.install(application, LeakLoggerService.class, AndroidExcludedRefs.createAppDefaults().build()); }