modify log

Signed-off-by: chenxinzhan <chenxinzhan@huawei.com>
This commit is contained in:
chenxinzhan 2024-08-02 17:27:54 +08:00
parent 903c55b786
commit ef6d452696
6 changed files with 60 additions and 60 deletions

View File

@ -43,7 +43,7 @@ public:
static void Finalizer(napi_env env, void* data, void* hint)
{
TAG_LOGI(AAFwkTag::URIPERMMGR, "JsUriPermMgr::Finalizer is called");
TAG_LOGI(AAFwkTag::URIPERMMGR, "call");
std::unique_ptr<JsUriPermMgr>(static_cast<JsUriPermMgr*>(data));
}
@ -60,33 +60,33 @@ public:
private:
napi_value OnGrantUriPermission(napi_env env, NapiCallbackInfo& info)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "Grant Uri Permission start");
TAG_LOGD(AAFwkTag::URIPERMMGR, "start");
if (info.argc != argCountThree && info.argc != argCountFour) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "The number of parameter is invalid.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "param number invalid");
ThrowTooFewParametersError(env);
return CreateJsUndefined(env);
}
std::string uriStr;
if (!OHOS::AppExecFwk::UnwrapStringFromJS2(env, info.argv[0], uriStr)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "The uriStr is invalid.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "invalid uriStr");
ThrowInvalidParamError(env, "Parse param uri failed, uri must be string.");
return CreateJsUndefined(env);
}
int flag = 0;
if (!OHOS::AppExecFwk::UnwrapInt32FromJS2(env, info.argv[1], flag)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "The flag is invalid.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "flag invalid");
ThrowInvalidParamError(env, "Parse param flag failed, flag must be number.");
return CreateJsUndefined(env);
}
std::string targetBundleName;
if (!OHOS::AppExecFwk::UnwrapStringFromJS2(env, info.argv[argCountTwo], targetBundleName)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "The targetBundleName is invalid.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "targetBundleName invalid");
ThrowInvalidParamError(env, "Parse param targetBundleName failed, targetBundleName must be string.");
return CreateJsUndefined(env);
}
auto selfToken = IPCSkeleton::GetSelfTokenID();
if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(selfToken)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "This application is not system-app, can not use system-api.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "app not system-app");
ThrowError(env, AbilityErrorCode::ERROR_CODE_NOT_SYSTEM_APP);
return CreateJsUndefined(env);
}
@ -124,25 +124,25 @@ private:
{
// only support 2 or 3 params (2 parameter and 1 optional callback)
if (info.argc != argCountThree && info.argc != argCountTwo) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Invalid arguments");
TAG_LOGE(AAFwkTag::URIPERMMGR, "Invalid args");
ThrowTooFewParametersError(env);
return CreateJsUndefined(env);
}
std::string uriStr;
if (!OHOS::AppExecFwk::UnwrapStringFromJS2(env, info.argv[0], uriStr)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "invalid of the uriStr.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "invalid uriStr");
ThrowInvalidParamError(env, "Parse param uri failed, uri must be string.");
return CreateJsUndefined(env);
}
std::string bundleName;
if (!OHOS::AppExecFwk::UnwrapStringFromJS2(env, info.argv[1], bundleName)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "The bundleName is invalid.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "bundleName invalid");
ThrowInvalidParamError(env, "Parse param bundleName failed, bundleName must be string.");
return CreateJsUndefined(env);
}
auto selfToken = IPCSkeleton::GetSelfTokenID();
if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(selfToken)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "can not use system-api, this application is not system-app.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "app not system-app");
ThrowError(env, AbilityErrorCode::ERROR_CODE_NOT_SYSTEM_APP);
return CreateJsUndefined(env);
}
@ -174,9 +174,9 @@ private:
napi_value CreateJsUriPermMgr(napi_env env, napi_value exportObj)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "CreateJsUriPermMgr is called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
if (env == nullptr || exportObj == nullptr) {
TAG_LOGI(AAFwkTag::URIPERMMGR, "Invalid input parameters");
TAG_LOGI(AAFwkTag::URIPERMMGR, "Invalid param");
return nullptr;
}

View File

