mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-08 00:39:54 +00:00
Improve: Dont Check Root Permission Recursively
This commit is contained in:
parent
df8dc09897
commit
06f6d2b56c
@ -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.Utils.rootInstallerEnabled
|
|
||||||
import com.looker.droidify.utility.extension.android.Android
|
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
|
||||||
@ -23,7 +22,6 @@ 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) {
|
||||||
if (rootInstallerEnabled) {
|
|
||||||
val installCommand =
|
val installCommand =
|
||||||
String.format(
|
String.format(
|
||||||
ROOT_INSTALL_PACKAGE,
|
ROOT_INSTALL_PACKAGE,
|
||||||
@ -45,15 +43,12 @@ class RootInstaller(context: Context) : BaseInstaller(context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun mRootUninstaller(packageName: String) {
|
private suspend fun mRootUninstaller(packageName: String) {
|
||||||
if (rootInstallerEnabled) {
|
|
||||||
val uninstallCommand =
|
val uninstallCommand =
|
||||||
String.format(ROOT_UNINSTALL_PACKAGE, getCurrentUserState, packageName)
|
String.format(ROOT_UNINSTALL_PACKAGE, getCurrentUserState, packageName)
|
||||||
withContext(Dispatchers.IO) { launch { Shell.su(uninstallCommand).submit() } }
|
withContext(Dispatchers.IO) { launch { Shell.su(uninstallCommand).submit() } }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private val getCurrentUserState: String =
|
private val getCurrentUserState: String =
|
||||||
if (Android.sdk(25)) Shell.su("am get-current-user").exec().out[0]
|
if (Android.sdk(25)) Shell.su("am get-current-user").exec().out[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user