1 package leakcanary 2 3 import android.os.Build 4 import leakcanary.HeapAnalysisInterceptor.Chain 5 6 class GoodAndroidVersionInterceptor : HeapAnalysisInterceptor { <lambda>null7 private val errorMessage: String? by lazy { 8 val sdkInt = Build.VERSION.SDK_INT 9 if (// findObjectById() sometimes failing. See #1759 10 sdkInt != 23 && 11 // findObjectById() sometimes failing. See #1759 12 sdkInt != 25 && 13 // Android 11 seem to sometimes have super slow heap dumps. 14 // See https://issuetracker.google.com/issues/168634429 15 sdkInt < 30 16 ) { 17 null 18 } else { 19 "Build.VERSION.SDK_INT $sdkInt not supported" 20 } 21 } 22 interceptnull23 override fun intercept(chain: Chain): HeapAnalysisJob.Result { 24 errorMessage?.let { 25 chain.job.cancel(it) 26 } 27 return chain.proceed() 28 } 29 }