Merge branch 'fix-sui-without-shizuku-app' into 'master'
Fix AuroraOSS/AuroraStore#981 allow Sui without Shizuku app Closes #981 See merge request AuroraOSS/AuroraStore!270
This commit is contained in:
@@ -31,6 +31,7 @@ import com.aurora.store.util.Preferences
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import rikka.shizuku.Shizuku
|
||||
import rikka.sui.Sui
|
||||
|
||||
open class AppInstaller private constructor(var context: Context) {
|
||||
|
||||
@@ -83,6 +84,10 @@ open class AppInstaller private constructor(var context: Context) {
|
||||
return PackageUtil.isInstalled(context, ShizukuInstaller.SHIZUKU_PACKAGE_NAME)
|
||||
}
|
||||
|
||||
fun hasShizukuOrSui(context: Context): Boolean {
|
||||
return hasShizuku(context) || Sui.isSui()
|
||||
}
|
||||
|
||||
fun hasShizukuPerm(): Boolean {
|
||||
return Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
@@ -136,7 +141,7 @@ open class AppInstaller private constructor(var context: Context) {
|
||||
}
|
||||
5 -> {
|
||||
if (isOAndAbove()) {
|
||||
val installer = if (hasShizuku(context) && hasShizukuPerm()) {
|
||||
val installer = if (hasShizukuOrSui(context) && hasShizukuPerm()) {
|
||||
ShizukuInstaller(context)
|
||||
} else {
|
||||
SessionInstaller(context)
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.aurora.store.R
|
||||
import com.aurora.store.data.installer.AppInstaller.Companion.hasAppManager
|
||||
import com.aurora.store.data.installer.AppInstaller.Companion.hasRootAccess
|
||||
import com.aurora.store.data.installer.AppInstaller.Companion.hasShizuku
|
||||
import com.aurora.store.data.installer.AppInstaller.Companion.hasShizukuOrSui
|
||||
import com.aurora.store.data.installer.AppInstaller.Companion.hasShizukuPerm
|
||||
import com.aurora.store.data.model.Installer
|
||||
import com.aurora.store.databinding.FragmentOnboardingInstallerBinding
|
||||
@@ -42,6 +43,7 @@ import com.aurora.store.view.epoxy.views.preference.InstallerViewModel_
|
||||
import com.aurora.store.view.ui.commons.BaseFragment
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import rikka.shizuku.Shizuku
|
||||
import rikka.sui.Sui
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
|
||||
@@ -52,7 +54,7 @@ class InstallerFragment : BaseFragment(R.layout.fragment_onboarding_installer) {
|
||||
|
||||
private var installerId: Int = 0
|
||||
|
||||
private var shizukuAlive = false
|
||||
private var shizukuAlive = Sui.isSui()
|
||||
private val shizukuAliveListener = Shizuku.OnBinderReceivedListener {
|
||||
Log.d("ShizukuInstaller Alive!")
|
||||
shizukuAlive = true
|
||||
@@ -154,7 +156,7 @@ class InstallerFragment : BaseFragment(R.layout.fragment_onboarding_installer) {
|
||||
}
|
||||
}
|
||||
5 -> {
|
||||
if (hasShizuku(requireContext()) && isOAndAbove()) {
|
||||
if (hasShizukuOrSui(requireContext()) && isOAndAbove()) {
|
||||
if (shizukuAlive && hasShizukuPerm()) {
|
||||
this.installerId = installerId
|
||||
save(PREFERENCE_INSTALLER_ID, installerId)
|
||||
|
||||
@@ -47,11 +47,12 @@ import com.aurora.store.view.custom.preference.ListPreferenceMaterialDialogFragm
|
||||
import com.aurora.store.view.custom.preference.ListPreferenceMaterialDialogFragmentCompat.Companion.PREFERENCE_DIALOG_FRAGMENT_TAG
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import rikka.shizuku.Shizuku
|
||||
import rikka.sui.Sui
|
||||
|
||||
|
||||
class InstallationPreference : PreferenceFragmentCompat() {
|
||||
|
||||
private var shizukuAlive = false
|
||||
private var shizukuAlive = Sui.isSui()
|
||||
private val shizukuAliveListener = Shizuku.OnBinderReceivedListener {
|
||||
Log.d("ShizukuInstaller Alive!")
|
||||
shizukuAlive = true
|
||||
@@ -156,7 +157,7 @@ class InstallationPreference : PreferenceFragmentCompat() {
|
||||
false
|
||||
}
|
||||
} else if (selectedId == 5) {
|
||||
if (AppInstaller.hasShizuku(requireContext()) && isOAndAbove()) {
|
||||
if (AppInstaller.hasShizukuOrSui(requireContext()) && isOAndAbove()) {
|
||||
if (shizukuAlive && AppInstaller.hasShizukuPerm()) {
|
||||
save(Preferences.PREFERENCE_INSTALLER_ID, selectedId)
|
||||
true
|
||||
@@ -225,7 +226,7 @@ class InstallationPreference : PreferenceFragmentCompat() {
|
||||
}
|
||||
|
||||
private fun checkShizukuAvailability(): Boolean {
|
||||
return PackageUtil.isInstalled(requireContext(), ShizukuInstaller.SHIZUKU_PACKAGE_NAME) &&
|
||||
return (PackageUtil.isInstalled(requireContext(), ShizukuInstaller.SHIZUKU_PACKAGE_NAME) || Sui.isSui()) &&
|
||||
shizukuAlive && Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user