feat(PMInstaller): disable silent installs on MIUI
Copy behavior of PM installers from other projects
This commit is contained in:
parent
98c0a2e22d
commit
304b634fa5
2 changed files with 12 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ import com.aliucord.manager.BuildConfig
|
|||
import com.aliucord.manager.installers.Installer
|
||||
import com.aliucord.manager.installers.InstallerResult
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import com.aliucord.manager.util.isMiui
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
|
|
@ -80,7 +81,8 @@ class PMInstaller(
|
|||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
setInstallScenario(PackageManager.INSTALL_SCENARIO_FAST)
|
||||
|
||||
if (silent) {
|
||||
// Allegedly MIUI is not happy with silent installs
|
||||
if (silent && !isMiui()) {
|
||||
setRequireUserAction(SessionParams.USER_ACTION_NOT_REQUIRED)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ val IS_CUSTOM_BUILD by lazy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether this device is most likely an emulator.
|
||||
* Check whether this device is most likely an emulator.
|
||||
* src: https://stackoverflow.com/a/21505193/13964629
|
||||
*/
|
||||
val IS_PROBABLY_EMULATOR by lazy {
|
||||
|
|
@ -68,6 +68,14 @@ val IS_PROBABLY_EMULATOR by lazy {
|
|||
|| getSystemProp("ro.kernel.qemu") == "1")
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this device is running MIUI
|
||||
*/
|
||||
fun isMiui(): Boolean {
|
||||
return getSystemProp("ro.miui.ui.version.name")
|
||||
?.isNotEmpty() ?: false
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a system property from build.prop
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue