mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-27 01:11:15 +00:00
commit
d0f32a5f52
@ -414,11 +414,11 @@ int32_t BundlePermissionMgr::GetHapApiVersion()
|
||||
LOG_E(BMS_TAG_DEFAULT, "getApplicationInfo failed");
|
||||
return Constants::INVALID_API_VERSION;
|
||||
}
|
||||
auto appApiVersion = applicationInfo.apiTargetVersion;
|
||||
auto appApiVersion = applicationInfo.apiTargetVersion % BASE_API_VERSION;
|
||||
LOG_D(BMS_TAG_DEFAULT, "appApiVersion is %{public}d", appApiVersion);
|
||||
auto systemApiVersion = GetSdkApiVersion();
|
||||
// api version is the minimum value of {appApiVersion, systemApiVersion}
|
||||
return (systemApiVersion < appApiVersion ? systemApiVersion :appApiVersion) % BASE_API_VERSION;
|
||||
return systemApiVersion < appApiVersion ? systemApiVersion :appApiVersion;
|
||||
}
|
||||
|
||||
// if the api has been system api since it is published, then beginSystemApiVersion can be omitted
|
||||
|
@ -144,8 +144,13 @@ VerifyManagerHostImpl::~VerifyManagerHostImpl()
|
||||
|
||||
ErrCode VerifyManagerHostImpl::Verify(const std::vector<std::string> &abcPaths)
|
||||
{
|
||||
if (!BundlePermissionMgr::VerifySystemApp(ServiceConstants::API_VERSION_TWELVE) ||
|
||||
!BundlePermissionMgr::VerifyCallingPermissionForAll(Constants::PERMISSION_RUN_DYN_CODE)) {
|
||||
if (!BundlePermissionMgr::IsSystemApp() &&
|
||||
!BundlePermissionMgr::VerifyCallingBundleSdkVersion(ServiceConstants::API_VERSION_TWELVE)) {
|
||||
APP_LOGE("non-system app calling system api");
|
||||
return ERR_BUNDLE_MANAGER_SYSTEM_API_DENIED;
|
||||
}
|
||||
|
||||
if (!BundlePermissionMgr::VerifyCallingPermissionForAll(Constants::PERMISSION_RUN_DYN_CODE)) {
|
||||
APP_LOGE("verify permission failed");
|
||||
return ERR_BUNDLE_MANAGER_VERIFY_PERMISSION_DENIED;
|
||||
}
|
||||
@ -483,8 +488,13 @@ void VerifyManagerHostImpl::Rollback(const std::vector<std::string> &paths)
|
||||
|
||||
ErrCode VerifyManagerHostImpl::DeleteAbc(const std::string &path)
|
||||
{
|
||||
if (!BundlePermissionMgr::VerifySystemApp(ServiceConstants::API_VERSION_TWELVE) ||
|
||||
!BundlePermissionMgr::VerifyCallingPermissionForAll(Constants::PERMISSION_RUN_DYN_CODE)) {
|
||||
if (!BundlePermissionMgr::IsSystemApp() &&
|
||||
!BundlePermissionMgr::VerifyCallingBundleSdkVersion(ServiceConstants::API_VERSION_TWELVE)) {
|
||||
APP_LOGE("non-system app calling system api");
|
||||
return ERR_BUNDLE_MANAGER_SYSTEM_API_DENIED;
|
||||
}
|
||||
|
||||
if (!BundlePermissionMgr::VerifyCallingPermissionForAll(Constants::PERMISSION_RUN_DYN_CODE)) {
|
||||
APP_LOGE("DeleteAbc failed due to permission denied");
|
||||
return ERR_BUNDLE_MANAGER_VERIFY_PERMISSION_DENIED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user