Add more logging

This commit is contained in:
Mygod
2018-06-10 20:26:36 +08:00
parent 55e8b684df
commit e2cbe18ea9
18 changed files with 76 additions and 18 deletions

View File

@@ -18,6 +18,7 @@ import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.util.ServiceForegroundConnector
import be.mygod.vpnhotspot.util.formatAddresses
import com.crashlytics.android.Crashlytics
import java.net.NetworkInterface
@TargetApi(26)
@@ -52,6 +53,7 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager()
view.context.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
} catch (exc: ActivityNotFoundException) {
exc.printStackTrace()
Crashlytics.logException(exc)
}
return
}

View File

@@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.support.v7.widget.RecyclerView
import android.view.View
import com.crashlytics.android.Crashlytics
object ManageBar : Manager() {
class ViewHolder(view: View) : RecyclerView.ViewHolder(view), View.OnClickListener {
@@ -25,8 +26,11 @@ object ManageBar : Manager() {
try {
context.startActivity(Intent()
.setClassName("com.android.settings", "com.android.settings.TetherSettings"))
e.printStackTrace()
Crashlytics.logException(e)
} catch (e: ActivityNotFoundException) {
e.printStackTrace()
Crashlytics.logException(e)
}
}
}

View File

@@ -26,6 +26,7 @@ import be.mygod.vpnhotspot.net.wifi.P2pSupplicantConfiguration
import be.mygod.vpnhotspot.net.wifi.WifiP2pDialog
import be.mygod.vpnhotspot.util.ServiceForegroundConnector
import be.mygod.vpnhotspot.util.formatAddresses
import com.crashlytics.android.Crashlytics
import java.net.NetworkInterface
import java.net.SocketException
@@ -49,6 +50,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
NetworkInterface.getByName(p2pInterface ?: return "")?.formatAddresses() ?: ""
} catch (e: SocketException) {
e.printStackTrace()
Crashlytics.logException(e)
""
}
}

View File

@@ -22,6 +22,7 @@ import be.mygod.vpnhotspot.databinding.ListitemManageTetherBinding
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import com.crashlytics.android.Crashlytics
import java.lang.reflect.InvocationTargetException
abstract class TetherManager private constructor(protected val parent: TetheringFragment) : Manager(),
@@ -47,12 +48,14 @@ abstract class TetherManager private constructor(protected val parent: Tethering
return
} catch (exc: ActivityNotFoundException) {
exc.printStackTrace()
Crashlytics.logException(exc)
}
val started = manager.isStarted
try {
if (started) manager.stop() else manager.start()
} catch (e: InvocationTargetException) {
e.printStackTrace()
Crashlytics.logException(e)
var cause: Throwable? = e
while (cause != null) {
cause = cause.cause

View File

@@ -26,6 +26,7 @@ import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.util.ServiceForegroundConnector
import be.mygod.vpnhotspot.util.broadcastReceiver
import com.crashlytics.android.Crashlytics
import java.net.NetworkInterface
import java.net.SocketException
@@ -51,6 +52,7 @@ class TetheringFragment : Fragment(), ServiceConnection {
NetworkInterface.getNetworkInterfaces().asSequence().associateBy { it.name }
} catch (e: SocketException) {
e.printStackTrace()
Crashlytics.logException(e)
emptyMap()
}
this@TetheringFragment.enabledTypes =