From cfd1e0cf2266919b91b18c367263885f6fec3322 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 18 Jun 2024 11:26:18 -0700 Subject: [PATCH] Update libsu and dependencies --- app/build.gradle.kts | 6 +-- .../java/com/topjohnwu/magisk/core/App.kt | 4 +- .../magisk/core/utils/DispatcherExecutor.kt | 40 ------------------- buildSrc/build.gradle.kts | 2 +- 4 files changed, 6 insertions(+), 46 deletions(-) delete mode 100644 app/src/main/java/com/topjohnwu/magisk/core/utils/DispatcherExecutor.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 30c94f083..dc8065e36 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -80,7 +80,7 @@ dependencies { implementation("dev.rikka.rikkax.recyclerview:recyclerview-ktx:1.3.2") implementation("io.noties.markwon:core:4.6.2") - val vLibsu = "5.2.2" + val vLibsu = "5.3.0" implementation("com.github.topjohnwu.libsu:core:${vLibsu}") implementation("com.github.topjohnwu.libsu:service:${vLibsu}") implementation("com.github.topjohnwu.libsu:nio:${vLibsu}") @@ -110,9 +110,9 @@ dependencies { implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") - implementation("androidx.appcompat:appcompat:1.6.1") + implementation("androidx.appcompat:appcompat:1.7.0") implementation("androidx.recyclerview:recyclerview:1.3.2") - implementation("androidx.fragment:fragment-ktx:1.7.1") + implementation("androidx.fragment:fragment-ktx:1.8.0") implementation("androidx.transition:transition:1.5.0") implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.core:core-splashscreen:1.0.1") diff --git a/app/src/main/java/com/topjohnwu/magisk/core/App.kt b/app/src/main/java/com/topjohnwu/magisk/core/App.kt index 6519533cf..a92b2bb98 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/App.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/App.kt @@ -10,7 +10,6 @@ import androidx.profileinstaller.ProfileInstaller import com.topjohnwu.magisk.BuildConfig import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.di.ServiceLocator -import com.topjohnwu.magisk.core.utils.DispatcherExecutor import com.topjohnwu.magisk.core.utils.NetworkObserver import com.topjohnwu.magisk.core.utils.ProcessLifecycle import com.topjohnwu.magisk.core.utils.RootUtils @@ -24,6 +23,7 @@ import com.topjohnwu.superuser.internal.UiThreadHandler import com.topjohnwu.superuser.ipc.RootService import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.asExecutor import kotlinx.coroutines.launch import timber.log.Timber import java.lang.ref.WeakReference @@ -73,7 +73,7 @@ open class App() : Application() { .setInitializers(ShellInit::class.java) .setContext(base) .setTimeout(2)) - Shell.EXECUTOR = DispatcherExecutor(Dispatchers.IO) + Shell.EXECUTOR = Dispatchers.IO.asExecutor() RootUtils.bindTask = RootService.bindOrTask( intent(), UiThreadHandler.executor, diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/DispatcherExecutor.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/DispatcherExecutor.kt deleted file mode 100644 index 6d2160864..000000000 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/DispatcherExecutor.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.topjohnwu.magisk.core.utils - -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Runnable -import kotlinx.coroutines.SupervisorJob -import kotlinx.coroutines.launch -import java.util.concurrent.AbstractExecutorService -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit - -class DispatcherExecutor(dispatcher: CoroutineDispatcher) : AbstractExecutorService() { - - private val job = SupervisorJob() - private val scope = CoroutineScope(job + dispatcher) - private val latch = CountDownLatch(1) - - init { - job.invokeOnCompletion { latch.countDown() } - } - - override fun execute(command: Runnable) { - scope.launch { - command.run() - } - } - - override fun shutdown() = job.cancel() - - override fun shutdownNow(): List { - job.cancel() - return emptyList() - } - - override fun isShutdown() = job.isCancelled - - override fun isTerminated() = job.isCancelled && job.isCompleted - - override fun awaitTermination(timeout: Long, unit: TimeUnit) = latch.await(timeout, unit) -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4d2344972..c179934dd 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -17,7 +17,7 @@ gradlePlugin { dependencies { implementation(embeddedKotlin("gradle-plugin")) - implementation("com.android.tools.build:gradle:8.4.1") + implementation("com.android.tools.build:gradle:8.5.0") implementation("androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7") implementation("org.lsposed.lsparanoid:gradle-plugin:0.5.2") implementation("org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r")