Skip to content

Commit

Permalink
feat(core.loader): 从宿主复制PackageInfo.permission到插件
Browse files Browse the repository at this point in the history
不返回插件Manifest中注册的权限,因为它们也不会生效。

Tencent#824
  • Loading branch information
shifujun committed Feb 25, 2022
1 parent 6895eef commit ca32b3e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ internal class PluginPackageManagerImpl(
hostPackageManager.getApplicationInfo(packageName, flags)
}

override fun getPackageInfo(packageName: String, flags: Int): PackageInfo? =
if (packageName.isPlugin()) {
override fun getPackageInfo(packageName: String, flags: Int): PackageInfo? {
val hostPackageInfo = hostPackageManager.getPackageInfo(packageName, flags)
return if (packageName.isPlugin()) {
val packageInfo = hostPackageManager.getPackageArchiveInfo(pluginArchiveFilePath, flags)
if (packageInfo != null) {
packageInfo.applicationInfo = getPluginApplicationInfo(flags)
packageInfo.permissions = hostPackageInfo.permissions
}
packageInfo
} else {
hostPackageManager.getPackageInfo(packageName, flags)
hostPackageInfo
}
}

override fun getActivityInfo(component: ComponentName, flags: Int): ActivityInfo? =
getComponentInfo(
Expand Down

0 comments on commit ca32b3e

Please sign in to comment.