add crash log

This commit is contained in:
Kr328 committed 2020-02-23 22:54:13 +08:00
1 parent e34a7a3081
commit de87e3fd74
2 files changed
+12 -9

No files matched your search

@@ -8,10 +8,7 @@ import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.os.Binder
import android.os.Build
import android.os.IBinder
import android.os.IInterface
import android.os.*
import androidx.collection.CircularArray
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
@@ -27,6 +24,8 @@ import com.github.kr328.clash.service.util.createLanguageConfigurationContext
import com.github.kr328.clash.service.util.intent
import com.github.kr328.clash.utils.format
import com.github.kr328.clash.utils.logsDir
import com.microsoft.appcenter.analytics.Analytics
import com.microsoft.appcenter.crashes.Crashes
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.selects.select
@@ -57,7 +56,9 @@ class LogcatService : Service(), CoroutineScope by MainScope(), IInterface {
private val connection = object : ServiceConnection {
override fun onServiceDisconnected(name: ComponentName?) {
stopSelf()
logChannel.offer(LogEvent(LogEvent.Level.ERROR, "Clash Service Crashed"))
Crashes.trackError(RemoteException("Clash Service Crashed"))
}
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
@@ -153,6 +153,10 @@ class ProxyAdapter(
groupPosition = groupCache
activeList = activeCache
result.dispatchUpdatesTo(this@ProxyAdapter)
groupCache.forEach { (_, u) ->
notifyItemChanged(u)
}
}
}
@@ -190,8 +194,6 @@ class ProxyAdapter(
is ProxyGroupHeader -> {
val current = renderList[position] as ProxyGroupRenderInfo
groupPosition[current.name] = position
holder.title.text = context.getString(R.string.format_proxy_group_title,
current.info.name, current.info.current)
holder.urlTest.setOnClickListener {
@@ -221,8 +223,6 @@ class ProxyAdapter(
holder.delay.text = if (current.info.selectable) "" else "N/A"
if (current.info.active) {
activeList[current.group] = position
holder.prefix.setTextColor(Color.WHITE)
holder.content.setTextColor(Color.WHITE)
holder.delay.setTextColor(Color.WHITE)
@@ -246,6 +246,8 @@ class ProxyAdapter(
renderList[position] = new.copy(info = new.info.copy(active = true))
renderList[groupPosition] = group.copy(info = group.info.copy(current = current.name))
activeList[current.group] = position
notifyItemChanged(oldPosition)
notifyItemChanged(position)
notifyItemChanged(groupPosition)