Reduce garbage logs

This commit is contained in:
Mygod
2018-12-29 23:11:09 +08:00
parent 5c935348e7
commit ddd3bfab2f
4 changed files with 9 additions and 8 deletions

View File

@@ -12,7 +12,6 @@ import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
import be.mygod.vpnhotspot.util.StickyEvent1
import be.mygod.vpnhotspot.util.broadcastReceiver
import be.mygod.vpnhotspot.widget.SmartSnackbar
import timber.log.Timber
@RequiresApi(26)
class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
@@ -35,7 +34,6 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
fun stop() = reservation?.close()
}
private class StartFailure(message: String) : RuntimeException(message)
private val binder = Binder()
private var reservation: WifiManager.LocalOnlyHotspotReservation? = null
@@ -105,9 +103,6 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
else -> getString(R.string.failure_reason_unknown, reason)
})
SmartSnackbar.make(message).show()
if (reason != WifiManager.LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE) {
Timber.i(StartFailure(message))
}
startFailure()
}
}, app.handler)

View File

@@ -3,8 +3,8 @@ package be.mygod.vpnhotspot.net.wifi
import android.net.wifi.p2p.WifiP2pGroup
import android.os.Build
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.timberSetString
import be.mygod.vpnhotspot.util.RootSession
import timber.log.Timber
import java.io.File
/**
@@ -14,6 +14,7 @@ import java.io.File
*/
class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress: String?) {
companion object {
private const val TAG = "P2pSupplicantConfiguration"
private val networkParser =
"^(bssid=(([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})|psk=(ext:|\"(.*)\"|[0-9a-fA-F]{64}\$))".toRegex()
private val whitespaceMatcher = "\\s+".toRegex()
@@ -78,8 +79,9 @@ class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress:
}
Pair(result, target!!)
} catch (e: RuntimeException) {
Timber.w("Failed to parse p2p_supplicant.conf, ownerAddress: $ownerAddress, P2P group: $group")
Timber.w(parser.lines.joinToString("\n"))
timberSetString(TAG, parser.lines.joinToString("\n"))
timberSetString("$TAG.ownerAddress", ownerAddress)
timberSetString("$TAG.p2pGroup", group.toString())
throw e
}
}