1
0
mirror of https://github.com/etesync/android synced 2025-05-29 12:18:54 +00:00

Debug info: add calling class information to reports.

This change makes it easier to detect if a debug report was actually due to a
real issue, or is just a user sending the debug activity without any real
issue behind it.

This is to battle the surprising amount of debug info spam we've had to battle
with. Essentially users sending debug info without actually experiencing any
issues and never replying to questions. This is made worse because many of
those emails also have weird addresses in CC which make it look even more
like some weird sort of spam.
This commit is contained in:
Tom Hacohen 2019-08-18 16:05:49 +01:00
parent 3c74cb1575
commit 58f16681aa
5 changed files with 16 additions and 8 deletions

View File

@ -131,7 +131,7 @@ class SyncNotification(internal val context: Context, internal val notificationT
WebViewActivity.openUrl(this, Constants.faqUri.buildUpon().encodedFragment("account-migration-error").build()) WebViewActivity.openUrl(this, Constants.faqUri.buildUpon().encodedFragment("account-migration-error").build())
return return
} else { } else {
detailsIntent = Intent(this, DebugInfoActivity::class.java) detailsIntent = DebugInfoActivity.newIntent(this, this::class.toString())
} }
detailsIntent.putExtras(intent.extras!!) detailsIntent.putExtras(intent.extras!!)
startActivity(detailsIntent) startActivity(detailsIntent)

View File

@ -13,10 +13,7 @@ import android.accounts.Account
import android.accounts.AccountManager import android.accounts.AccountManager
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.LoaderManager import android.app.LoaderManager
import android.content.AsyncTaskLoader import android.content.*
import android.content.ContentResolver
import android.content.Context
import android.content.Loader
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
@ -95,6 +92,7 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
override fun loadInBackground(): String { override fun loadInBackground(): String {
var throwable: Throwable? = null var throwable: Throwable? = null
var caller: String? = null
var logs: String? = null var logs: String? = null
var authority: String? = null var authority: String? = null
var account: Account? = null var account: Account? = null
@ -102,6 +100,7 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
if (extras != null) { if (extras != null) {
throwable = extras.getSerializable(KEY_THROWABLE) as Throwable? throwable = extras.getSerializable(KEY_THROWABLE) as Throwable?
caller = extras.getString(KEY_CALLER)
logs = extras.getString(KEY_LOGS) logs = extras.getString(KEY_LOGS)
account = extras.getParcelable(KEY_ACCOUNT) account = extras.getParcelable(KEY_ACCOUNT)
authority = extras.getString(KEY_AUTHORITY) authority = extras.getString(KEY_AUTHORITY)
@ -118,6 +117,8 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
report.append("Account name: ").append(account.name).append("\n") report.append("Account name: ").append(account.name).append("\n")
if (authority != null) if (authority != null)
report.append("Authority: ").append(authority).append("\n") report.append("Authority: ").append(authority).append("\n")
if (caller != null)
report.append("Debug activity source: ").append(caller).append("\n")
if (throwable is HttpException) { if (throwable is HttpException) {
val http = throwable as HttpException? val http = throwable as HttpException?
@ -233,10 +234,17 @@ class DebugInfoActivity : BaseActivity(), LoaderManager.LoaderCallbacks<String>
} }
companion object { companion object {
val KEY_CALLER = "caller"
val KEY_THROWABLE = "throwable" val KEY_THROWABLE = "throwable"
val KEY_LOGS = "logs" val KEY_LOGS = "logs"
val KEY_AUTHORITY = "authority" val KEY_AUTHORITY = "authority"
val KEY_PHASE = "phase" val KEY_PHASE = "phase"
fun newIntent(context: Context?, caller: String): Intent {
val intent = Intent(context, DebugInfoActivity::class.java)
intent.putExtra(KEY_CALLER, caller)
return intent
}
} }
} }

View File

@ -37,7 +37,7 @@ class ExceptionInfoFragment : DialogFragment() {
.setTitle(title) .setTitle(title)
.setMessage("${exception.javaClass.canonicalName}\n" + exception.localizedMessage) .setMessage("${exception.javaClass.canonicalName}\n" + exception.localizedMessage)
.setNegativeButton(R.string.exception_show_details) { _, _ -> .setNegativeButton(R.string.exception_show_details) { _, _ ->
val intent = Intent(context, DebugInfoActivity::class.java) val intent = DebugInfoActivity.newIntent(context, this::class.toString())
intent.putExtra(DebugInfoActivity.KEY_THROWABLE, exception) intent.putExtra(DebugInfoActivity.KEY_THROWABLE, exception)
if (account != null) if (account != null)
intent.putExtra(Constants.KEY_ACCOUNT, account) intent.putExtra(Constants.KEY_ACCOUNT, account)

View File

@ -75,7 +75,7 @@ class DetectConfigurationFragment : DialogFragment(), LoaderManager.LoaderCallba
.setIcon(R.drawable.ic_error_dark) .setIcon(R.drawable.ic_error_dark)
.setMessage(R.string.login_wrong_username_or_password) .setMessage(R.string.login_wrong_username_or_password)
.setNeutralButton(R.string.login_view_logs) { dialog, which -> .setNeutralButton(R.string.login_view_logs) { dialog, which ->
val intent = Intent(activity, DebugInfoActivity::class.java) val intent = DebugInfoActivity.newIntent(context, this::class.toString())
intent.putExtra(DebugInfoActivity.KEY_LOGS, arguments!!.getString(KEY_LOGS)) intent.putExtra(DebugInfoActivity.KEY_LOGS, arguments!!.getString(KEY_LOGS))
startActivity(intent) startActivity(intent)
} }

View File

@ -88,7 +88,7 @@ class LoginCredentialsChangeFragment : DialogFragment(), LoaderManager.LoaderCal
.setIcon(R.drawable.ic_error_dark) .setIcon(R.drawable.ic_error_dark)
.setMessage(R.string.login_wrong_username_or_password) .setMessage(R.string.login_wrong_username_or_password)
.setNeutralButton(R.string.login_view_logs) { dialog, which -> .setNeutralButton(R.string.login_view_logs) { dialog, which ->
val intent = Intent(activity, DebugInfoActivity::class.java) val intent = DebugInfoActivity.newIntent(context, this::class.toString())
intent.putExtra(DebugInfoActivity.KEY_LOGS, arguments!!.getString(KEY_LOGS)) intent.putExtra(DebugInfoActivity.KEY_LOGS, arguments!!.getString(KEY_LOGS))
startActivity(intent) startActivity(intent)
} }