Merge pull request #4576 from ByteHamster/dont-spam-crash
Don't spam stacktrace when there is no crash report
This commit is contained in:
commit
7ed1e36ac3
|
@ -4,6 +4,7 @@ import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -22,6 +23,7 @@ import java.nio.charset.Charset;
|
||||||
* Displays the 'crash report' screen
|
* Displays the 'crash report' screen
|
||||||
*/
|
*/
|
||||||
public class BugReportActivity extends AppCompatActivity {
|
public class BugReportActivity extends AppCompatActivity {
|
||||||
|
private static final String TAG = "BugReportActivity";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -30,17 +32,20 @@ public class BugReportActivity extends AppCompatActivity {
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
setContentView(R.layout.bug_report);
|
setContentView(R.layout.bug_report);
|
||||||
|
|
||||||
String crashDetailsText = CrashReportWriter.getSystemInfo() + "\n\n";
|
String stacktrace = "No crash report recorded";
|
||||||
TextView crashDetailsTextView = findViewById(R.id.crash_report_logs);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File crashFile = CrashReportWriter.getFile();
|
File crashFile = CrashReportWriter.getFile();
|
||||||
crashDetailsText += IOUtils.toString(new FileInputStream(crashFile), Charset.forName("UTF-8"));
|
if (crashFile.exists()) {
|
||||||
|
stacktrace = IOUtils.toString(new FileInputStream(crashFile), Charset.forName("UTF-8"));
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, stacktrace);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
crashDetailsText += "No crash report recorded";
|
|
||||||
}
|
}
|
||||||
crashDetailsTextView.setText(crashDetailsText);
|
|
||||||
|
TextView crashDetailsTextView = findViewById(R.id.crash_report_logs);
|
||||||
|
crashDetailsTextView.setText(CrashReportWriter.getSystemInfo() + "\n\n" + stacktrace);
|
||||||
|
|
||||||
findViewById(R.id.btn_open_bug_tracker).setOnClickListener(v -> IntentUtils.openInBrowser(
|
findViewById(R.id.btn_open_bug_tracker).setOnClickListener(v -> IntentUtils.openInBrowser(
|
||||||
BugReportActivity.this, "https://github.com/AntennaPod/AntennaPod/issues"));
|
BugReportActivity.this, "https://github.com/AntennaPod/AntennaPod/issues"));
|
||||||
|
|
Loading…
Reference in New Issue