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) { } catch (e: Exception) {
e.printStackTrace() 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 return false
} }

View File

@@ -20,8 +20,6 @@ import java.text.Collator
import java.util.* import java.util.*
import com.dergoogler.mmrl.platform.Platform import com.dergoogler.mmrl.platform.Platform
import com.dergoogler.mmrl.platform.TIMEOUT_MILLIS 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.delay
import kotlinx.coroutines.withTimeoutOrNull import kotlinx.coroutines.withTimeoutOrNull

View File

@@ -3,8 +3,6 @@ package com.sukisu.ultra.ui.webui
import android.content.ServiceConnection import android.content.ServiceConnection
import android.util.Log import android.util.Log
import com.dergoogler.mmrl.platform.Platform 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.IProvider
import com.dergoogler.mmrl.platform.model.PlatformIntent import com.dergoogler.mmrl.platform.model.PlatformIntent
import com.sukisu.ultra.ksuApp import com.sukisu.ultra.ksuApp
@@ -56,7 +54,3 @@ suspend fun initPlatform() = withContext(Dispatchers.IO) {
return@withContext false 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.compose.runtime.setValue
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat 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.WXOptions
import com.dergoogler.mmrl.webui.interfaces.WebUIInterface
import com.dergoogler.mmrl.webui.model.JavaScriptInterface import com.dergoogler.mmrl.webui.model.JavaScriptInterface
import com.topjohnwu.superuser.CallbackList import com.topjohnwu.superuser.CallbackList
import com.topjohnwu.superuser.ShellUtils import com.topjohnwu.superuser.ShellUtils
@@ -30,18 +30,43 @@ import java.util.concurrent.CompletableFuture
class WebViewInterface( class WebViewInterface(
wxOptions: WXOptions, wxOptions: WXOptions,
) : WebUIInterface(wxOptions) { ) : WXInterface(wxOptions) {
override var name: String = "ksu" override var name: String = "ksu"
companion object { companion object {
private var isSecondaryScreenState by mutableStateOf(false) private var isSecondaryScreenState by mutableStateOf(false)
private var windowInsetsController: WindowInsetsControllerCompat? = null
fun factory() = JavaScriptInterface(WebViewInterface::class.java) fun factory() = JavaScriptInterface(WebViewInterface::class.java)
fun updateSecondaryScreenState(isSecondary: Boolean) { fun updateSecondaryScreenState(isSecondary: Boolean) {
isSecondaryScreenState = isSecondary 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}" private val modDir get() = "/data/adb/modules/${modId.id}"

View File

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