Use exec whenever possible
This commit is contained in:
@@ -177,7 +177,7 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
|
|||||||
if (status != Status.IDLE) return START_NOT_STICKY
|
if (status != Status.IDLE) return START_NOT_STICKY
|
||||||
status = Status.STARTING
|
status = Status.STARTING
|
||||||
val matcher = WifiP2pManagerHelper.patternNetworkInfo.matcher(
|
val matcher = WifiP2pManagerHelper.patternNetworkInfo.matcher(
|
||||||
loggerSu("dumpsys ${Context.WIFI_P2P_SERVICE}") ?: "")
|
loggerSu("exec dumpsys ${Context.WIFI_P2P_SERVICE}") ?: "")
|
||||||
when {
|
when {
|
||||||
!matcher.find() -> startFailure(getString(R.string.root_unavailable))
|
!matcher.find() -> startFailure(getString(R.string.root_unavailable))
|
||||||
matcher.group(2) == "true" -> {
|
matcher.group(2) == "true" -> {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ abstract class IpMonitor : Runnable {
|
|||||||
thread("${javaClass.simpleName}-input") {
|
thread("${javaClass.simpleName}-input") {
|
||||||
// monitor may get rejected by SELinux
|
// monitor may get rejected by SELinux
|
||||||
val monitor = ProcessBuilder("sh", "-c",
|
val monitor = ProcessBuilder("sh", "-c",
|
||||||
"ip monitor $monitoredObject || su -c 'ip monitor $monitoredObject'")
|
"ip monitor $monitoredObject || exec su -c 'exec ip monitor $monitoredObject'")
|
||||||
.redirectErrorStream(true)
|
.redirectErrorStream(true)
|
||||||
.start()
|
.start()
|
||||||
this.monitor = monitor
|
this.monitor = monitor
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class P2pSupplicantConfiguration(private val initContent: String? = null) : Parc
|
|||||||
}
|
}
|
||||||
override fun describeContents() = 0
|
override fun describeContents() = 0
|
||||||
|
|
||||||
private val contentDelegate = lazy { initContent ?: loggerSu("cat /data/misc/wifi/p2p_supplicant.conf") }
|
private val contentDelegate = lazy { initContent ?: loggerSu("exec cat /data/misc/wifi/p2p_supplicant.conf") }
|
||||||
private val content by contentDelegate
|
private val content by contentDelegate
|
||||||
|
|
||||||
fun readPsk(handler: ((RuntimeException) -> Unit)? = null): String? {
|
fun readPsk(handler: ((RuntimeException) -> Unit)? = null): String? {
|
||||||
|
|||||||
Reference in New Issue
Block a user