1
0
mirror of https://github.com/etesync/android synced 2025-07-05 14:22:37 +00:00

Crash reporting: including username when possible.

This commit is contained in:
Tom Hacohen 2020-10-27 09:37:10 +02:00
parent 8006ad1196
commit 586ad902c6
2 changed files with 9 additions and 1 deletions

View File

@ -52,6 +52,7 @@ import com.etesync.syncadapter.utils.ShowcaseBuilder
import com.etesync.syncadapter.utils.packageInstalled import com.etesync.syncadapter.utils.packageInstalled
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import org.acra.ACRA
import org.jetbrains.anko.doAsync import org.jetbrains.anko.doAsync
import tourguide.tourguide.ToolTip import tourguide.tourguide.ToolTip
import java.util.logging.Level import java.util.logging.Level
@ -105,6 +106,9 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
title = account.name title = account.name
settings = AccountSettings(this, account) settings = AccountSettings(this, account)
// Set it for ACRA in case we crash in any of the user views
ACRA.getErrorReporter().putCustomData("username", account.name)
setContentView(R.layout.activity_account) setContentView(R.layout.activity_account)
val icMenu = ContextCompat.getDrawable(this, R.drawable.ic_menu_light) val icMenu = ContextCompat.getDrawable(this, R.drawable.ic_menu_light)

View File

@ -27,9 +27,9 @@ import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import at.bitfire.ical4android.TaskProvider.ProviderName import at.bitfire.ical4android.TaskProvider.ProviderName
import at.bitfire.vcard4android.ContactsStorageException import at.bitfire.vcard4android.ContactsStorageException
import com.etesync.journalmanager.Exceptions.HttpException
import com.etesync.syncadapter.* import com.etesync.syncadapter.*
import com.etesync.syncadapter.Constants.KEY_ACCOUNT import com.etesync.syncadapter.Constants.KEY_ACCOUNT
import com.etesync.journalmanager.Exceptions.HttpException
import com.etesync.syncadapter.log.Logger import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.EntryEntity import com.etesync.syncadapter.model.EntryEntity
import com.etesync.syncadapter.model.JournalEntity import com.etesync.syncadapter.model.JournalEntity
@ -66,6 +66,10 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
fun onShare(item: MenuItem) { fun onShare(item: MenuItem) {
ACRA.getErrorReporter().putCustomData("debug_info", report) ACRA.getErrorReporter().putCustomData("debug_info", report)
val account: Account? = intent.extras?.getParcelable(KEY_ACCOUNT)
if (account != null) {
ACRA.getErrorReporter().putCustomData("username", account.name)
}
ACRA.getErrorReporter().handleException(intent.extras?.getSerializable(KEY_THROWABLE) as Throwable?) ACRA.getErrorReporter().handleException(intent.extras?.getSerializable(KEY_THROWABLE) as Throwable?)
ACRA.getErrorReporter().removeCustomData("debug_info") ACRA.getErrorReporter().removeCustomData("debug_info")
} }