shark-android / shark / AndroidReferenceMatchers
enum class AndroidReferenceMatchers
AndroidReferenceMatchers values add ReferenceMatcher instances to a global list via their add method. A ReferenceMatcher is either a IgnoredReferenceMatcher or a LibraryLeakReferenceMatcher.
AndroidReferenceMatchers is used to build the list of known references that cannot ever create leaks (via IgnoredReferenceMatcher) as well as the list of known leaks in the Android Framework and in manufacturer specific Android implementations.
This class is a work in progress. You can help by reporting leak traces that seem to be caused by the Android SDK, here: https://github.com/square/leakcanary/issues/new
We filter on SDK versions and Manufacturers because many of those leaks are specific to a given manufacturer implementation, they usually share their builds across multiple models, and the leaks eventually get fixed in newer versions.
Most app developers should use appDefaults. However, you can also use a subset of AndroidReferenceMatchers by creating an EnumSet that matches your needs and calling buildKnownReferences.
Name | Summary |
---|---|
appDefaults | val appDefaults: List <ReferenceMatcher> |
HUAWEI | const val HUAWEI: String |
ignoredReferencesOnly | val ignoredReferencesOnly: List <ReferenceMatcher> Returns a list of ReferenceMatcher that only contains IgnoredReferenceMatcher and no LibraryLeakReferenceMatcher. |
LENOVO | const val LENOVO: String |
LG | const val LG: String |
MEIZU | const val MEIZU: String |
MOTOROLA | const val MOTOROLA: String |
NVIDIA | const val NVIDIA: String |
ONE_PLUS | const val ONE_PLUS: String |
RAZER | const val RAZER: String |
SAMSUNG | const val SAMSUNG: String |
SHARP | const val SHARP: String |
VIVO | const val VIVO: String |
Name | Summary |
---|---|
buildKnownReferences | fun buildKnownReferences(referenceMatchers: Set < AndroidReferenceMatchers >): List <ReferenceMatcher> Builds a list of ReferenceMatcher from the referenceMatchers set of AndroidReferenceMatchers. |
ignoredInstanceField | fun ignoredInstanceField(className: String , fieldName: String ): IgnoredReferenceMatcher Creates a IgnoredReferenceMatcher that matches a InstanceFieldPattern. |
ignoredJavaLocal | fun ignoredJavaLocal(threadName: String ): IgnoredReferenceMatcher Creates a IgnoredReferenceMatcher that matches a JavaLocalPattern. |
instanceFieldLeak | fun instanceFieldLeak(className: String , fieldName: String , description: String = "", patternApplies: AndroidBuildMirror .() -> Boolean = ALWAYS): LibraryLeakReferenceMatcher Creates a LibraryLeakReferenceMatcher that matches a InstanceFieldPattern. [description](instance-field-leak.md#shark.AndroidReferenceMatchers.Companion$instanceFieldLeak(kotlin.String, kotlin.String, kotlin.String, kotlin.Function1((shark.AndroidBuildMirror, kotlin.Boolean)))/description) should convey what we know about this library leak. |
nativeGlobalVariableLeak | fun nativeGlobalVariableLeak(className: String , description: String = "", patternApplies: AndroidBuildMirror .() -> Boolean = ALWAYS): LibraryLeakReferenceMatcher |
staticFieldLeak | fun staticFieldLeak(className: String , fieldName: String , description: String = "", patternApplies: AndroidBuildMirror .() -> Boolean = ALWAYS): LibraryLeakReferenceMatcher Creates a LibraryLeakReferenceMatcher that matches a StaticFieldPattern. [description](static-field-leak.md#shark.AndroidReferenceMatchers.Companion$staticFieldLeak(kotlin.String, kotlin.String, kotlin.String, kotlin.Function1((shark.AndroidBuildMirror, kotlin.Boolean)))/description) should convey what we know about this library leak. |