Skip to content
Snippets Groups Projects
Commit 83eec13f authored by Muntashir Al-Islam's avatar Muntashir Al-Islam :speech_balloon:
Browse files

Avoid waiting for the remote server to respond when no-root mode is set

parent a7100d19
No related branches found
No related tags found
No related merge requests found
......@@ -246,22 +246,24 @@ public class Ops {
autoDetectRootSystemOrAdbAndPersist(context);
return sIsAdb ? STATUS_SUCCESS : initPermissionsWithSuccess();
}
if (!force && isAMServiceUpAndRunning(context, mode)) {
// An instance of AMService is already running
return sIsAdb ? STATUS_SUCCESS : initPermissionsWithSuccess();
}
if (MODE_NO_ROOT.equals(mode)) {
sDirectRoot = false;
sIsAdb = sIsSystem = sIsRoot = false;
// Also, stop existing services if any
ExUtils.exceptionAsIgnored(() -> {
if (LocalServer.alive(context)) {
LocalServer.getInstance().closeBgServer();
}
});
LocalServices.stopServices();
if (LocalServices.alive()) {
LocalServices.stopServices();
}
if (LocalServer.alive(context)) {
// We don't care about its results
ThreadUtils.postOnBackgroundThread(() -> ExUtils.exceptionAsIgnored(() ->
LocalServer.getInstance().closeBgServer()));
}
return STATUS_SUCCESS;
}
if (!force && isAMServiceUpAndRunning(context, mode)) {
// An instance of AMService is already running
return sIsAdb ? STATUS_SUCCESS : initPermissionsWithSuccess();
}
try {
switch (mode) {
case MODE_ROOT:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment