Do not allow users to install bundled apps via native installer

This commit is contained in:
Rahul Kumar Patel
2021-04-06 22:32:33 +05:30
parent 0228cc1a3c
commit 660268587e
2 changed files with 18 additions and 14 deletions

View File

@@ -279,21 +279,24 @@ class AppDetailsActivity : BaseDetailsActivity() {
private fun install(files: List<Download>) {
updateActionState(State.IDLE)
task {
AppInstaller(this)
.getPreferredInstaller()
.install(
app.packageName,
files
.filter { it.file.endsWith(".apk") }
.map {
it.file
}.toList()
)
}
val apkFiles = files.filter { it.file.endsWith(".apk") }
val preferredInstaller = Preferences.getInteger(this, Preferences.PREFERENCE_INSTALLER_ID)
runOnUiThread {
B.layoutDetailsInstall.btnDownload.setText(getString(R.string.action_installing))
if (apkFiles.size > 1 && preferredInstaller == 1) {
showDialog(R.string.title_installer, R.string.dialog_desc_native_split)
} else {
task {
AppInstaller(this)
.getPreferredInstaller()
.install(
app.packageName,
apkFiles.map { it.file }
)
}
runOnUiThread {
B.layoutDetailsInstall.btnDownload.setText(getString(R.string.action_installing))
}
}
}