This commit is contained in:
parent
0e252b3751
commit
0239820321
|
@ -20,6 +20,8 @@ import com.android.grape.util.ScriptUtil
|
||||||
import com.android.grape.util.ShellUtils
|
import com.android.grape.util.ShellUtils
|
||||||
import com.android.grape.util.StoragePermissionHelper
|
import com.android.grape.util.StoragePermissionHelper
|
||||||
import com.android.grape.util.Util
|
import com.android.grape.util.Util
|
||||||
|
import com.android.grape.util.Util.AUTO_JSPACKAGENAME
|
||||||
|
import com.android.grape.util.Util.killRecordProcess
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
private val viewModel by viewModels<MainViewModel>()
|
private val viewModel by viewModels<MainViewModel>()
|
||||||
|
@ -42,8 +44,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
MonitorService.onEvent(MainApplication.instance)
|
MonitorService.onEvent(MainApplication.instance)
|
||||||
}
|
}
|
||||||
viewBinding.stop.setOnClickListener {
|
viewBinding.stop.setOnClickListener {
|
||||||
val isRoot = ShellUtils.hasRootAccess()
|
killRecordProcess(this, packageName)
|
||||||
Log.d("TAG", "onCreate: isRoot $isRoot")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,10 @@ public class ShellUtils {
|
||||||
|
|
||||||
public static String execRootCmdAndGetResult(String cmd) {
|
public static String execRootCmdAndGetResult(String cmd) {
|
||||||
Log.d("ShellUtils", "execRootCmdAndGetResult - Started execution for command: " + cmd);
|
Log.d("ShellUtils", "execRootCmdAndGetResult - Started execution for command: " + cmd);
|
||||||
if (!isCommandSafe(cmd)) { // 检查命令的合法性
|
// if (!isCommandSafe(cmd)) { // 检查命令的合法性
|
||||||
Log.e("ShellUtils", "Detected unsafe command. Aborting execution.");
|
// Log.e("ShellUtils", "Detected unsafe command. Aborting execution.");
|
||||||
throw new IllegalArgumentException("Detected unsafe command.");
|
// throw new IllegalArgumentException("Detected unsafe command.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
Process process = null;
|
Process process = null;
|
||||||
ExecutorService executor = Executors.newFixedThreadPool(2);
|
ExecutorService executor = Executors.newFixedThreadPool(2);
|
||||||
|
|
Loading…
Reference in New Issue