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))
}
}
}

View File

@@ -233,6 +233,7 @@
<string name="device_miui_extra">"Optionally you can choose Native installer, but then you can not install bundled (split) APKs, so choice is yours."</string>
<string name="dialog_title_self_update">"New update available"</string>
<string name="dialog_desc_self_update">"Do you wish to update now ?"</string>
<string name="dialog_desc_native_split">"You can not install bundled(split) apps via Native Installer. Change your installer to Session, Services or Root."</string>
<string name="list_update_all_txt_one">"update available"</string>
<string name="notification_channel_alert">"Quick notification"</string>
<string name="notification_channel_general">"General notification"</string>