Add dumpsys wifip2p to debug info
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package be.mygod.vpnhotspot
|
package be.mygod.vpnhotspot
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -48,8 +49,30 @@ class SettingsPreferenceFragment : PreferenceFragmentCompatDividers() {
|
|||||||
}
|
}
|
||||||
writer.write("\n")
|
writer.write("\n")
|
||||||
writer.flush()
|
writer.flush()
|
||||||
|
val commands = StringBuilder()
|
||||||
|
// https://android.googlesource.com/platform/external/iptables/+/android-7.0.0_r1/iptables/Android.mk#34
|
||||||
|
val iptablesSave = if (Build.VERSION.SDK_INT >= 24) "iptables-save" else {
|
||||||
|
commands.appendln("ln -sf /system/bin/iptables ./iptables-save")
|
||||||
|
"./iptables-save"
|
||||||
|
}
|
||||||
|
commands.append("""
|
||||||
|
|echo logcat-su
|
||||||
|
|logcat -d
|
||||||
|
|echo
|
||||||
|
|echo dumpsys ${Context.WIFI_P2P_SERVICE}
|
||||||
|
|dumpsys ${Context.WIFI_P2P_SERVICE}
|
||||||
|
|echo
|
||||||
|
|echo iptables
|
||||||
|
|$iptablesSave
|
||||||
|
|echo
|
||||||
|
|echo iptables -t nat
|
||||||
|
|$iptablesSave -t nat
|
||||||
|
|echo
|
||||||
|
|echo ip rule
|
||||||
|
|ip rule
|
||||||
|
""".trimMargin())
|
||||||
try {
|
try {
|
||||||
Routing.dump()?.use { it.copyTo(out) }
|
loggerSuStream(commands.toString())?.use { it.copyTo(out) }
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace(writer)
|
e.printStackTrace(writer)
|
||||||
writer.flush()
|
writer.flush()
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import android.os.Build
|
|||||||
import be.mygod.vpnhotspot.App.Companion.app
|
import be.mygod.vpnhotspot.App.Companion.app
|
||||||
import be.mygod.vpnhotspot.R
|
import be.mygod.vpnhotspot.R
|
||||||
import be.mygod.vpnhotspot.debugLog
|
import be.mygod.vpnhotspot.debugLog
|
||||||
import be.mygod.vpnhotspot.loggerSuStream
|
|
||||||
import be.mygod.vpnhotspot.noisySu
|
import be.mygod.vpnhotspot.noisySu
|
||||||
import java.io.InputStream
|
|
||||||
import java.net.Inet4Address
|
import java.net.Inet4Address
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.net.NetworkInterface
|
import java.net.NetworkInterface
|
||||||
@@ -32,29 +30,6 @@ class Routing(val upstream: String?, val downstream: String, ownerAddress: InetA
|
|||||||
"$IPTABLES -t nat -F vpnhotspot_masquerade",
|
"$IPTABLES -t nat -F vpnhotspot_masquerade",
|
||||||
"$IPTABLES -t nat -X vpnhotspot_masquerade",
|
"$IPTABLES -t nat -X vpnhotspot_masquerade",
|
||||||
"quiet while ip rule del priority 17900; do done")
|
"quiet while ip rule del priority 17900; do done")
|
||||||
|
|
||||||
fun dump(): InputStream? {
|
|
||||||
val commands = StringBuilder()
|
|
||||||
// https://android.googlesource.com/platform/external/iptables/+/android-7.0.0_r1/iptables/Android.mk#34
|
|
||||||
val iptablesSave = if (Build.VERSION.SDK_INT >= 24) "iptables-save" else {
|
|
||||||
commands.appendln("ln -sf /system/bin/iptables ./iptables-save")
|
|
||||||
"./iptables-save"
|
|
||||||
}
|
|
||||||
commands.append("""
|
|
||||||
|echo logcat-su
|
|
||||||
|logcat -d
|
|
||||||
|echo
|
|
||||||
|echo iptables
|
|
||||||
|$iptablesSave
|
|
||||||
|echo
|
|
||||||
|echo iptables -t nat
|
|
||||||
|$iptablesSave -t nat
|
|
||||||
|echo
|
|
||||||
|echo ip rule
|
|
||||||
|ip rule
|
|
||||||
""".trimMargin())
|
|
||||||
return loggerSuStream(commands.toString())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class InterfaceNotFoundException : SocketException() {
|
class InterfaceNotFoundException : SocketException() {
|
||||||
|
|||||||
Reference in New Issue
Block a user