@ -24,27 +24,27 @@ void UriPermissionLoadCallback::OnLoadSystemAbilitySuccess(
int32_t systemAbilityId, const sptr<IRemoteObject> &remoteObject)
{
if (systemAbilityId != URI_PERMISSION_MGR_SERVICE_ID) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "System ability id %{public}d mismatch.", systemAbilityId);
TAG_LOGE(AAFwkTag::URIPERMMGR, "abilityId:%{public}d mismatch", systemAbilityId);
return;
}
if (remoteObject == nullptr) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Object is nullptr.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "Object null");
return;
}
TAG_LOGD(AAFwkTag::URIPERMMGR, "Load system ability %{public}d succeed.", systemAbilityId);
TAG_LOGD(AAFwkTag::URIPERMMGR, "abilityId:%{public}d succeed", systemAbilityId);
UriPermissionManagerClient::GetInstance().OnLoadSystemAbilitySuccess(remoteObject);
}
void UriPermissionLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
{
if (systemAbilityId != URI_PERMISSION_MGR_SERVICE_ID) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "System ability id %{public}d mismatch.", systemAbilityId);
TAG_LOGE(AAFwkTag::URIPERMMGR, "abilityId:%{public}d mismatch", systemAbilityId);
return;
}
TAG_LOGD(AAFwkTag::URIPERMMGR, "Load system ability %{public}d failed.", systemAbilityId);
TAG_LOGD(AAFwkTag::URIPERMMGR, "abilityId:%{public}d failed", systemAbilityId);
UriPermissionManagerClient::GetInstance().OnLoadSystemAbilityFail();
}
} // namespace AAFwk

View File

