diff --git a/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt b/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt index 8113e71c..86f98dc4 100644 --- a/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt +++ b/mobile/src/main/java/be/mygod/librootkotlinx/RootServer.kt @@ -88,6 +88,8 @@ class RootServer { } } + class UnexpectedExitException : RemoteException("Root process exited unexpectedly") + private lateinit var process: Process /** * Thread safety: needs to be protected by mutex. @@ -206,7 +208,7 @@ class RootServer { } try { callbackSpin() - if (active) throw RemoteException("Root process exited unexpectedly") + if (active) throw UnexpectedExitException() } catch (e: Throwable) { process.destroy() throw e @@ -317,6 +319,8 @@ class RootServer { } catch (e: TimeoutCancellationException) { Logger.me.w("Closing the instance has timed out", e) if (Build.VERSION.SDK_INT < 26) process.destroy() else if (process.isAlive) process.destroyForcibly() + } catch (e: UnexpectedExitException) { + Logger.me.w(e.message) } } diff --git a/mobile/src/main/java/be/mygod/librootkotlinx/RootSession.kt b/mobile/src/main/java/be/mygod/librootkotlinx/RootSession.kt index 2a863099..e9a3689b 100644 --- a/mobile/src/main/java/be/mygod/librootkotlinx/RootSession.kt +++ b/mobile/src/main/java/be/mygod/librootkotlinx/RootSession.kt @@ -58,11 +58,7 @@ abstract class RootSession { mutex.withLock { check(usersCount == 0L) timeoutJob = null - try { - closeLocked() - } catch (e: Exception) { - Logger.me.e("Closing RootServer on timeout failed", e) - } + closeLocked() } } }