diff --git a/frameworks/ets/ani/accesstoken/src/ani_request_permission_on_setting.cpp b/frameworks/ets/ani/accesstoken/src/ani_request_permission_on_setting.cpp index 03ffbbe782a078ccbcf725345174402dd53d1256..e887118b677ff579d7983d5ac6f4c6f03931735b 100644 --- a/frameworks/ets/ani/accesstoken/src/ani_request_permission_on_setting.cpp +++ b/frameworks/ets/ani/accesstoken/src/ani_request_permission_on_setting.cpp @@ -149,11 +149,25 @@ void RequestPermOnSettingAsyncContext::ProcessUIExtensionCallback(const OHOS::AA this->stateList_ = result.GetIntArrayParam(PERMISSION_RESULT_KEY); } +static std::string JoinStrings(const std::vector& permissionList) { + std::ostringstream perms; + perms << "permList:["; + for (size_t i = 0; i < permissionList.size(); ++i) { + perms << permissionList[i]; + if (i != permissionList.size() - 1) { + perms << ", "; + } + } + perms << "]"; + return perms.str(); +} + void RequestPermOnSettingAsyncContext::StartExtensionAbility(std::shared_ptr asyncContext) { AccessTokenKit::GetPermissionManagerInfo(this->info); - LOGI(ATM_DOMAIN, ATM_TAG, "BundleName: %{public}s, permStateAbilityName: %{public}s.", - this->info.grantBundleName.c_str(), this->info.permStateAbilityName.c_str()); + std::string perms = JoinStrings(this->permissionList); + LOGI(ATM_DOMAIN, ATM_TAG, "BundleName: %{public}s, permStateAbilityName: %{public}s, permissionList: %{public}s.", + this->info.grantBundleName.c_str(), this->info.permStateAbilityName.c_str(), perms.c_str()); OHOS::AAFwk::Want want; want.SetElementName(this->info.grantBundleName, this->info.permStateAbilityName); want.SetParam(PERMISSION_SETTING_KEY, this->permissionList); diff --git a/frameworks/js/napi/accesstoken/src/napi_request_permission_on_setting.cpp b/frameworks/js/napi/accesstoken/src/napi_request_permission_on_setting.cpp index 04f99a7e1148fa39ec5bb22d6d7f2070ebcc9d28..964717a1aab3e337272911a79eb03d2a35f9bb47 100644 --- a/frameworks/js/napi/accesstoken/src/napi_request_permission_on_setting.cpp +++ b/frameworks/js/napi/accesstoken/src/napi_request_permission_on_setting.cpp @@ -64,7 +64,7 @@ static int32_t TransferToJsErrorCode(int32_t errCode) jsCode = JS_ERROR_ALL_PERM_GRANTED; break; case PERM_REVOKE_BY_USER: - jsCode = JS_ERROR_PERM_REVOKE_BY_USER; + jsCode = JS_ERROR_PERM_NOT_REVOKE_BY_USER; break; default: jsCode = JS_ERROR_INNER; @@ -382,12 +382,26 @@ static int32_t CreateUIExtension(const Want &want, std::shared_ptr& permissionList) { + std::ostringstream perms; + perms << "permList:["; + for (size_t i = 0; i < permissionList.size(); ++i) { + perms << permissionList[i]; + if (i != permissionList.size() - 1) { + perms << ", "; + } + } + perms << "]"; + return perms.str(); +} + static int32_t StartUIExtension(std::shared_ptr asyncContext) { AAFwk::Want want; AccessTokenKit::GetPermissionManagerInfo(asyncContext->info); - LOGI(ATM_DOMAIN, ATM_TAG, "bundleName: %{public}s, permStateAbilityName: %{public}s.", - asyncContext->info.grantBundleName.c_str(), asyncContext->info.permStateAbilityName.c_str()); + std::string perms = JoinStrings(asyncContext->permissionList); + LOGI(ATM_DOMAIN, ATM_TAG, "bundleName: %{public}s, permStateAbilityName: %{public}s, permissionList: %{public}s.", + asyncContext->info.grantBundleName.c_str(), asyncContext->info.permStateAbilityName.c_str(), perms.c_str()); want.SetElementName(asyncContext->info.grantBundleName, asyncContext->info.permStateAbilityName); want.SetParam(PERMISSION_KEY, asyncContext->permissionList); want.SetParam(EXTENSION_TYPE_KEY, UI_EXTENSION_TYPE); diff --git a/frameworks/js/napi/common/src/napi_error.cpp b/frameworks/js/napi/common/src/napi_error.cpp index d1ee4cf8aac567ebc19619bb208c562e729c30bd..806622e72bcfd8f81e54b770b961b2f30c85f382 100644 --- a/frameworks/js/napi/common/src/napi_error.cpp +++ b/frameworks/js/napi/common/src/napi_error.cpp @@ -36,7 +36,7 @@ static const std::map g_errorStringMap = { {JS_ERROR_INNER, "Common inner error."}, {JS_ERROR_REQUEST_IS_ALREADY_EXIST, "The request already exists."}, {JS_ERROR_ALL_PERM_GRANTED, "All permissions in the permission list have been granted."}, - {JS_ERROR_PERM_REVOKE_BY_USER, + {JS_ERROR_PERM_NOT_REVOKE_BY_USER, "The permission list contains the permission that has not been revoked by the user."}, {JS_ERROR_GLOBAL_SWITCH_IS_ALREADY_OPEN, "The specific global switch is already open."}, {JS_ERROR_EXPECTED_PERMISSION_TYPE, "Unexpected permission."}, diff --git a/interfaces/kits/js/napi/common/include/napi_error.h b/interfaces/kits/js/napi/common/include/napi_error.h index 75eb62e8eeb24a7b0fe18f5a14c03be40735dfe2..e40e445ca1fa4e42abe038da01076ae11c49a2df 100644 --- a/interfaces/kits/js/napi/common/include/napi_error.h +++ b/interfaces/kits/js/napi/common/include/napi_error.h @@ -43,7 +43,7 @@ typedef enum { JS_ERROR_INNER, JS_ERROR_REQUEST_IS_ALREADY_EXIST = 12100010, JS_ERROR_ALL_PERM_GRANTED = 12100011, - JS_ERROR_PERM_REVOKE_BY_USER = 12100012, + JS_ERROR_PERM_NOT_REVOKE_BY_USER = 12100012, JS_ERROR_GLOBAL_SWITCH_IS_ALREADY_OPEN = 12100013, JS_ERROR_EXPECTED_PERMISSION_TYPE = 12100014, } JsErrorCode;