mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Fix: RootInstaller Crash (Closes #120)
This commit is contained in:
parent
e573545533
commit
862c8e7321
@ -3,7 +3,6 @@ package com.looker.droidify.installer
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.looker.droidify.content.Cache
|
import com.looker.droidify.content.Cache
|
||||||
import com.looker.droidify.utility.extension.android.Android
|
|
||||||
import com.topjohnwu.superuser.Shell
|
import com.topjohnwu.superuser.Shell
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -26,6 +25,7 @@ class RootInstaller(context: Context) : BaseInstaller(context) {
|
|||||||
override suspend fun uninstall(packageName: String) = mRootUninstaller(packageName)
|
override suspend fun uninstall(packageName: String) = mRootUninstaller(packageName)
|
||||||
|
|
||||||
private suspend fun mRootInstaller(cacheFile: File) {
|
private suspend fun mRootInstaller(cacheFile: File) {
|
||||||
|
Log.e("UserID", getCurrentUserState)
|
||||||
val installCommand =
|
val installCommand =
|
||||||
String.format(
|
String.format(
|
||||||
ROOT_INSTALL_PACKAGE,
|
ROOT_INSTALL_PACKAGE,
|
||||||
@ -55,9 +55,9 @@ class RootInstaller(context: Context) : BaseInstaller(context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val getCurrentUserState: String =
|
private val getCurrentUserState: String =
|
||||||
if (Android.sdk(25)) Shell.su("am get-current-user").exec().out[0]
|
Shell.su("dumpsys activity | grep -E \"mUserLru\"")
|
||||||
else Shell.su("dumpsys activity | grep mCurrentUser").exec().out[0].trim()
|
.exec().out[0].trim()
|
||||||
.removePrefix("mCurrentUser=")
|
.removePrefix("mUserLru: [").removeSuffix("]")
|
||||||
|
|
||||||
private val String.quote
|
private val String.quote
|
||||||
get() = "\"${this.replace(Regex("""[\\$"`]""")) { c -> "\\${c.value}" }}\""
|
get() = "\"${this.replace(Regex("""[\\$"`]""")) { c -> "\\${c.value}" }}\""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user