@ -37,7 +37,7 @@ UriPermissionManagerClient& UriPermissionManagerClient::GetInstance()
int UriPermissionManagerClient::GrantUriPermission(const Uri &uri, unsigned int flag,
const std::string targetBundleName, int32_t appIndex, uint32_t initiatorTokenId, int32_t abilityId)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "targetBundleName :%{public}s", targetBundleName.c_str());
TAG_LOGD(AAFwkTag::URIPERMMGR, "targetBundleName:%{public}s", targetBundleName.c_str());
auto uriPermMgr = ConnectUriPermService();
if (uriPermMgr) {
return uriPermMgr->GrantUriPermission(uri, flag, targetBundleName, appIndex, initiatorTokenId, abilityId);
@ -48,10 +48,10 @@ int UriPermissionManagerClient::GrantUriPermission(const Uri &uri, unsigned int
int UriPermissionManagerClient::GrantUriPermission(const std::vector<Uri> &uriVec, unsigned int flag,
const std::string targetBundleName, int32_t appIndex, uint32_t initiatorTokenId, int32_t abilityId)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "targetBundleName: %{public}s, uriVec size: %{public}zu", targetBundleName.c_str(),
TAG_LOGD(AAFwkTag::URIPERMMGR, "targetBundleName:%{public}s, uriVecSize:%{public}zu", targetBundleName.c_str(),
uriVec.size());
if (uriVec.empty() || uriVec.size() > MAX_URI_COUNT) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec is empty or exceed maximum size %{public}d.", MAX_URI_COUNT);
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec empty or exceed maxSize %{public}d", MAX_URI_COUNT);
return ERR_URI_LIST_OUT_OF_RANGE;
}
auto uriPermMgr = ConnectUriPermService();
@ -64,10 +64,10 @@ int UriPermissionManagerClient::GrantUriPermission(const std::vector<Uri> &uriVe
int32_t UriPermissionManagerClient::GrantUriPermissionPrivileged(const std::vector<Uri> &uriVec, uint32_t flag,
const std::string &targetBundleName, int32_t appIndex)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "targetBundleName: %{public}s, uriVec size: %{public}zu",
TAG_LOGD(AAFwkTag::URIPERMMGR, "targetBundleName:%{public}s, uriVecSize:%{public}zu",
targetBundleName.c_str(), uriVec.size());
if (uriVec.empty() || uriVec.size() > MAX_URI_COUNT) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec is empty or exceed maximum size %{public}d.", MAX_URI_COUNT);
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec empty or exceed maxSize %{public}d", MAX_URI_COUNT);
return ERR_URI_LIST_OUT_OF_RANGE;
}
auto uriPermMgr = ConnectUriPermService();
@ -80,7 +80,7 @@ int32_t UriPermissionManagerClient::GrantUriPermissionPrivileged(const std::vect
void UriPermissionManagerClient::RevokeUriPermission(const uint32_t tokenId, int32_t abilityId)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
auto uriPermMgr = ConnectUriPermService();
if (uriPermMgr) {
return uriPermMgr->RevokeUriPermission(tokenId, abilityId);
@ -89,7 +89,7 @@ void UriPermissionManagerClient::RevokeUriPermission(const uint32_t tokenId, int
int UriPermissionManagerClient::RevokeAllUriPermissions(const uint32_t tokenId)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
auto uriPermMgr = ConnectUriPermService();
if (uriPermMgr) {
return uriPermMgr->RevokeAllUriPermissions(tokenId);
@ -100,7 +100,7 @@ int UriPermissionManagerClient::RevokeAllUriPermissions(const uint32_t tokenId)
int UriPermissionManagerClient::RevokeUriPermissionManually(const Uri &uri, const std::string bundleName,
int32_t appIndex)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
auto uriPermMgr = ConnectUriPermService();
if (uriPermMgr) {
return uriPermMgr->RevokeUriPermissionManually(uri, bundleName, appIndex);
@ -121,10 +121,10 @@ std::vector<bool> UriPermissionManagerClient::CheckUriAuthorization(const std::v
uint32_t flag, uint32_t tokenId)
{
uint32_t size = uriVec.size();
TAG_LOGD(AAFwkTag::URIPERMMGR, "flag: %{public}u, tokenId: %{public}u", flag, tokenId);
TAG_LOGD(AAFwkTag::URIPERMMGR, "flag:%{public}u, tokenId:%{public}u", flag, tokenId);
std::vector<bool> errorRes(size, false);
if (uriVec.empty() || uriVec.size() > MAX_URI_COUNT) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec is empty or exceed maximum size %{public}d.", MAX_URI_COUNT);
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec empty or exceed maxSize %{public}d", MAX_URI_COUNT);
return errorRes;
}
auto uriPermMgr = ConnectUriPermService();
@ -136,16 +136,16 @@ std::vector<bool> UriPermissionManagerClient::CheckUriAuthorization(const std::v
sptr<IUriPermissionManager> UriPermissionManagerClient::ConnectUriPermService()
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
auto uriPermMgr = GetUriPermMgr();
if (uriPermMgr == nullptr) {
if (!LoadUriPermService()) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Load uri permission manager service failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "LoadUriPermService failed");
return nullptr;
}
uriPermMgr = GetUriPermMgr();
if (uriPermMgr == nullptr || uriPermMgr->AsObject() == nullptr) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Failed to get uri permission manager.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "GetUriPermMgr failed");
return nullptr;
}
const auto& onClearProxyCallback = [] {
@ -154,28 +154,28 @@ sptr<IUriPermissionManager> UriPermissionManagerClient::ConnectUriPermService()
sptr<UpmsDeathRecipient> recipient(new UpmsDeathRecipient(onClearProxyCallback));
uriPermMgr->AsObject()->AddDeathRecipient(recipient);
}
TAG_LOGD(AAFwkTag::URIPERMMGR, "End UriPermissionManagerClient::ConnectUriPermService.");
TAG_LOGD(AAFwkTag::URIPERMMGR, "End");
return uriPermMgr;
}
bool UriPermissionManagerClient::LoadUriPermService()
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityMgr == nullptr) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Failed to get SystemAbilityManager.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "GetSystemAbilityManager failed");
return false;
}
sptr<UriPermissionLoadCallback> loadCallback = new (std::nothrow) UriPermissionLoadCallback();
if (loadCallback == nullptr) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Create load callback failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "Create loadCallback failed");
return false;
}
auto ret = systemAbilityMgr->LoadSystemAbility(URI_PERMISSION_MGR_SERVICE_ID, loadCallback);
if (ret != 0) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Load system ability %{public}d failed with %{public}d.",
TAG_LOGE(AAFwkTag::URIPERMMGR, "LoadSystemAbility %{public}d failed:%{public}d",
URI_PERMISSION_MGR_SERVICE_ID, ret);
return false;
}
@ -187,7 +187,7 @@ bool UriPermissionManagerClient::LoadUriPermService()
return saLoadFinished_;
});
if (!waitStatus) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Wait for load sa timeout.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "Wait for load sa timeout");
return false;
}
}
@ -202,14 +202,14 @@ sptr<IUriPermissionManager> UriPermissionManagerClient::GetUriPermMgr()
void UriPermissionManagerClient::SetUriPermMgr(const sptr<IRemoteObject> &remoteObject)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
std::lock_guard<std::mutex> lock(mutex_);
uriPermMgr_ = iface_cast<IUriPermissionManager>(remoteObject);
}
void UriPermissionManagerClient::OnLoadSystemAbilitySuccess(const sptr<IRemoteObject> &remoteObject)
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
SetUriPermMgr(remoteObject);
std::unique_lock<std::mutex> lock(saLoadMutex_);
saLoadFinished_ = true;
@ -218,7 +218,7 @@ void UriPermissionManagerClient::OnLoadSystemAbilitySuccess(const sptr<IRemoteOb
void UriPermissionManagerClient::OnLoadSystemAbilityFail()
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
SetUriPermMgr(nullptr);
std::unique_lock<std::mutex> lock(saLoadMutex_);
saLoadFinished_ = true;
@ -227,7 +227,7 @@ void UriPermissionManagerClient::OnLoadSystemAbilityFail()
void UriPermissionManagerClient::ClearProxy()
{
TAG_LOGD(AAFwkTag::URIPERMMGR, "called");
TAG_LOGD(AAFwkTag::URIPERMMGR, "call");
{
std::lock_guard<std::mutex> lock(mutex_);
uriPermMgr_ = nullptr;
@ -238,7 +238,7 @@ void UriPermissionManagerClient::ClearProxy()
void UriPermissionManagerClient::UpmsDeathRecipient::OnRemoteDied([[maybe_unused]] const wptr<IRemoteObject>& remote)
{
TAG_LOGE(AAFwkTag::URIPERMMGR, "upms stub died.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "call");
proxy_();
}
} // namespace AAFwk

View File

@ -27,7 +27,7 @@ int UriPermissionManagerStub::OnRemoteRequest(
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
{
if (data.ReadInterfaceToken() != IUriPermissionManager::GetDescriptor()) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "InterfaceToken not equal IUriPermissionManager's descriptor.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "InterfaceToken invalid");
return ERR_INVALID_VALUE;
}
ErrCode errCode = ERR_OK;
@ -82,7 +82,7 @@ int UriPermissionManagerStub::HandleGrantUriPermission(MessageParcel &data, Mess
{
std::unique_ptr<Uri> uri(data.ReadParcelable<Uri>());
if (!uri) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "To read uri failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "read uri failed");
return ERR_DEAD_OBJECT;
}
auto flag = data.ReadUint32();
@ -99,14 +99,14 @@ int UriPermissionManagerStub::HandleBatchGrantUriPermission(MessageParcel &data,
{
auto size = data.ReadUint32();
if (size == 0 || size > MAX_URI_COUNT) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec is empty or exceed maximum size %{public}d.", MAX_URI_COUNT);
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec empty or exceed maxSize %{public}d", MAX_URI_COUNT);
return ERR_URI_LIST_OUT_OF_RANGE;
}
std::vector<Uri> uriVec;
for (uint32_t i = 0; i < size; i++) {
std::unique_ptr<Uri> uri(data.ReadParcelable<Uri>());
if (!uri) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "To read uri failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "read uri failed");
return ERR_DEAD_OBJECT;
}
uriVec.emplace_back(*uri);
@ -125,14 +125,14 @@ int32_t UriPermissionManagerStub::HandleGrantUriPermissionPrivileged(MessageParc
{
auto size = data.ReadUint32();
if (size == 0 || size > MAX_URI_COUNT) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec is empty or exceed maximum size %{public}d.", MAX_URI_COUNT);
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec empty or exceed maxSize %{public}d", MAX_URI_COUNT);
return ERR_URI_LIST_OUT_OF_RANGE;
}
std::vector<Uri> uriVec;
for (uint32_t i = 0; i < size; i++) {
std::unique_ptr<Uri> uri(data.ReadParcelable<Uri>());
if (!uri) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "To read uri failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "read uri failed");
return ERR_DEAD_OBJECT;
}
uriVec.emplace_back(*uri);
@ -149,7 +149,7 @@ int UriPermissionManagerStub::HandleRevokeUriPermissionManually(MessageParcel &d
{
std::unique_ptr<Uri> uri(data.ReadParcelable<Uri>());
if (!uri) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "To read uri failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "read uri failed");
return ERR_DEAD_OBJECT;
}
auto bundleName = data.ReadString();
@ -163,7 +163,7 @@ int UriPermissionManagerStub::HandleVerifyUriPermission(MessageParcel &data, Mes
{
std::unique_ptr<Uri> uri(data.ReadParcelable<Uri>());
if (!uri) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "To read uri failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "read uri failed");
return ERR_DEAD_OBJECT;
}
auto flag = data.ReadUint32();
@ -177,7 +177,7 @@ int32_t UriPermissionManagerStub::HandleCheckUriAuthorization(MessageParcel &dat
{
auto size = data.ReadUint32();
if (size == 0 || size > MAX_URI_COUNT) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec is empty or exceed maximum size %{public}d.", MAX_URI_COUNT);
TAG_LOGE(AAFwkTag::URIPERMMGR, "uriVec empty or exceed maxSize %{public}d", MAX_URI_COUNT);
return ERR_URI_LIST_OUT_OF_RANGE;
}
std::vector<std::string> uriVec;
@ -189,12 +189,12 @@ int32_t UriPermissionManagerStub::HandleCheckUriAuthorization(MessageParcel &dat
auto tokenId = data.ReadUint32();
auto result = CheckUriAuthorization(uriVec, flag, tokenId);
if (!reply.WriteUint32(result.size())) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Write size of uriVec failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "Write uriVec size failed");
return ERR_DEAD_OBJECT;
}
for (auto res: result) {
if (!reply.WriteBool(res)) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "Write res failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "Write res failed");
return ERR_DEAD_OBJECT;
}
}

View File

@ -65,7 +65,7 @@ std::vector<bool> FilePermissionManager::CheckUriPersistentPermission(std::vecto
uint32_t callerTokenId, uint32_t flag, std::vector<PolicyInfo> &pathPolicies)
{
TAG_LOGI(AAFwkTag::URIPERMMGR,
"CheckUriPersistentPermission called, size of uri is %{public}zu", uriVec.size());
"call, uri size:%{public}zu", uriVec.size());
std::vector<bool> resultCodes(uriVec.size(), false);
pathPolicies.clear();
if (CheckPermission(callerTokenId, PermissionConstants::PERMISSION_FILE_ACCESS_MANAGER)) {

View File

@ -37,26 +37,26 @@ UriPermissionManagerService::~UriPermissionManagerService()
void UriPermissionManagerService::OnStart()
{
TAG_LOGI(AAFwkTag::URIPERMMGR, "UriPermissionManagerService start is triggered.");
TAG_LOGI(AAFwkTag::URIPERMMGR, "start");
if (!Init()) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "init failed.");
TAG_LOGE(AAFwkTag::URIPERMMGR, "init failed");
return;
}
if (!registerToService_) {
auto systemAabilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (!systemAabilityMgr || systemAabilityMgr->AddSystemAbility(URI_PERMISSION_MGR_SERVICE_ID, impl_) != 0) {
TAG_LOGE(AAFwkTag::URIPERMMGR, "fail to register to system ability manager");
TAG_LOGE(AAFwkTag::URIPERMMGR, "register to systemAbilityMgr failed");
return;
}
TAG_LOGI(AAFwkTag::URIPERMMGR, "register to system ability manager success");
TAG_LOGI(AAFwkTag::URIPERMMGR, "register to systemAbilityMgr success");
registerToService_ = true;
}
}
void UriPermissionManagerService::OnStop()
{
TAG_LOGI(AAFwkTag::URIPERMMGR, "called");
TAG_LOGI(AAFwkTag::URIPERMMGR, "call");
SelfClean();
}
@ -68,7 +68,7 @@ bool UriPermissionManagerService::IsServiceReady() const
bool UriPermissionManagerService::Init()
{
if (ready_) {
TAG_LOGW(AAFwkTag::URIPERMMGR, "init more than one time.");
TAG_LOGW(AAFwkTag::URIPERMMGR, "repeat init");
return true;
}