public final class AndroidRefWatcherBuilder extends com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>
RefWatcherBuilder with appropriate Android defaults.| Modifier and Type | Method and Description |
|---|---|
com.squareup.leakcanary.RefWatcher |
buildAndInstall()
Creates a
RefWatcher instance and makes it available through LeakCanary.installedRefWatcher(). |
protected com.squareup.leakcanary.DebuggerControl |
defaultDebuggerControl() |
protected com.squareup.leakcanary.ExcludedRefs |
defaultExcludedRefs() |
protected com.squareup.leakcanary.HeapDumper |
defaultHeapDumper() |
protected com.squareup.leakcanary.HeapDump.Listener |
defaultHeapDumpListener() |
protected java.util.List<java.lang.Class<? extends com.squareup.leakcanary.Reachability.Inspector>> |
defaultReachabilityInspectorClasses() |
protected com.squareup.leakcanary.WatchExecutor |
defaultWatchExecutor() |
protected boolean |
isDisabled() |
AndroidRefWatcherBuilder |
listenerServiceClass(java.lang.Class<? extends AbstractAnalysisResultService> listenerServiceClass)
Sets a custom
AbstractAnalysisResultService to listen to analysis results. |
AndroidRefWatcherBuilder |
maxStoredHeapDumps(int maxStoredHeapDumps)
Sets the maximum number of heap dumps stored.
|
AndroidRefWatcherBuilder |
watchActivities(boolean watchActivities)
Whether we should automatically watch activities when calling
buildAndInstall(). |
AndroidRefWatcherBuilder |
watchDelay(long delay,
java.util.concurrent.TimeUnit unit)
Sets a custom delay for how long the
RefWatcher should wait until it checks if a
tracked object has been garbage collected. |
AndroidRefWatcherBuilder |
watchFragments(boolean watchFragments)
Whether we should automatically watch fragments when calling
buildAndInstall(). |
public AndroidRefWatcherBuilder listenerServiceClass(java.lang.Class<? extends AbstractAnalysisResultService> listenerServiceClass)
AbstractAnalysisResultService to listen to analysis results. This
overrides any call to RefWatcherBuilder.heapDumpListener(HeapDump.Listener).public AndroidRefWatcherBuilder watchDelay(long delay, java.util.concurrent.TimeUnit unit)
RefWatcher should wait until it checks if a
tracked object has been garbage collected. This overrides any call to RefWatcherBuilder.watchExecutor(WatchExecutor).public AndroidRefWatcherBuilder watchActivities(boolean watchActivities)
buildAndInstall().
Default is true.public AndroidRefWatcherBuilder watchFragments(boolean watchFragments)
buildAndInstall().
Default is true. When true, LeakCanary watches native fragments on Android O+ and support
fragments if the leakcanary-support-fragment dependency is in the classpath.public AndroidRefWatcherBuilder maxStoredHeapDumps(int maxStoredHeapDumps)
LeakCanary.setLeakDirectoryProvider(LeakDirectoryProvider)java.lang.IllegalArgumentException - if maxStoredHeapDumps < 1.public com.squareup.leakcanary.RefWatcher buildAndInstall()
RefWatcher instance and makes it available through LeakCanary.installedRefWatcher().
Also starts watching activity references if watchActivities(boolean) was set to true.java.lang.UnsupportedOperationException - if called more than once per Android process.protected boolean isDisabled()
isDisabled in class com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>protected com.squareup.leakcanary.HeapDumper defaultHeapDumper()
defaultHeapDumper in class com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>protected com.squareup.leakcanary.DebuggerControl defaultDebuggerControl()
defaultDebuggerControl in class com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>protected com.squareup.leakcanary.HeapDump.Listener defaultHeapDumpListener()
defaultHeapDumpListener in class com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>protected com.squareup.leakcanary.ExcludedRefs defaultExcludedRefs()
defaultExcludedRefs in class com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>protected com.squareup.leakcanary.WatchExecutor defaultWatchExecutor()
defaultWatchExecutor in class com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>protected java.util.List<java.lang.Class<? extends com.squareup.leakcanary.Reachability.Inspector>> defaultReachabilityInspectorClasses()
defaultReachabilityInspectorClasses in class com.squareup.leakcanary.RefWatcherBuilder<AndroidRefWatcherBuilder>