Improve error logs on Android Q beta

This commit is contained in:
Mygod
2019-03-18 21:58:30 +08:00
parent d641af5d40
commit f1cf44c628
2 changed files with 8 additions and 2 deletions

View File

@@ -1,9 +1,13 @@
package be.mygod.vpnhotspot.net
import android.system.ErrnoException
import android.system.OsConstants
import androidx.core.os.BuildCompat
import be.mygod.vpnhotspot.room.macToLong
import be.mygod.vpnhotspot.util.parseNumericAddress
import timber.log.Timber
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
import java.lang.NumberFormatException
import java.net.InetAddress
@@ -94,7 +98,8 @@ data class IpNeighbour(val ip: InetAddress, val dev: String, val lladdr: Long, v
.filter { it.size >= 6 && mac.matcher(it[ARP_HW_ADDRESS]).matches() }
.toList()
} catch (e: IOException) {
Timber.w(e)
if (e !is FileNotFoundException || !BuildCompat.isAtLeastQ() ||
(e.cause as? ErrnoException)?.errno != OsConstants.EACCES) Timber.w(e)
}
return arpCache
}