mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-21 20:55:41 +03:00
parent
446b146f95
commit
80d6d412f3
1 changed files with 11 additions and 1 deletions
|
@ -141,6 +141,11 @@ internal object ExtensionLoader {
|
||||||
?.asSequence()
|
?.asSequence()
|
||||||
?.filter { it.isFile && it.extension == PRIVATE_EXTENSION_EXTENSION }
|
?.filter { it.isFile && it.extension == PRIVATE_EXTENSION_EXTENSION }
|
||||||
?.mapNotNull {
|
?.mapNotNull {
|
||||||
|
// Just in case, since Android 14+ requires them to be read-only
|
||||||
|
if (it.canWrite()) {
|
||||||
|
it.setReadOnly()
|
||||||
|
}
|
||||||
|
|
||||||
val path = it.absolutePath
|
val path = it.absolutePath
|
||||||
pkgManager.getPackageArchiveInfo(path, PACKAGE_FLAGS)
|
pkgManager.getPackageArchiveInfo(path, PACKAGE_FLAGS)
|
||||||
?.apply { applicationInfo.fixBasePaths(path) }
|
?.apply { applicationInfo.fixBasePaths(path) }
|
||||||
|
@ -277,7 +282,12 @@ internal object ExtensionLoader {
|
||||||
val hasReadme = appInfo.metaData.getInt(METADATA_HAS_README, 0) == 1
|
val hasReadme = appInfo.metaData.getInt(METADATA_HAS_README, 0) == 1
|
||||||
val hasChangelog = appInfo.metaData.getInt(METADATA_HAS_CHANGELOG, 0) == 1
|
val hasChangelog = appInfo.metaData.getInt(METADATA_HAS_CHANGELOG, 0) == 1
|
||||||
|
|
||||||
val classLoader = PathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
val classLoader = try {
|
||||||
|
PathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logcat(LogPriority.ERROR, e) { "Extension load error: $extName ($pkgName)" }
|
||||||
|
return LoadResult.Error
|
||||||
|
}
|
||||||
|
|
||||||
val sources = appInfo.metaData.getString(METADATA_SOURCE_CLASS)!!
|
val sources = appInfo.metaData.getString(METADATA_SOURCE_CLASS)!!
|
||||||
.split(";")
|
.split(";")
|
||||||
|
|
Loading…
Reference in a new issue