Fix app crash on startup on some Android TV
Why do you guys even exist
This commit is contained in:
@@ -15,6 +15,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||||||
- Fix app crashing when trying to add extension repo with existing signature ([@AntsyLich](https://github.com/AntsyLich))
|
- Fix app crashing when trying to add extension repo with existing signature ([@AntsyLich](https://github.com/AntsyLich))
|
||||||
- Potentially fix 'database is locked' crash ([@AntsyLich](https://github.com/AntsyLich))
|
- Potentially fix 'database is locked' crash ([@AntsyLich](https://github.com/AntsyLich))
|
||||||
- Fix occasional crash when mass installing/uninstalling extension using `PackageManager` ([@AntsyLich](https://github.com/AntsyLich))
|
- Fix occasional crash when mass installing/uninstalling extension using `PackageManager` ([@AntsyLich](https://github.com/AntsyLich))
|
||||||
|
- Fix app crash on startup on some Android TV ([@AntsyLich](https://github.com/AntsyLich))
|
||||||
|
|
||||||
## [v0.19.5] - 2026-03-20
|
## [v0.19.5] - 2026-03-20
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import kotlin.coroutines.resume
|
|||||||
|
|
||||||
object WebViewUtil {
|
object WebViewUtil {
|
||||||
private const val CHROME_PACKAGE = "com.android.chrome"
|
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"
|
private const val SYSTEM_SETTINGS_PACKAGE = "com.android.settings"
|
||||||
|
|
||||||
const val MINIMUM_WEBVIEW_VERSION = 118
|
const val MINIMUM_WEBVIEW_VERSION = 118
|
||||||
@@ -56,13 +57,16 @@ object WebViewUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun spoofedPackageName(context: Context): String {
|
fun spoofedPackageName(context: Context): String {
|
||||||
return try {
|
return runCatching { context.packageManager.getPackageInfo(CHROME_PACKAGE, 0) }
|
||||||
context.packageManager.getPackageInfo(CHROME_PACKAGE, PackageManager.GET_META_DATA)
|
.recoverCatching { context.packageManager.getPackageInfo(SYSTEM_SETTINGS_PACKAGE, 0) }
|
||||||
|
.recoverCatching { context.packageManager.getPackageInfo(YOUTUBE_FOR_TV_PACKAGE, 0) }
|
||||||
CHROME_PACKAGE
|
.fold(
|
||||||
} catch (_: PackageManager.NameNotFoundException) {
|
onSuccess = { it.packageName },
|
||||||
SYSTEM_SETTINGS_PACKAGE
|
onFailure = {
|
||||||
}
|
context.packageManager.getInstalledPackages(0)
|
||||||
|
.random().packageName
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user