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

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="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_title_self_update">"New update available"</string>
<string name="dialog_desc_self_update">"Do you wish to update now ?"</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="list_update_all_txt_one">"update available"</string>
<string name="notification_channel_alert">"Quick notification"</string> <string name="notification_channel_alert">"Quick notification"</string>
<string name="notification_channel_general">"General notification"</string> <string name="notification_channel_general">"General notification"</string>