Skip to content

Commit

Permalink
fix: TimeoutException of root validation
Browse files Browse the repository at this point in the history
Caused by java.io.IOException: Shell check timeout
       at com.topjohnwu.superuser.internal.ShellImpl.<init>(ShellImpl.java:103)
       at com.topjohnwu.superuser.internal.BuilderImpl.b(BuilderImpl.java:2)
       at com.topjohnwu.superuser.internal.BuilderImpl.build(BuilderImpl.java:13)
       at com.topjohnwu.superuser.internal.BuilderImpl.build(BuilderImpl.java:100)
       at com.topjohnwu.superuser.internal.MainShell.get(MainShell.java:37)
       at com.topjohnwu.superuser.Shell.getShell(Shell.java:21)
       at com.xayah.databackup.ui.activity.guide.page.env.EnvKt$PageEnv$onClicks$1$1$1.invokeSuspend(Env.kt:21)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:8)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:105)
       at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:3)
       at kotlinx.coroutines.scheduling.TaskImpl.run(TaskImpl.java:2)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:95)

Change-Id: Iae55479461d64355b374a976d7023538e9aa9296
  • Loading branch information
XayahSuSuSu committed Oct 5, 2023
1 parent ba321c9 commit 0ff98f8
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.xayah.databackup.ui.token.State
import com.xayah.databackup.util.command.EnvUtil
import com.xayah.databackup.util.command.PreparationUtil
import com.xayah.databackup.util.saveAppVersionName
import com.xayah.librootservice.util.ExceptionUtil.tryOnScope
import com.xayah.librootservice.util.withIOContext
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
Expand Down Expand Up @@ -73,13 +74,15 @@ fun PageEnv(viewModel: GuideViewModel) {
{
if (states.value[0] != State.Succeed)
runAndValidate {
withIOContext {
val statesList = states.value.toMutableList()
statesList[0] = if (Shell.getShell().isRoot) State.Succeed else State.Failed
states.value = statesList.toList()
tryOnScope {
withIOContext {
val statesList = states.value.toMutableList()
statesList[0] = if (Shell.getShell().isRoot) State.Succeed else State.Failed
states.value = statesList.toList()

// Kill daemon
PreparationUtil.killDaemon(context)
// Kill daemon
PreparationUtil.killDaemon(context)
}
}
}
},
Expand Down

0 comments on commit 0ff98f8

Please sign in to comment.