private void detectLeaks() { if (skipLeakDetectionReason != null) { CanaryLog.d("Skipping leak detection because the test %s", skipLeakDetectionReason); skipLeakDetectionReason = null; return; } InstrumentationLeakDetector leakDetector = new InstrumentationLeakDetector(); InstrumentationLeakResults results = leakDetector.detectLeaks(); reportLeaks(results); }