Crash reporting: including username when possible.

pull/146/head
Tom Hacohen 4 years ago
parent 8006ad1196
commit 586ad902c6

@ -52,6 +52,7 @@ import com.etesync.syncadapter.utils.ShowcaseBuilder
import com.etesync.syncadapter.utils.packageInstalled
import com.google.android.material.snackbar.Snackbar
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import org.acra.ACRA
import org.jetbrains.anko.doAsync
import tourguide.tourguide.ToolTip
import java.util.logging.Level
@ -105,6 +106,9 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
title = account.name
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)
val icMenu = ContextCompat.getDrawable(this, R.drawable.ic_menu_light)

@ -27,9 +27,9 @@ import android.widget.TextView
import androidx.core.content.ContextCompat
import at.bitfire.ical4android.TaskProvider.ProviderName
import at.bitfire.vcard4android.ContactsStorageException
import com.etesync.journalmanager.Exceptions.HttpException
import com.etesync.syncadapter.*
import com.etesync.syncadapter.Constants.KEY_ACCOUNT
import com.etesync.journalmanager.Exceptions.HttpException
import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.EntryEntity
import com.etesync.syncadapter.model.JournalEntity
@ -66,6 +66,10 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
fun onShare(item: MenuItem) {
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().removeCustomData("debug_info")
}

Loading…
Cancel
Save