Commit 2d80a47e authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Remove LeakSentry, only configure LeakCanary

parent b74f136a
......@@ -169,9 +169,8 @@ dependencies {
implementation 'io.sentry:sentry-android:3.2.0'
implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
implementation 'com.squareup.leakcanary:leaksentry:2.0-alpha-3'
leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'
leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
implementation "com.squareup.okhttp3:okhttp:4.9.0"
implementation 'com.github.AppIntro:AppIntro:6.0.0'
......
......@@ -38,7 +38,6 @@ import com.frostnerd.smokescreen.util.proxy.IpTablesPacketRedirector
import io.sentry.NoOpLogger
import io.sentry.android.core.BuildInfoProvider
import io.sentry.android.core.util.RootChecker
import leakcanary.LeakSentry
import java.net.Inet4Address
import java.net.Inet6Address
import java.net.InetAddress
......@@ -410,18 +409,6 @@ private fun createTlsUpstreamAddress(host: String): TLSUpstreamAddress {
else TLSUpstreamAddress(parsedHost)
}
fun LeakSentry.watchIfEnabled(watchedInstance: Any) {
if(BuildConfig.LEAK_DETECTION) {
refWatcher.watch(watchedInstance)
}
}
fun LeakSentry.watchIfEnabled(watchedInstance: Any, name:String) {
if(BuildConfig.LEAK_DETECTION) {
refWatcher.watch(watchedInstance, name)
}
}
fun String.equalsAny(vararg options:String, ignoreCase:Boolean = false):Boolean {
return options.any {
it.equals(this, ignoreCase)
......
......@@ -11,7 +11,6 @@ import io.sentry.Sentry
import io.sentry.SentryEvent
import io.sentry.SentryLevel
import io.sentry.protocol.Message
import leakcanary.LeakSentry
import java.io.*
import java.text.SimpleDateFormat
import java.util.*
......@@ -65,7 +64,6 @@ private fun Context.logErrorSentry(e: Throwable, extras: Map<String, String>? =
this.message = e.message
}
level = SentryLevel.ERROR
setExtra("retainedInstanceCount", LeakSentry.refWatcher.retainedInstanceCount)
})
} else if (getPreferences().crashreportingType == Crashreporting.FULL && extras != null && extras.isNotEmpty()) {
log("Sending exception with extras")
......@@ -78,7 +76,6 @@ private fun Context.logErrorSentry(e: Throwable, extras: Map<String, String>? =
extras.forEach { (key, value) ->
setTag(key, value)
}
setExtra("retainedInstanceCount", LeakSentry.refWatcher.retainedInstanceCount)
})
} else {
log("Sending exception to Sentry without extras")
......
......@@ -27,7 +27,7 @@ import io.sentry.protocol.User
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import leakcanary.LeakSentry
import leakcanary.LeakCanary
import org.minidns.dnsmessage.DnsMessage
import org.minidns.dnsmessage.Question
import org.minidns.record.A
......@@ -135,13 +135,11 @@ class SmokeScreen : Application() {
}
override fun onCreate() {
if(!BuildConfig.LEAK_DETECTION) LeakSentry.config = LeakSentry.config.copy(enabled = false)
initSentry()
defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler()
Thread.setDefaultUncaughtExceptionHandler(customUncaughtExceptionHandler)
super.onCreate()
log("Application created.")
LeakSentry.watchIfEnabled(this)
handleFallbackDns()
loadKnownDNSServers()
AbstractQuicDnsHandle.installProvider(this, {})
......
......@@ -34,7 +34,6 @@ import com.frostnerd.vpntunnelproxy.RetryingVPNTunnelProxy
import com.frostnerd.vpntunnelproxy.TrafficStats
import com.frostnerd.vpntunnelproxy.VPNTunnelProxy
import kotlinx.coroutines.*
import leakcanary.LeakSentry
import org.minidns.dnsname.DnsName
import org.minidns.record.Record
import java.io.ByteArrayInputStream
......@@ -224,7 +223,6 @@ class DnsVpnService : VpnService(), Runnable, CoroutineScope {
}
getPreferences().vpnServiceState = VpnServiceState.STARTED
getPreferences().vpnLaunchLastVersion = BuildConfig.VERSION_CODE
LeakSentry.watchIfEnabled(this, "DnsVpnService")
Thread.setDefaultUncaughtExceptionHandler { t, e ->
log("Encountered an uncaught exception.")
destroy()
......
......@@ -18,8 +18,6 @@ import com.frostnerd.smokescreen.util.DeepActionState
import com.frostnerd.smokescreen.util.LanguageContextWrapper
import com.frostnerd.smokescreen.util.Notifications
import com.frostnerd.smokescreen.util.RequestCodes
import com.frostnerd.smokescreen.watchIfEnabled
import leakcanary.LeakSentry
import java.io.BufferedWriter
import java.io.OutputStreamWriter
import java.io.Serializable
......@@ -58,7 +56,6 @@ class RuleExportService : IntentService("RuleExportService") {
override fun onCreate() {
super.onCreate()
LeakSentry.watchIfEnabled(this, "RuleExportService")
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Notifications.ID_DNSRULE_EXPORT_FINISHED)
}
......
......@@ -17,7 +17,6 @@ import com.frostnerd.smokescreen.util.DeepActionState
import com.frostnerd.smokescreen.util.LanguageContextWrapper
import com.frostnerd.smokescreen.util.Notifications
import com.frostnerd.smokescreen.util.RequestCodes
import leakcanary.LeakSentry
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
......@@ -77,7 +76,6 @@ class RuleImportService : IntentService("RuleImportService") {
override fun onCreate() {
super.onCreate()
LeakSentry.watchIfEnabled(this, "RuleImportService")
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Notifications.ID_DNSRULE_IMPORT_FINISHED)
}
......
......@@ -14,8 +14,6 @@ import com.frostnerd.preferenceskt.typedpreferences.TypedPreferences
import com.frostnerd.smokescreen.R
import com.frostnerd.smokescreen.getPreferences
import com.frostnerd.smokescreen.util.preferences.VpnServiceState
import com.frostnerd.smokescreen.watchIfEnabled
import leakcanary.LeakSentry
/*
* Copyright (C) 2019 Daniel Wolf (Ch4t4r)
......@@ -48,7 +46,6 @@ class StartStopTileService:TileService() {
override fun onCreate() {
super.onCreate()
LeakSentry.watchIfEnabled(this, "StartStopTileService")
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
......
......@@ -10,8 +10,6 @@ import com.frostnerd.smokescreen.activity.BackgroundVpnConfigureActivity
import com.frostnerd.smokescreen.log
import com.frostnerd.smokescreen.util.LanguageContextWrapper
import com.frostnerd.smokescreen.util.Notifications
import com.frostnerd.smokescreen.watchIfEnabled
import leakcanary.LeakSentry
/*
* Copyright (C) 2019 Daniel Wolf (Ch4t4r)
......@@ -44,7 +42,6 @@ class VpnRestartService : Service() {
override fun onCreate() {
super.onCreate()
LeakSentry.watchIfEnabled(this, "VpnRestartService")
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment