feat: Enhance KPM configuration checking,
- remove unused imports, update mmrl versions
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user