From 116b492b86acc8e1cfcf83f447c2a999452ba6fe Mon Sep 17 00:00:00 2001 From: xinking129 Date: Thu, 18 May 2023 21:23:14 +0800 Subject: [PATCH] fix build error Signed-off-by: xinking129 --- framework/manager/permission/uri_permission_manager.cpp | 8 +++----- framework/manager/permission/uri_permission_manager.h | 5 ----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/framework/manager/permission/uri_permission_manager.cpp b/framework/manager/permission/uri_permission_manager.cpp index cd9fd9d..6c9c41b 100755 --- a/framework/manager/permission/uri_permission_manager.cpp +++ b/framework/manager/permission/uri_permission_manager.cpp @@ -14,6 +14,7 @@ */ #include "uri_permission_manager.h" +#include "uri_permission_manager_client.h" #include "want.h" #include "uri.h" @@ -30,13 +31,10 @@ UriPermissionManager &UriPermissionManager::GetInstance() Status UriPermissionManager::GrantUriPermission(const std::string &path, const std::string &bundleName) { - if (uriPermissionManager_ == nullptr) { - uriPermissionManager_ = AAFwk::UriPermissionManagerClient::GetInstance(); - } Uri uri(path); int autoRemove = 1; - auto status = uriPermissionManager_->GrantUriPermission(uri, AAFwk::Want::FLAG_AUTH_READ_URI_PERMISSION, - bundleName, autoRemove); + auto status = AAFwk::UriPermissionManagerClient::GetInstance().GrantUriPermission( + uri, AAFwk::Want::FLAG_AUTH_READ_URI_PERMISSION, bundleName, autoRemove); if (status != ERR_OK) { LOG_ERROR(UDMF_FRAMEWORK, "GrantUriPermission failed, %{public}d", status); return E_ERROR; diff --git a/framework/manager/permission/uri_permission_manager.h b/framework/manager/permission/uri_permission_manager.h index 1db914f..db32e31 100755 --- a/framework/manager/permission/uri_permission_manager.h +++ b/framework/manager/permission/uri_permission_manager.h @@ -19,8 +19,6 @@ #include #include -#include "uri_permission_manager_client.h" - #include "error_code.h" namespace OHOS { @@ -29,9 +27,6 @@ class UriPermissionManager { public: static UriPermissionManager &GetInstance(); Status GrantUriPermission(const std::string &path, const std::string &bundleName); - -private: - std::shared_ptr uriPermissionManager_; }; } // namespace UDMF } // namespace OHOS -- Gitee