Skip to content

Commit

Permalink
Merge pull request #2099 from square/py/retry_analysis_failure
Browse files Browse the repository at this point in the history
Button to retry on analysis failure
  • Loading branch information
pyricau authored Mar 25, 2021
2 parents b5b3bf0 + e8194f1 commit 6374c23
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.squareup.leakcanary.core.R
import leakcanary.LeakCanary
import leakcanary.internal.HeapAnalyzerService
import leakcanary.internal.activity.db.HeapAnalysisTable
import leakcanary.internal.activity.db.executeOnDb
import leakcanary.internal.activity.shareHeapDump
Expand Down Expand Up @@ -45,7 +47,12 @@ internal class HeapAnalysisFailureScreen(
) {
activity.title = resources.getString(R.string.leak_canary_analysis_failed)

val failureText = """
val failureText =
if (heapDumpFileExist) {
"You can <a href=\"try_again\">run the analysis again</a>.<br><br>"
} else {
""
} + """
Please <a href="file_issue">click here</a> to file a bug report.
The stacktrace details will be copied into the clipboard and you just need to paste into the
GitHub issue description.""" + (if (heapDumpFileExist) {
Expand All @@ -69,6 +76,16 @@ internal class HeapAnalysisFailureScreen(
shareHeapDump(heapAnalysis.heapDumpFile)
}
}
"try_again"-> {
{
HeapAnalyzerService.runAnalysis(
context = context,
heapDumpFile = heapAnalysis.heapDumpFile,
heapDumpDurationMillis = heapAnalysis.dumpDurationMillis,
heapDumpReason = "Retrying heap analysis after failure."
)
}
}
else -> null
}
}
Expand Down

0 comments on commit 6374c23

Please sign in to comment.