installer: Put more details into installerinfo
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import android.content.Intent
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.data.installer.base.InstallerBase
|
import com.aurora.store.data.installer.base.InstallerBase
|
||||||
|
import com.aurora.store.data.model.Installer
|
||||||
import com.aurora.store.data.model.InstallerInfo
|
import com.aurora.store.data.model.InstallerInfo
|
||||||
import com.aurora.store.data.room.download.Download
|
import com.aurora.store.data.room.download.Download
|
||||||
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
|
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
|
||||||
@@ -25,14 +26,16 @@ class AMInstaller @Inject constructor(
|
|||||||
const val AM_PACKAGE_NAME = "io.github.muntashirakon.AppManager"
|
const val AM_PACKAGE_NAME = "io.github.muntashirakon.AppManager"
|
||||||
const val AM_DEBUG_PACKAGE_NAME = "io.github.muntashirakon.AppManager.debug"
|
const val AM_DEBUG_PACKAGE_NAME = "io.github.muntashirakon.AppManager.debug"
|
||||||
|
|
||||||
fun getInstallerInfo(context: Context): InstallerInfo {
|
val installerInfo: InstallerInfo
|
||||||
return InstallerInfo(
|
get() = InstallerInfo(
|
||||||
id = 4,
|
id = 4,
|
||||||
title = context.getString(R.string.pref_install_mode_am),
|
installer = Installer.AM,
|
||||||
subtitle = context.getString(R.string.am_installer_subtitle),
|
packageNames = listOf(AM_PACKAGE_NAME, AM_DEBUG_PACKAGE_NAME),
|
||||||
description = context.getString(R.string.am_installer_desc)
|
installerPackageNames = listOf(AM_PACKAGE_NAME, AM_DEBUG_PACKAGE_NAME),
|
||||||
|
title = R.string.pref_install_mode_am,
|
||||||
|
subtitle = R.string.am_installer_subtitle,
|
||||||
|
description = R.string.am_installer_desc
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val TAG = AMInstaller::class.java.simpleName
|
private val TAG = AMInstaller::class.java.simpleName
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import android.content.Intent
|
|||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.core.content.pm.PackageInfoCompat
|
import androidx.core.content.pm.PackageInfoCompat
|
||||||
import com.aurora.extensions.getUpdateOwnerPackageNameCompat
|
import com.aurora.extensions.getUpdateOwnerPackageNameCompat
|
||||||
import com.aurora.extensions.isOAndAbove
|
import com.aurora.extensions.isOAndAbove
|
||||||
@@ -68,28 +67,14 @@ class AppInstaller @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getAvailableInstallersInfo(context: Context): List<InstallerInfo> {
|
fun getAvailableInstallersInfo(context: Context): List<InstallerInfo> {
|
||||||
val installers = mutableListOf(
|
return listOfNotNull(
|
||||||
SessionInstaller.getInstallerInfo(context),
|
SessionInstaller.installerInfo,
|
||||||
NativeInstaller.getInstallerInfo(context)
|
NativeInstaller.installerInfo,
|
||||||
|
if (hasRootAccess()) RootInstaller.installerInfo else null,
|
||||||
|
if (hasAuroraService(context)) ServiceInstaller.installerInfo else null,
|
||||||
|
if (hasAppManager(context)) AMInstaller.installerInfo else null,
|
||||||
|
if (hasShizukuOrSui(context)) ShizukuInstaller.installerInfo else null
|
||||||
)
|
)
|
||||||
|
|
||||||
if (hasRootAccess()) {
|
|
||||||
installers.add(RootInstaller.getInstallerInfo(context))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasAuroraService(context)) {
|
|
||||||
installers.add(ServiceInstaller.getInstallerInfo(context))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasAppManager(context)) {
|
|
||||||
installers.add(AMInstaller.getInstallerInfo(context))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isOAndAbove && hasShizukuOrSui(context)) {
|
|
||||||
installers.add(ShizukuInstaller.getInstallerInfo(context))
|
|
||||||
}
|
|
||||||
|
|
||||||
return installers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,12 +131,11 @@ class AppInstaller @Inject constructor(
|
|||||||
PackageUtil.isInstalled(context, AMInstaller.AM_DEBUG_PACKAGE_NAME)
|
PackageUtil.isInstalled(context, AMInstaller.AM_DEBUG_PACKAGE_NAME)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
fun hasShizukuOrSui(context: Context): Boolean {
|
fun hasShizukuOrSui(context: Context): Boolean {
|
||||||
return PackageUtil.isInstalled(
|
return isOAndAbove && (PackageUtil.isInstalled(
|
||||||
context,
|
context,
|
||||||
ShizukuInstaller.SHIZUKU_PACKAGE_NAME
|
ShizukuInstaller.SHIZUKU_PACKAGE_NAME
|
||||||
) || Sui.isSui()
|
) || Sui.isSui())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasShizukuPerm(): Boolean {
|
fun hasShizukuPerm(): Boolean {
|
||||||
@@ -185,7 +169,7 @@ class AppInstaller @Inject constructor(
|
|||||||
Installer.SERVICE -> if (hasAuroraService(context)) serviceInstaller else defaultInstaller
|
Installer.SERVICE -> if (hasAuroraService(context)) serviceInstaller else defaultInstaller
|
||||||
Installer.AM -> if (hasAppManager(context)) amInstaller else defaultInstaller
|
Installer.AM -> if (hasAppManager(context)) amInstaller else defaultInstaller
|
||||||
Installer.SHIZUKU -> {
|
Installer.SHIZUKU -> {
|
||||||
if (isOAndAbove && hasShizukuOrSui(context) && hasShizukuPerm()) {
|
if (hasShizukuOrSui(context) && hasShizukuPerm()) {
|
||||||
shizukuInstaller
|
shizukuInstaller
|
||||||
} else {
|
} else {
|
||||||
defaultInstaller
|
defaultInstaller
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import android.util.Log
|
|||||||
import com.aurora.extensions.runOnUiThread
|
import com.aurora.extensions.runOnUiThread
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.data.installer.base.InstallerBase
|
import com.aurora.store.data.installer.base.InstallerBase
|
||||||
|
import com.aurora.store.data.model.BuildType
|
||||||
|
import com.aurora.store.data.model.Installer
|
||||||
import com.aurora.store.data.model.InstallerInfo
|
import com.aurora.store.data.model.InstallerInfo
|
||||||
import com.aurora.store.data.room.download.Download
|
import com.aurora.store.data.room.download.Download
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
@@ -42,14 +44,16 @@ class NativeInstaller @Inject constructor(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun getInstallerInfo(context: Context): InstallerInfo {
|
val installerInfo: InstallerInfo
|
||||||
return InstallerInfo(
|
get() = InstallerInfo(
|
||||||
id = 1,
|
id = 1,
|
||||||
title = context.getString(R.string.pref_install_mode_native),
|
installer = Installer.NATIVE,
|
||||||
subtitle = context.getString(R.string.native_installer_subtitle),
|
packageNames = BuildType.PACKAGE_NAMES,
|
||||||
description = context.getString(R.string.native_installer_desc)
|
installerPackageNames = BuildType.PACKAGE_NAMES,
|
||||||
|
title = R.string.pref_install_mode_native,
|
||||||
|
subtitle = R.string.native_installer_subtitle,
|
||||||
|
description = R.string.native_installer_desc
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val TAG = NativeInstaller::class.java.simpleName
|
private val TAG = NativeInstaller::class.java.simpleName
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import com.aurora.store.AuroraApp
|
|||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.data.event.InstallerEvent
|
import com.aurora.store.data.event.InstallerEvent
|
||||||
import com.aurora.store.data.installer.base.InstallerBase
|
import com.aurora.store.data.installer.base.InstallerBase
|
||||||
|
import com.aurora.store.data.model.BuildType
|
||||||
|
import com.aurora.store.data.model.Installer
|
||||||
import com.aurora.store.data.model.InstallerInfo
|
import com.aurora.store.data.model.InstallerInfo
|
||||||
import com.aurora.store.data.room.download.Download
|
import com.aurora.store.data.room.download.Download
|
||||||
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
|
import com.aurora.store.util.PackageUtil.isSharedLibraryInstalled
|
||||||
@@ -40,15 +42,18 @@ class RootInstaller @Inject constructor(
|
|||||||
) : InstallerBase(context) {
|
) : InstallerBase(context) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
const val PLAY_PACKAGE_NAME = "com.android.vending"
|
||||||
|
|
||||||
fun getInstallerInfo(context: Context): InstallerInfo {
|
val installerInfo: InstallerInfo
|
||||||
return InstallerInfo(
|
get() = InstallerInfo(
|
||||||
id = 2,
|
id = 2,
|
||||||
title = context.getString(R.string.pref_install_mode_root),
|
installer = Installer.ROOT,
|
||||||
subtitle = context.getString(R.string.root_installer_subtitle),
|
packageNames = BuildType.PACKAGE_NAMES,
|
||||||
description = context.getString(R.string.root_installer_desc)
|
installerPackageNames = listOf(PLAY_PACKAGE_NAME),
|
||||||
|
title = R.string.pref_install_mode_root,
|
||||||
|
subtitle = R.string.root_installer_subtitle,
|
||||||
|
description = R.string.root_installer_desc
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val TAG = RootInstaller::class.java.simpleName
|
private val TAG = RootInstaller::class.java.simpleName
|
||||||
@@ -83,7 +88,7 @@ class RootInstaller @Inject constructor(
|
|||||||
totalSize += file.length().toInt()
|
totalSize += file.length().toInt()
|
||||||
|
|
||||||
val result: Shell.Result =
|
val result: Shell.Result =
|
||||||
Shell.cmd("pm install-create -i com.android.vending --user 0 -r -S $totalSize")
|
Shell.cmd("pm install-create -i $PLAY_PACKAGE_NAME --user 0 -r -S $totalSize")
|
||||||
.exec()
|
.exec()
|
||||||
|
|
||||||
val response = result.out
|
val response = result.out
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.aurora.store.BuildConfig
|
|||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.data.event.InstallerEvent
|
import com.aurora.store.data.event.InstallerEvent
|
||||||
import com.aurora.store.data.installer.base.InstallerBase
|
import com.aurora.store.data.installer.base.InstallerBase
|
||||||
|
import com.aurora.store.data.model.Installer
|
||||||
import com.aurora.store.data.model.InstallerInfo
|
import com.aurora.store.data.model.InstallerInfo
|
||||||
import com.aurora.store.data.room.download.Download
|
import com.aurora.store.data.room.download.Download
|
||||||
import com.aurora.store.util.PackageUtil
|
import com.aurora.store.util.PackageUtil
|
||||||
@@ -62,14 +63,16 @@ class ServiceInstaller @Inject constructor(
|
|||||||
const val PRIVILEGED_EXTENSION_PACKAGE_NAME = "com.aurora.services"
|
const val PRIVILEGED_EXTENSION_PACKAGE_NAME = "com.aurora.services"
|
||||||
const val PRIVILEGED_EXTENSION_SERVICE_INTENT = "com.aurora.services.IPrivilegedService"
|
const val PRIVILEGED_EXTENSION_SERVICE_INTENT = "com.aurora.services.IPrivilegedService"
|
||||||
|
|
||||||
fun getInstallerInfo(context: Context): InstallerInfo {
|
val installerInfo: InstallerInfo
|
||||||
return InstallerInfo(
|
get() = InstallerInfo(
|
||||||
id = 3,
|
id = 3,
|
||||||
title = context.getString(R.string.pref_install_mode_services),
|
installer = Installer.SERVICE,
|
||||||
subtitle = context.getString(R.string.services_installer_subtitle),
|
packageNames = listOf(PRIVILEGED_EXTENSION_PACKAGE_NAME),
|
||||||
description = context.getString(R.string.services_installer_desc)
|
installerPackageNames = listOf(PRIVILEGED_EXTENSION_PACKAGE_NAME),
|
||||||
|
title = R.string.pref_install_mode_services,
|
||||||
|
subtitle = R.string.services_installer_subtitle,
|
||||||
|
description = R.string.services_installer_desc
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val TAG = ServiceInstaller::class.java.simpleName
|
private val TAG = ServiceInstaller::class.java.simpleName
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_DISPLAY_NAME
|
|||||||
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_PACKAGE_NAME
|
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_PACKAGE_NAME
|
||||||
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_VERSION_CODE
|
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_VERSION_CODE
|
||||||
import com.aurora.store.data.installer.base.InstallerBase
|
import com.aurora.store.data.installer.base.InstallerBase
|
||||||
|
import com.aurora.store.data.model.BuildType
|
||||||
|
import com.aurora.store.data.model.Installer
|
||||||
import com.aurora.store.data.model.InstallerInfo
|
import com.aurora.store.data.model.InstallerInfo
|
||||||
import com.aurora.store.data.model.SessionInfo
|
import com.aurora.store.data.model.SessionInfo
|
||||||
import com.aurora.store.data.receiver.InstallerStatusReceiver
|
import com.aurora.store.data.receiver.InstallerStatusReceiver
|
||||||
@@ -113,14 +115,16 @@ class SessionInstaller @Inject constructor(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun getInstallerInfo(context: Context): InstallerInfo {
|
val installerInfo: InstallerInfo
|
||||||
return InstallerInfo(
|
get() = InstallerInfo(
|
||||||
id = 0,
|
id = 0,
|
||||||
title = context.getString(R.string.pref_install_mode_session),
|
installer = Installer.SESSION,
|
||||||
subtitle = context.getString(R.string.session_installer_subtitle),
|
packageNames = BuildType.PACKAGE_NAMES,
|
||||||
description = context.getString(R.string.session_installer_desc)
|
installerPackageNames = BuildType.PACKAGE_NAMES,
|
||||||
|
title = R.string.pref_install_mode_session,
|
||||||
|
subtitle = R.string.session_installer_subtitle,
|
||||||
|
description = R.string.session_installer_desc
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_DISPLAY_NAME
|
|||||||
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_PACKAGE_NAME
|
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_PACKAGE_NAME
|
||||||
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_VERSION_CODE
|
import com.aurora.store.data.installer.AppInstaller.Companion.EXTRA_VERSION_CODE
|
||||||
import com.aurora.store.data.installer.base.InstallerBase
|
import com.aurora.store.data.installer.base.InstallerBase
|
||||||
|
import com.aurora.store.data.model.Installer
|
||||||
import com.aurora.store.data.model.InstallerInfo
|
import com.aurora.store.data.model.InstallerInfo
|
||||||
import com.aurora.store.data.receiver.InstallerStatusReceiver
|
import com.aurora.store.data.receiver.InstallerStatusReceiver
|
||||||
import com.aurora.store.data.room.download.Download
|
import com.aurora.store.data.room.download.Download
|
||||||
@@ -62,15 +63,18 @@ class ShizukuInstaller @Inject constructor(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val SHIZUKU_PACKAGE_NAME = "moe.shizuku.privileged.api"
|
const val SHIZUKU_PACKAGE_NAME = "moe.shizuku.privileged.api"
|
||||||
|
const val PLAY_PACKAGE_NAME = "com.android.vending"
|
||||||
|
|
||||||
fun getInstallerInfo(context: Context): InstallerInfo {
|
val installerInfo: InstallerInfo
|
||||||
return InstallerInfo(
|
get() = InstallerInfo(
|
||||||
id = 5,
|
id = 5,
|
||||||
title = context.getString(R.string.pref_install_mode_shizuku),
|
installer = Installer.SHIZUKU,
|
||||||
subtitle = context.getString(R.string.shizuku_installer_subtitle),
|
packageNames = listOf(SHIZUKU_PACKAGE_NAME),
|
||||||
description = context.getString(R.string.shizuku_installer_desc)
|
installerPackageNames = listOf(PLAY_PACKAGE_NAME),
|
||||||
|
title = R.string.pref_install_mode_shizuku,
|
||||||
|
subtitle = R.string.shizuku_installer_subtitle,
|
||||||
|
description = R.string.shizuku_installer_desc
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val TAG = ShizukuInstaller::class.java.simpleName
|
private val TAG = ShizukuInstaller::class.java.simpleName
|
||||||
@@ -90,11 +94,11 @@ class ShizukuInstaller @Inject constructor(
|
|||||||
private val packageInstaller: PackageInstaller? by lazy {
|
private val packageInstaller: PackageInstaller? by lazy {
|
||||||
if (isSAndAbove) {
|
if (isSAndAbove) {
|
||||||
Refine.unsafeCast<PackageInstaller>(
|
Refine.unsafeCast<PackageInstaller>(
|
||||||
PackageInstallerHidden(iPackageInstaller, "com.android.vending", null, 0)
|
PackageInstallerHidden(iPackageInstaller, PLAY_PACKAGE_NAME, null, 0)
|
||||||
)
|
)
|
||||||
} else if (isOAndAbove) {
|
} else if (isOAndAbove) {
|
||||||
Refine.unsafeCast<PackageInstaller>(
|
Refine.unsafeCast<PackageInstaller>(
|
||||||
PackageInstallerHidden(iPackageInstaller, "com.android.vending", 0)
|
PackageInstallerHidden(iPackageInstaller, PLAY_PACKAGE_NAME, 0)
|
||||||
)
|
)
|
||||||
} else null
|
} else null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,32 @@
|
|||||||
package com.aurora.store.data.model
|
package com.aurora.store.data.model
|
||||||
|
|
||||||
enum class BuildType {
|
import com.aurora.store.BuildConfig
|
||||||
RELEASE,
|
|
||||||
NIGHTLY,
|
/**
|
||||||
DEBUG
|
* Class representing build types for Aurora Store
|
||||||
|
*/
|
||||||
|
enum class BuildType(val packageName: String) {
|
||||||
|
RELEASE("com.aurora.store"),
|
||||||
|
NIGHTLY("com.aurora.store.nightly"),
|
||||||
|
DEBUG("com.aurora.store.debug");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns current build type
|
||||||
|
*/
|
||||||
|
@Suppress("KotlinConstantConditions")
|
||||||
|
val CURRENT: BuildType
|
||||||
|
get() = when (BuildConfig.BUILD_TYPE) {
|
||||||
|
"release" -> RELEASE
|
||||||
|
"nightly" -> NIGHTLY
|
||||||
|
else -> DEBUG
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns package names for all possible build types
|
||||||
|
*/
|
||||||
|
val PACKAGE_NAMES: List<String>
|
||||||
|
get() = BuildType.entries.map { it.packageName }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.aurora.store.data.model
|
package com.aurora.store.data.model
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supported installers for Aurora Store
|
||||||
|
*/
|
||||||
enum class Installer {
|
enum class Installer {
|
||||||
SESSION,
|
SESSION,
|
||||||
NATIVE,
|
NATIVE,
|
||||||
|
|||||||
@@ -19,11 +19,19 @@
|
|||||||
|
|
||||||
package com.aurora.store.data.model
|
package com.aurora.store.data.model
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class holding information on a supported installer
|
||||||
|
*/
|
||||||
data class InstallerInfo(
|
data class InstallerInfo(
|
||||||
var id: Int,
|
val id: Int,
|
||||||
var title: String,
|
val installer: Installer,
|
||||||
var subtitle: String,
|
val packageNames: List<String>,
|
||||||
var description: String
|
val installerPackageNames: List<String>,
|
||||||
|
@StringRes val title: Int,
|
||||||
|
@StringRes val subtitle: Int,
|
||||||
|
@StringRes val description: Int
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return when (other) {
|
return when (other) {
|
||||||
|
|||||||
@@ -61,16 +61,9 @@ class UpdateWorker @AssistedInject constructor(
|
|||||||
|
|
||||||
private val notificationID = 100
|
private val notificationID = 100
|
||||||
|
|
||||||
@Suppress("KotlinConstantConditions")
|
|
||||||
private val buildType = when (BuildConfig.BUILD_TYPE) {
|
|
||||||
"release" -> BuildType.RELEASE
|
|
||||||
"nightly" -> BuildType.NIGHTLY
|
|
||||||
else -> BuildType.DEBUG
|
|
||||||
}
|
|
||||||
|
|
||||||
private val canSelfUpdate = !CertUtil.isFDroidApp(appContext, BuildConfig.APPLICATION_ID) &&
|
private val canSelfUpdate = !CertUtil.isFDroidApp(appContext, BuildConfig.APPLICATION_ID) &&
|
||||||
!CertUtil.isAppGalleryApp(appContext, BuildConfig.APPLICATION_ID) &&
|
!CertUtil.isAppGalleryApp(appContext, BuildConfig.APPLICATION_ID) &&
|
||||||
buildType != BuildType.DEBUG
|
BuildType.CURRENT != BuildType.DEBUG
|
||||||
|
|
||||||
private val isAuroraOnlyFilterEnabled: Boolean
|
private val isAuroraOnlyFilterEnabled: Boolean
|
||||||
get() = Preferences.getBoolean(appContext, Preferences.PREFERENCE_FILTER_AURORA_ONLY, false)
|
get() = Preferences.getBoolean(appContext, Preferences.PREFERENCE_FILTER_AURORA_ONLY, false)
|
||||||
@@ -182,7 +175,7 @@ class UpdateWorker @AssistedInject constructor(
|
|||||||
*/
|
*/
|
||||||
private suspend fun getSelfUpdate(): App? {
|
private suspend fun getSelfUpdate(): App? {
|
||||||
return withContext(Dispatchers.IO) {
|
return withContext(Dispatchers.IO) {
|
||||||
val updateUrl = when (buildType) {
|
val updateUrl = when (BuildType.CURRENT) {
|
||||||
BuildType.RELEASE -> Constants.UPDATE_URL_STABLE
|
BuildType.RELEASE -> Constants.UPDATE_URL_STABLE
|
||||||
BuildType.NIGHTLY -> Constants.UPDATE_URL_NIGHTLY
|
BuildType.NIGHTLY -> Constants.UPDATE_URL_NIGHTLY
|
||||||
else -> {
|
else -> {
|
||||||
@@ -198,7 +191,7 @@ class UpdateWorker @AssistedInject constructor(
|
|||||||
SelfUpdate::class.java
|
SelfUpdate::class.java
|
||||||
)
|
)
|
||||||
|
|
||||||
val isUpdate = when (buildType) {
|
val isUpdate = when (BuildType.CURRENT) {
|
||||||
BuildType.NIGHTLY,
|
BuildType.NIGHTLY,
|
||||||
BuildType.RELEASE -> selfUpdate.versionCode > BuildConfig.VERSION_CODE
|
BuildType.RELEASE -> selfUpdate.versionCode > BuildConfig.VERSION_CODE
|
||||||
else -> false
|
else -> false
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ class InstallerView @JvmOverloads constructor(
|
|||||||
|
|
||||||
@ModelProp
|
@ModelProp
|
||||||
fun installer(installer: InstallerInfo) {
|
fun installer(installer: InstallerInfo) {
|
||||||
binding.line1.text = installer.title
|
binding.line1.text = context.getString(installer.title)
|
||||||
binding.line2.text = installer.subtitle
|
binding.line2.text = context.getString(installer.subtitle)
|
||||||
binding.line3.text = installer.description
|
binding.line3.text = context.getString(installer.description)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModelProp
|
@ModelProp
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class InstallerFragment : BaseFragment<FragmentInstallerBinding>() {
|
|||||||
|
|
||||||
installerId = Preferences.getInteger(requireContext(), PREFERENCE_INSTALLER_ID)
|
installerId = Preferences.getInteger(requireContext(), PREFERENCE_INSTALLER_ID)
|
||||||
|
|
||||||
if (isOAndAbove && AppInstaller.hasShizukuOrSui(requireContext())) {
|
if (AppInstaller.hasShizukuOrSui(requireContext())) {
|
||||||
Shizuku.addBinderReceivedListenerSticky(shizukuAliveListener)
|
Shizuku.addBinderReceivedListenerSticky(shizukuAliveListener)
|
||||||
Shizuku.addBinderDeadListener(shizukuDeadListener)
|
Shizuku.addBinderDeadListener(shizukuDeadListener)
|
||||||
Shizuku.addRequestPermissionResultListener(shizukuResultListener)
|
Shizuku.addRequestPermissionResultListener(shizukuResultListener)
|
||||||
@@ -108,7 +108,7 @@ class InstallerFragment : BaseFragment<FragmentInstallerBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
if (isOAndAbove && AppInstaller.hasShizukuOrSui(requireContext())) {
|
if (AppInstaller.hasShizukuOrSui(requireContext())) {
|
||||||
Shizuku.removeBinderReceivedListener(shizukuAliveListener)
|
Shizuku.removeBinderReceivedListener(shizukuAliveListener)
|
||||||
Shizuku.removeBinderDeadListener(shizukuDeadListener)
|
Shizuku.removeBinderDeadListener(shizukuDeadListener)
|
||||||
Shizuku.removeRequestPermissionResultListener(shizukuResultListener)
|
Shizuku.removeRequestPermissionResultListener(shizukuResultListener)
|
||||||
|
|||||||
Reference in New Issue
Block a user