diff --git a/CHANGELOG.md b/CHANGELOG.md index 67675d3e9..61398f3ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - Fixed tracker start date being off by a day when adding tracking to an entry with read history in some timezones ([@hazptr](https://github.com/hazptr)) ([#4049](https://github.com/mihonapp/mihon/pull/4049)) - Fixed the paged reader crashing when moving to another chapter after a wide page of a neighbouring chapter was split ([@AntsyLich](https://github.com/AntsyLich)) - Fixed a crash when opening the filters of a source with an invalid filter ([@AntsyLich](https://github.com/AntsyLich)) +- Fixed a crash when installing an extension on a device where the system installer can't ask for confirmation ([@AntsyLich](https://github.com/AntsyLich)) ## [v0.21.1] - 2026-10-12 ### Fixed diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/installer/PackageInstallerInstaller.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/installer/PackageInstallerInstaller.kt index bf7e9a89b..5b8322b13 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/installer/PackageInstallerInstaller.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/installer/PackageInstallerInstaller.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.installer import android.annotation.SuppressLint import android.app.PendingIntent import android.app.Service +import android.content.ActivityNotFoundException import android.content.BroadcastReceiver import android.content.Context import android.content.Intent @@ -57,7 +58,16 @@ class PackageInstallerInstaller(private val service: Service) : Installer(servic return } userAction.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - service.startActivity(userAction) + try { + service.startActivity(userAction) + } catch (e: ActivityNotFoundException) { + // Some devices have the system installer's confirmation screen disabled or removed + logcat(LogPriority.WARN, e) { "Nothing can confirm the install" } + activeSession?.let { (_, sessionId) -> + runCatching { packageInstaller.abandonSession(sessionId) } + } + continueQueue(InstallStep.Error) + } } PackageInstaller.STATUS_FAILURE_ABORTED -> { continueQueue(InstallStep.Idle)