Fix crash when installing an extension

This commit is contained in:
Jays2Kings 2021-08-07 13:27:55 -04:00
parent 7dfbd6aab3
commit 37abd2aa2e

View File

@ -88,11 +88,15 @@ internal object ExtensionLoader {
}
fun isExtensionInstalledByApp(context: Context, pkgName: String): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
context.packageManager.getInstallSourceInfo(pkgName).installingPackageName
} else {
context.packageManager.getInstallerPackageName(pkgName)
} == BuildConfig.APPLICATION_ID
} catch (e: java.lang.Exception) {
false
}
}
/**