diff --git a/.github/ISSUE_TEMPLATE/1_request_feature.yml b/.github/ISSUE_TEMPLATE/1_request_feature.yml index 0b76875f3..5f34c4b12 100644 --- a/.github/ISSUE_TEMPLATE/1_request_feature.yml +++ b/.github/ISSUE_TEMPLATE/1_request_feature.yml @@ -30,7 +30,7 @@ body: required: true - label: I have written a short but informative title. required: true - - label: I have updated the app to version **[0.19.5](https://github.com/mihonapp/mihon/releases/latest)**. + - label: I have updated the app to version **[0.19.7](https://github.com/mihonapp/mihon/releases/latest)**. required: true - label: I will fill out all of the requested information in this form. required: true diff --git a/.github/ISSUE_TEMPLATE/2_report_issue.yml b/.github/ISSUE_TEMPLATE/2_report_issue.yml index 51afb59d3..701f210c0 100644 --- a/.github/ISSUE_TEMPLATE/2_report_issue.yml +++ b/.github/ISSUE_TEMPLATE/2_report_issue.yml @@ -52,7 +52,7 @@ body: label: Mihon version description: You can find your Mihon version in **More → About**. placeholder: | - Example: "0.19.5" + Example: "0.19.7" validations: required: true @@ -95,7 +95,7 @@ body: required: true - label: I have gone through the [FAQ](https://mihon.app/docs/faq/general) and [troubleshooting guide](https://mihon.app/docs/guides/troubleshooting/). required: true - - label: I have updated the app to version **[0.19.5](https://github.com/mihonapp/mihon/releases/latest)**. + - label: I have updated the app to version **[0.19.7](https://github.com/mihonapp/mihon/releases/latest)**. required: true - label: I have filled out all of the requested information in this form, including specific version numbers. required: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 77f11b6f2..773204784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,16 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co ## [Unreleased] +## [v0.19.7] - 2026-03-23 +Same as v0.19.6 + +## [v0.19.6] - 2026-03-23 +### Fixed +- Fix app crashing when trying to add extension repo with existing signature ([@AntsyLich](https://github.com/AntsyLich)) ([`cb0e329`](https://github.com/mihonapp/mihon/commit/cb0e329)) +- Potentially fix 'database is locked' crash ([@AntsyLich](https://github.com/AntsyLich)) ([`f8e82b9`](https://github.com/mihonapp/mihon/commit/f8e82b9)) +- Fix occasional crash when mass installing/uninstalling extension using `PackageManager` ([@AntsyLich](https://github.com/AntsyLich)) ([`42daa3f`](https://github.com/mihonapp/mihon/commit/42daa3f)) +- Fix app crash on startup on some Android TV ([@AntsyLich](https://github.com/AntsyLich)) ([`b40f1d3`](https://github.com/mihonapp/mihon/commit/b40f1d3)) + ## [v0.19.5] - 2026-03-20 ### Changed - Retry in reader now redownloads image ([@AntsyLich](https://github.com/AntsyLich)) ([#3089](https://github.com/mihonapp/mihon/pull/3089)) @@ -495,8 +505,10 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - Branding to Mihon ([@AntsyLich](https://github.com/AntsyLich)) - Minimum supported Android version to 8 ([@AntsyLich](https://github.com/AntsyLich)) ([`dfb3091`](https://github.com/mihonapp/mihon/commit/dfb3091e380dda3e9bfb64bf5c9a685cf3a03d0e)) -[unreleased]: https://github.com/mihonapp/mihon/compare/v0.19.5...main -[v0.19.4]: https://github.com/mihonapp/mihon/compare/v0.19.4...v0.19.5 +[unreleased]: https://github.com/mihonapp/mihon/compare/v0.19.7...main +[v0.19.7]: https://github.com/mihonapp/mihon/compare/v0.19.6...v0.19.7 +[v0.19.6]: https://github.com/mihonapp/mihon/compare/v0.19.5...v0.19.6 +[v0.19.5]: https://github.com/mihonapp/mihon/compare/v0.19.4...v0.19.5 [v0.19.4]: https://github.com/mihonapp/mihon/compare/v0.19.3...v0.19.4 [v0.19.3]: https://github.com/mihonapp/mihon/compare/v0.19.2...v0.19.3 [v0.19.2]: https://github.com/mihonapp/mihon/compare/v0.19.1...v0.19.2 diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 018918c03..04d88b165 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -26,8 +26,8 @@ android { defaultConfig { applicationId = "app.mihon" - versionCode = 19 - versionName = "0.19.5" + versionCode = 20 + versionName = "0.19.7" buildConfigField("String", "COMMIT_COUNT", "\"${getLatestCommitCount()}\"") buildConfigField("String", "COMMIT_SHA", "\"${getLatestCommitSha()}\"") diff --git a/app/src/main/java/eu/kanade/tachiyomi/di/AppModule.kt b/app/src/main/java/eu/kanade/tachiyomi/di/AppModule.kt index 0bfb195fc..59f1a2c25 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/di/AppModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/di/AppModule.kt @@ -43,21 +43,31 @@ import uy.kohesive.injekt.api.InjektRegistrar import uy.kohesive.injekt.api.addSingleton import uy.kohesive.injekt.api.addSingletonFactory import uy.kohesive.injekt.api.get +import java.lang.ref.WeakReference + +private val lock = Any() class AppModule(val app: Application) : InjektModule { + private var sqlDriverRef: WeakReference? = null + override fun InjektRegistrar.registerInjectables() { addSingleton(app) addSingletonFactory { - AndroidxSqliteDriver( - driver = BundledSQLiteDriver(), - databaseType = AndroidxSqliteDatabaseType.FileProvider(app, "tachiyomi.db"), - schema = Database.Schema, - configuration = AndroidxSqliteConfiguration( - isForeignKeyConstraintsEnabled = true, - ), - ) + synchronized(lock) { + sqlDriverRef?.get()?.let { return@synchronized it } + + AndroidxSqliteDriver( + driver = BundledSQLiteDriver(), + databaseType = AndroidxSqliteDatabaseType.FileProvider(app, "tachiyomi.db"), + schema = Database.Schema, + configuration = AndroidxSqliteConfiguration( + isForeignKeyConstraintsEnabled = true, + ), + ) + .also { sqlDriverRef = WeakReference(it) } + } } addSingletonFactory { Database( 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 931bf48af..e65862330 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 @@ -106,8 +106,13 @@ class PackageInstallerInstaller(private val service: Service) : Installer(servic override fun cancelEntry(entry: Entry): Boolean { activeSession?.let { (activeEntry, sessionId) -> if (activeEntry == entry) { - packageInstaller.abandonSession(sessionId) - return false + return try { + packageInstaller.abandonSession(sessionId) + false + } catch (_: SecurityException) { + // Highly likely the session has succeeded + true + } } } return true diff --git a/core/common/src/main/kotlin/eu/kanade/tachiyomi/util/system/WebViewUtil.kt b/core/common/src/main/kotlin/eu/kanade/tachiyomi/util/system/WebViewUtil.kt index 0ca4361f8..39bebcbae 100644 --- a/core/common/src/main/kotlin/eu/kanade/tachiyomi/util/system/WebViewUtil.kt +++ b/core/common/src/main/kotlin/eu/kanade/tachiyomi/util/system/WebViewUtil.kt @@ -13,6 +13,7 @@ import kotlin.coroutines.resume object WebViewUtil { private const val CHROME_PACKAGE = "com.android.chrome" + private const val YOUTUBE_FOR_TV_PACKAGE = "com.google.android.youtube.tv" private const val SYSTEM_SETTINGS_PACKAGE = "com.android.settings" const val MINIMUM_WEBVIEW_VERSION = 118 @@ -56,13 +57,16 @@ object WebViewUtil { } fun spoofedPackageName(context: Context): String { - return try { - context.packageManager.getPackageInfo(CHROME_PACKAGE, PackageManager.GET_META_DATA) - - CHROME_PACKAGE - } catch (_: PackageManager.NameNotFoundException) { - SYSTEM_SETTINGS_PACKAGE - } + return runCatching { context.packageManager.getPackageInfo(CHROME_PACKAGE, 0) } + .recoverCatching { context.packageManager.getPackageInfo(SYSTEM_SETTINGS_PACKAGE, 0) } + .recoverCatching { context.packageManager.getPackageInfo(YOUTUBE_FOR_TV_PACKAGE, 0) } + .fold( + onSuccess = { it.packageName }, + onFailure = { + context.packageManager.getInstalledPackages(0) + .random().packageName + }, + ) } } diff --git a/data/src/main/java/mihon/data/repository/ExtensionRepoRepositoryImpl.kt b/data/src/main/java/mihon/data/repository/ExtensionRepoRepositoryImpl.kt index 24910d968..61c279630 100644 --- a/data/src/main/java/mihon/data/repository/ExtensionRepoRepositoryImpl.kt +++ b/data/src/main/java/mihon/data/repository/ExtensionRepoRepositoryImpl.kt @@ -1,6 +1,6 @@ package mihon.data.repository -import android.database.sqlite.SQLiteException +import android.database.SQLException import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import mihon.domain.extensionrepo.exception.SaveExtensionRepoException @@ -42,7 +42,7 @@ class ExtensionRepoRepositoryImpl( ) { try { handler.await { extension_reposQueries.insert(baseUrl, name, shortName, website, signingKeyFingerprint) } - } catch (ex: SQLiteException) { + } catch (ex: SQLException) { throw SaveExtensionRepoException(ex) } } @@ -56,7 +56,7 @@ class ExtensionRepoRepositoryImpl( ) { try { handler.await { extension_reposQueries.upsert(baseUrl, name, shortName, website, signingKeyFingerprint) } - } catch (ex: SQLiteException) { + } catch (ex: SQLException) { throw SaveExtensionRepoException(ex) } }