Java 类com.squareup.leakcanary.ExcludedRefs 实例源码

项目:MVP-Boilerplate    文件:DebugApp.java   
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();
    }
}
项目:S1-Next    文件:LeaksUtil.java   
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);
    }
}
项目:leakcanary-for-eclipse    文件:HeapAnalyzerService.java   
@Override protected void onHandleIntent(Intent intent) {
  String listenerClassName = intent.getStringExtra(LISTENER_CLASS_EXTRA);
  HeapDump heapDump = (HeapDump) intent.getSerializableExtra(HEAPDUMP_EXTRA);

  ExcludedRefs androidExcludedDefault = createAndroidDefaults().build();
  HeapAnalyzer heapAnalyzer = new HeapAnalyzer(androidExcludedDefault, heapDump.excludedRefs);

  AnalysisResult result = heapAnalyzer.checkForLeak(heapDump.heapDumpFile, heapDump.referenceKey);
  AbstractAnalysisResultService.sendResultToListener(this, listenerClassName, heapDump, result);
}