diff --git a/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt b/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt index d2c2b238..b171baeb 100644 --- a/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt +++ b/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt @@ -206,9 +206,7 @@ class RootServer { } val errorReader = async(Dispatchers.IO) { try { - process.errorStream.bufferedReader().useLines { seq -> - for (line in seq) Logger.me.w(line) - } + process.errorStream.bufferedReader().forEachLine(Logger.me::w) } catch (_: IOException) { } } try { diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt index 03139ecc..a930a10a 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt @@ -120,7 +120,7 @@ data class IpNeighbour(val ip: InetAddress, val dev: String, val lladdr: MacAddr .toList() private fun arp(): List> { if (System.nanoTime() - arpCacheTime >= ARP_CACHE_EXPIRE) try { - arpCache = File("/proc/net/arp").bufferedReader().lineSequence().makeArp() + arpCache = File("/proc/net/arp").bufferedReader().useLines { it.makeArp() } } catch (e: IOException) { if (e is FileNotFoundException && Build.VERSION.SDK_INT >= 29 && (e.cause as? ErrnoException)?.errno == OsConstants.EACCES) try { diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/root/MiscCommands.kt b/mobile/src/main/java/be/mygod/vpnhotspot/root/MiscCommands.kt index e8f41d99..e0b85712 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/root/MiscCommands.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/root/MiscCommands.kt @@ -124,7 +124,7 @@ class ProcessListener(private val terminateRegex: Regex, @Parcelize class ReadArp : RootCommand { override suspend fun execute() = withContext(Dispatchers.IO) { - ParcelableString(File("/proc/net/arp").bufferedReader().readText()) + ParcelableString(File("/proc/net/arp").readText()) } } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/root/RepeaterCommands.kt b/mobile/src/main/java/be/mygod/vpnhotspot/root/RepeaterCommands.kt index 9e9f3bd1..0e84a5eb 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/root/RepeaterCommands.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/root/RepeaterCommands.kt @@ -61,7 +61,7 @@ object RepeaterCommands { File(if (legacy) CONF_PATH_LEGACY else CONF_PATH_TREBLE).writeText(data) for (process in File("/proc").listFiles { _, name -> TextUtils.isDigitsOnly(name) }!!) { val cmdline = try { - File(process, "cmdline").inputStream().bufferedReader().readText() + File(process, "cmdline").inputStream().bufferedReader().use { it.readText() } } catch (_: IOException) { continue }