feat: Enhance KPM configuration checking,

- remove unused imports, update mmrl versions
This commit is contained in:
ShirkNeko
2025-05-18 04:06:36 +08:00
parent 28aa34c0b6
commit 6d60e54a7d
5 changed files with 41 additions and 12 deletions

View File

@@ -1023,6 +1023,18 @@ private fun checkKpmConfigured(): Boolean {
} catch (e: Exception) {
e.printStackTrace()
}
try {
val process = Runtime.getRuntime().exec("su -c grep sukisu_kpm /proc/kallsyms")
val reader = BufferedReader(InputStreamReader(process.inputStream))
if (reader.readLine() != null) {
reader.close()
return true
}
reader.close()
} catch (e: Exception) {
e.printStackTrace()
}
return false
}

View File

@@ -20,8 +20,6 @@ import java.text.Collator
import java.util.*
import com.dergoogler.mmrl.platform.Platform
import com.dergoogler.mmrl.platform.TIMEOUT_MILLIS
import com.sukisu.ultra.ui.webui.packageManager
import com.sukisu.ultra.ui.webui.userManager
import kotlinx.coroutines.delay
import kotlinx.coroutines.withTimeoutOrNull

View File

@@ -3,8 +3,6 @@ package com.sukisu.ultra.ui.webui
import android.content.ServiceConnection
import android.util.Log
import com.dergoogler.mmrl.platform.Platform
import com.dergoogler.mmrl.platform.hiddenApi.HiddenPackageManager
import com.dergoogler.mmrl.platform.hiddenApi.HiddenUserManager
import com.dergoogler.mmrl.platform.model.IProvider
import com.dergoogler.mmrl.platform.model.PlatformIntent
import com.sukisu.ultra.ksuApp
@@ -55,8 +53,4 @@ suspend fun initPlatform() = withContext(Dispatchers.IO) {
Log.e("KsuLibSu", "Failed to initialize platform", e)
return@withContext false
}
}
val Platform.Companion.packageManager get(): HiddenPackageManager = HiddenPackageManager(this.mService)
val Platform.Companion.userManager get(): HiddenUserManager = HiddenUserManager(this.mService)
}

View File

@@ -12,8 +12,8 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import com.dergoogler.mmrl.webui.interfaces.WXInterface
import com.dergoogler.mmrl.webui.interfaces.WXOptions
import com.dergoogler.mmrl.webui.interfaces.WebUIInterface
import com.dergoogler.mmrl.webui.model.JavaScriptInterface
import com.topjohnwu.superuser.CallbackList
import com.topjohnwu.superuser.ShellUtils
@@ -30,19 +30,44 @@ import java.util.concurrent.CompletableFuture
class WebViewInterface(
wxOptions: WXOptions,
) : WebUIInterface(wxOptions) {
) : WXInterface(wxOptions) {
override var name: String = "ksu"
companion object {
private var isSecondaryScreenState by mutableStateOf(false)
private var windowInsetsController: WindowInsetsControllerCompat? = null
fun factory() = JavaScriptInterface(WebViewInterface::class.java)
fun updateSecondaryScreenState(isSecondary: Boolean) {
isSecondaryScreenState = isSecondary
windowInsetsController?.let { controller ->
if (isSecondary) {
controller.show(WindowInsetsCompat.Type.systemBars())
controller.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_DEFAULT
} else {
controller.systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}
}
}
fun setWindowInsetsController(controller: WindowInsetsControllerCompat) {
windowInsetsController = controller
}
}
init {
if (context is Activity) {
setWindowInsetsController(WindowInsetsControllerCompat(
activity.window,
activity.window.decorView
))
}
}
private val modDir get() = "/data/adb/modules/${modId.id}"
@JavascriptInterface

View File

@@ -22,7 +22,7 @@ compose-material3 = "1.3.2"
compose-ui = "1.8.0"
compose-foundation = "1.7.8"
documentfile = "1.0.1"
mmrl = "v33560"
mmrl = "v33624"
[plugins]
agp-app = { id = "com.android.application", version.ref = "agp" }