mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 19:15:58 +00:00
Request Shizuku permission before enter Shizuku screen
Bind Shizuku service automatically after enter Shizuku functions page
This commit is contained in:
@@ -3,23 +3,18 @@ package com.bintianqi.owndroid.dpm
|
||||
import android.system.Os
|
||||
import androidx.annotation.Keep
|
||||
import com.bintianqi.owndroid.IUserService
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
|
||||
val shizukuService = MutableStateFlow<IUserService?>(null)
|
||||
|
||||
@Keep
|
||||
class ShizukuService: IUserService.Stub() {
|
||||
override fun destroy() { }
|
||||
|
||||
override fun execute(command: String): String {
|
||||
var result = ""
|
||||
val process: Process
|
||||
try {
|
||||
process = Runtime.getRuntime().exec(command)
|
||||
val exitCode = process.waitFor()
|
||||
if(exitCode != 0){ result += "Error: $exitCode" }
|
||||
if(exitCode != 0) { result += "Error: $exitCode" }
|
||||
} catch(e: Exception) {
|
||||
e.printStackTrace()
|
||||
return e.toString()
|
||||
@@ -34,11 +29,8 @@ class ShizukuService: IUserService.Stub() {
|
||||
} catch(e: NullPointerException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if(result == "") { return "No result" }
|
||||
return result
|
||||
}
|
||||
|
||||
override fun getUid(): Int {
|
||||
return Os.getuid()
|
||||
}
|
||||
override fun getUid(): Int = Os.getuid()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user