From c90bedd313bab6620adb756784bdfd177f017eba Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Fri, 17 Sep 2021 17:31:56 +0800 Subject: [PATCH] fix .nm_modname according to d.ts Signed-off-by: zhaoyuan17 --- .../kits/ability/native/src/ability.cpp | 191 +++++++++++------- .../ability/native/src/ability_thread.cpp | 14 ++ .../aafwk/abilityManager/native_module.cpp | 2 +- .../aafwk/featureAbility/native_module.cpp | 4 +- .../aafwk/particleAbility/native_module.cpp | 2 +- .../napi/aafwk/wantConstant/native_module.cpp | 2 +- 6 files changed, 137 insertions(+), 78 deletions(-) diff --git a/frameworks/kits/ability/native/src/ability.cpp b/frameworks/kits/ability/native/src/ability.cpp index 78460c2a762..20a574e2817 100755 --- a/frameworks/kits/ability/native/src/ability.cpp +++ b/frameworks/kits/ability/native/src/ability.cpp @@ -33,6 +33,8 @@ #include "reverse_continuation_scheduler_replica.h" #include "reverse_continuation_scheduler_replica_handler_interface.h" #include "string_wrapper.h" +#include "permission/permission.h" +#include "permission/permission_kit.h" #include "ability_post_event_timeout.h" #ifdef MMI_COMPILE @@ -48,6 +50,9 @@ namespace OHOS { namespace AppExecFwk { +using PermissionKit = OHOS::Security::Permission::PermissionKit; +using PermissionState = OHOS::Security::Permission::PermissionState; + REGISTER_AA(Ability) const std::string Ability::SYSTEM_UI("com.ohos.systemui"); const std::string Ability::STATUS_BAR("com.ohos.systemui.statusbar.MainAbility"); @@ -57,6 +62,7 @@ const std::string DEVICE_MANAGER_NAME = "com.ohos.devicemanagerui.MainAbility"; const std::string Ability::DMS_SESSION_ID("sessionId"); const std::string Ability::DMS_ORIGIN_DEVICE_ID("deviceId"); const int Ability::DEFAULT_DMS_SESSION_ID(0); +const std::string PERMISSION_REQUIRE_FORM = "ohos.permission.REQUIRE_FORM"; static std::mutex formLock; @@ -151,8 +157,7 @@ void Ability::OnStart(const Want &want) winType = OHOS::WindowType::WINDOW_TYPE_ALARM_SCREEN; } - if (abilityInfo_->bundleName == DEVICE_MANAGER_BUNDLE_NAME && - abilityInfo_->name == DEVICE_MANAGER_NAME) { + if (abilityInfo_->bundleName == DEVICE_MANAGER_BUNDLE_NAME && abilityInfo_->name == DEVICE_MANAGER_NAME) { winType = OHOS::WindowType::WINDOW_TYPE_ALARM_SCREEN; } @@ -161,7 +166,6 @@ void Ability::OnStart(const Want &want) abilityInfo_->bundleName.c_str(), abilityInfo_->name.c_str(), winType); - SetUIContent(config); if (abilityWindow_ != nullptr) { @@ -170,7 +174,6 @@ void Ability::OnStart(const Want &want) APP_LOGI("%{public}s end abilityWindow_->OnPostAbilityStart.", __func__); } } - // should called in ace ability onStart methord. SetWant(want); if (abilityLifecycleExecutor_ == nullptr) { @@ -578,7 +581,7 @@ void Ability::SetUIContent(const sptr &config) * * @return Returns a IWindowsManager object pointer. */ -const sptr &Ability::GetWindow() +const sptr Ability::GetWindow() { if (abilityWindow_ != nullptr) { return abilityWindow_->GetWindow(); @@ -1455,7 +1458,7 @@ bool Ability::OnSaveData(WantParams &saveData) } /** - * @brief After creating the Ability on the remote device, + * @brief After creating the Ability on the remote device, * immediately restore the user data saved during the migration of the Ability on the remote device. * @param restoreData Indicates the user data to be restored. * @return If the data is restored successfully, it returns true; otherwise, it returns false . @@ -1525,7 +1528,7 @@ void Ability::HandleCreateAsContinuation(const Want &want) continuationManager_->NotifyCompleteContinuation( originDeviceId, sessionId, success, reverseContinuationSchedulerReplica_); } -bool Ability::IsFlagExists(int flag, int flagSet) +bool Ability::IsFlagExists(unsigned int flag, unsigned int flagSet) { return (flag & flagSet) == flag; } @@ -1638,7 +1641,7 @@ bool Ability::ReleaseForm(const int64_t formId, const bool isReleaseCache) APP_LOGI("%{public}s called.", __func__); // release form with formId and specifies whether to release the cache - return DeleteForm(formId, isReleaseCache ? RELEASE_CACHED_FORM : RELEASE_FORM); + return DeleteForm(formId, isReleaseCache ? RELEASE_CACHED_FORM : RELEASE_FORM); } /** @@ -1672,12 +1675,12 @@ bool Ability::DeleteForm(const int64_t formId) * @brief Cast temp form with formId. * * @param formId Indicates the form's ID. - * + * * @return Returns {@code true} if the form is successfully casted; returns {@code false} otherwise. */ bool Ability::CastTempForm(const int64_t formId) { - APP_LOGI("%{public}s start",__func__); + APP_LOGI("%{public}s start", __func__); if (formId <= 0) { APP_LOGE("%{public}s error, passing in form id can't be negative.", __func__); return false; @@ -1694,7 +1697,7 @@ bool Ability::CastTempForm(const int64_t formId) userReqParams_[formId].SetParam(Constants::PARAM_FORM_TEMPORARY_KEY, false); - APP_LOGI("%{public}s end",__func__); + APP_LOGI("%{public}s end", __func__); return true; } @@ -1741,7 +1744,12 @@ bool Ability::AcquireForm(const int64_t formId, const Want &want, const std::sha ElementName elementName = want.GetElement(); std::string bundleName = elementName.GetBundleName(); std::string abilityName = elementName.GetAbilityName(); - APP_LOGI("%{public}s, begin to acquire form, bundleName is %{public}s, abilityName is %{public}s, formId is %{public}" PRId64 ".",__func__, bundleName.c_str(), abilityName.c_str(), formId); + APP_LOGI("%{public}s, begin to acquire form, bundleName is %{public}s, abilityName is %{public}s, formId is " + "%{public}" PRId64 ".", + __func__, + bundleName.c_str(), + abilityName.c_str(), + formId); // hostClient init sptr formHostClient = FormHostClient::GetInstance(); @@ -1757,7 +1765,8 @@ bool Ability::AcquireForm(const int64_t formId, const Want &want, const std::sha return false; } APP_LOGI("%{public}s, end to acquire form, the formId returned from the fms is %{public}" PRId64 ".", - __func__, formJsInfo.formId); + __func__, + formJsInfo.formId); // check for form presence in hostForms if (formHostClient->ContainsForm(formJsInfo.formId)) { @@ -1770,7 +1779,7 @@ bool Ability::AcquireForm(const int64_t formId, const Want &want, const std::sha formHostClient->AddForm(thisAbility, formJsInfo.formId); // post the async task of handleAcquireResult - PostTask([this, want, formJsInfo, callback]() {HandleAcquireResult(want, formJsInfo, callback);}, 0L); + PostTask([this, want, formJsInfo, callback]() { HandleAcquireResult(want, formJsInfo, callback); }, 0L); // the acquire form is successfully return true; @@ -1850,14 +1859,14 @@ bool Ability::NotifyInvisibleForms(const std::vector &formIds) } /** -* @brief Set form next refresh time. -* -*

This method is called by a form provider to set refresh time. -* -* @param formId Indicates the ID of the form to set refresh time. -* @param nextTime Indicates the next time gap now in seconds, can not be litter than 300 seconds. -* @return Returns {@code true} if seting succeed; returns {@code false} otherwise. -*/ + * @brief Set form next refresh time. + * + *

This method is called by a form provider to set refresh time. + * + * @param formId Indicates the ID of the form to set refresh time. + * @param nextTime Indicates the next time gap now in seconds, can not be litter than 300 seconds. + * @return Returns {@code true} if seting succeed; returns {@code false} otherwise. + */ bool Ability::SetFormNextRefreshTime(const int64_t formId, const int64_t nextTime) { APP_LOGI("%{public}s called.", __func__); @@ -1909,15 +1918,22 @@ void Ability::ProcessFormUpdate(const FormJsInfo &formJsInfo) // post the async task of handleFormMessage int32_t msgCode = OHOS_FORM_UPDATE_FORM; - PostTask([this, msgCode, formJsInfo]() {HandleFormMessage(msgCode, formJsInfo);}, 0L); + PostTask([this, msgCode, formJsInfo]() { HandleFormMessage(msgCode, formJsInfo); }, 0L); } /** * @brief Uninstall form. * * @param formId Indicates the ID of the form to uninstall. */ -void Ability::ProcessFormUninstall(const int64_t formId) { +void Ability::ProcessFormUninstall(const int64_t formId) +{ APP_LOGI("%{public}s start.", __func__); + // check formId + if (formId <= 0) { + APP_LOGE("%{public}s error, the passed in formId can't be negative or zero.", __func__); + return; + } + std::shared_ptr formCallback = nullptr; { std::lock_guard lock(formLock); @@ -1925,7 +1941,6 @@ void Ability::ProcessFormUninstall(const int64_t formId) { std::map>::iterator appCallbackIterator = appCallbacks_.find(formId); - // call the callback function when you need to be notified if (appCallbackIterator == appCallbacks_.end()) { APP_LOGE("%{public}s failed, callback not find, formId: %{public}" PRId64 ".", __func__, formId); @@ -1934,7 +1949,7 @@ void Ability::ProcessFormUninstall(const int64_t formId) { formCallback = appCallbackIterator->second; CleanFormResource(formId); } - if ( formCallback == nullptr) { + if (formCallback == nullptr) { APP_LOGE("%{public}s failed, callback is nullptr.", __func__); return; } @@ -1956,7 +1971,7 @@ void Ability::ProcessFormUninstall(const int64_t formId) { * Ability#PARAM_FORM_NAME_KEY, and Ability#PARAM_FORM_DIMENSION_KEY, * respectively. Such form information must be managed as persistent data for further form * acquisition, update, and deletion. - * + * * @return Returns the created FormProviderInfo object. */ FormProviderInfo Ability::OnCreate(const Want &want) @@ -1983,8 +1998,7 @@ void Ability::OnDelete(const int64_t formId) * @return none. */ void Ability::OnUpdate(const int64_t formId) -{ -} +{} /** * @brief Called when the form provider is notified that a temporary form is successfully converted to a normal form. @@ -2005,8 +2019,7 @@ void Ability::OnCastTemptoNormal(const int64_t formId) * @return none. */ void Ability::OnVisibilityChanged(const std::map &formEventsMap) -{ -} +{} /** * @brief Called to notify the form provider to update a specified form. * @@ -2014,8 +2027,7 @@ void Ability::OnVisibilityChanged(const std::map &formEventsMa * @param message Form event message. */ void Ability::OnTriggerEvent(const int64_t formId, const std::string &message) -{ -} +{} /** * @brief Delete or release form with formId. * @@ -2031,14 +2043,16 @@ bool Ability::DeleteForm(const int64_t formId, const int32_t deleteType) APP_LOGE("%{public}s error, form is in recover status, can't do action on form.", __func__); return false; } - // check formId + // check formId if (formId <= 0) { APP_LOGE("%{public}s error, the passed in formId can't be negative or zero.", __func__); return false; } APP_LOGI("%{public}s, delete form begin, formId is %{public}" PRId64 " and deleteType is %{public}d.", - __func__, formId, deleteType); + __func__, + formId, + deleteType); { // form lock std::lock_guard lock(formLock); @@ -2084,13 +2098,15 @@ bool Ability::DeleteForm(const int64_t formId, const int32_t deleteType) * * @param formId Indicates the form's ID. */ -void Ability::CleanFormResource(const int64_t formId) +void Ability::CleanFormResource(const int64_t formId) { APP_LOGI("%{public}s called.", __func__); // compatible with int form id - int64_t cleanId {-1L}; + int64_t cleanId{-1L}; for (auto param : userReqParams_) { - if ((param.first & 0x00000000ffffffffL) == (formId & 0x00000000ffffffffL)) { + uint64_t unsignedFormId = static_cast(formId); + uint64_t unsignedParamFirst = static_cast(param.first); + if ((unsignedParamFirst & 0x00000000ffffffffL) == (unsignedFormId & 0x00000000ffffffffL)) { cleanId = param.first; break; } @@ -2112,7 +2128,6 @@ void Ability::CleanFormResource(const int64_t formId) std::shared_ptr thisAbility = this->shared_from_this(); FormHostClient::GetInstance()->RemoveForm(thisAbility, cleanId); - // unregister death callback when appCallbacks is empty if (appCallbacks_.empty()) { std::shared_ptr thisAbility = this->shared_from_this(); @@ -2172,10 +2187,9 @@ void Ability::HandleFormMessage(const int32_t msgCode, const FormJsInfo &formJsI { std::lock_guard lock(formLock); // get callback iterator by formId - std::map>::iterator appCallbackIterator = + std::map>::iterator appCallbackIterator = appCallbacks_.find(formJsInfo.formId); - // call the callback function when you need to be notified if (appCallbackIterator == appCallbacks_.end()) { APP_LOGE("%{public}s failed, callback not find, formId: %{public}" PRId64 ".", __func__, formJsInfo.formId); @@ -2183,7 +2197,7 @@ void Ability::HandleFormMessage(const int32_t msgCode, const FormJsInfo &formJsI } formCallback = appCallbackIterator->second; } - if ( formCallback == nullptr) { + if (formCallback == nullptr) { APP_LOGE("%{public}s failed, callback is nullptr.", __func__); return; } @@ -2199,7 +2213,7 @@ void Ability::HandleFormMessage(const int32_t msgCode, const FormJsInfo &formJsI /** * @brief Notify the forms visibility change event. - * + * * @param formIds Indicates the IDs of the forms to be made visible or invisible. * @param eventType Indicates the form events occurred. FORM_VISIBLE means that the form becomes visible, * and FORM_INVISIBLE means that the form becomes invisible. @@ -2219,9 +2233,10 @@ bool Ability::NotifyWhetherVisibleForms(const std::vector &formIds, int return false; } - int resultCode = FormMgr::GetInstance().NotifyWhetherVisibleForms(formIds, FormHostClient::GetInstance(), eventType); + int resultCode = + FormMgr::GetInstance().NotifyWhetherVisibleForms(formIds, FormHostClient::GetInstance(), eventType); if (resultCode != ERR_OK) { - APP_LOGE("%{public}s error, internal error occurs, error code:%{public}d.", __func__, resultCode); + APP_LOGE("%{public}s error, internal error occurs, error code:%{public}d.", __func__, resultCode); return false; } return true; @@ -2229,7 +2244,7 @@ bool Ability::NotifyWhetherVisibleForms(const std::vector &formIds, int /** * @brief Check the param of want. - * + * * @param formId Indicates the form's ID. * @param want Indicates the detailed information about the form to be obtained, including the bundle name, * module name, ability name, form name, form id, tempForm flag, form dimension, and form customize data. @@ -2299,7 +2314,7 @@ bool Ability::DisableUpdateForm(const std::vector &formIds) return LifecycleUpdate(formIds, DISABLE_FORM_UPDATE); } -bool Ability::LifecycleUpdate(std::vector formIds, int32_t updateType) +bool Ability::LifecycleUpdate(std::vector formIds, int32_t updateType) { if (FormMgr::GetRecoverStatus() == Constants::IN_RECOVERING) { APP_LOGE("%{public}s error, form is in recover status, can't do action on form.", __func__); @@ -2351,7 +2366,10 @@ bool Ability::RequestForm(const int64_t formId, const Want &want) // requestForm request to fms int resultCode = FormMgr::GetInstance().RequestForm(formId, FormHostClient::GetInstance(), want); if (resultCode != ERR_OK) { - APP_LOGE("%{public}s error, failed to notify the form service that the form user's lifecycle is updated, error code is %{public}d.", __func__, resultCode); + APP_LOGE("%{public}s error, failed to notify the form service that the form user's lifecycle is updated, error " + "code is %{public}d.", + __func__, + resultCode); return false; } @@ -2390,18 +2408,21 @@ void Ability::OnDeathReceived() { std::lock_guard lock(formLock); // get callback iterator by formId - std::map>::iterator appCallbackIterator = appCallbacks_.find(formId); - + std::map>::iterator appCallbackIterator = + appCallbacks_.find(formId); + if (appCallbackIterator == appCallbacks_.end()) { - APP_LOGW("%{public}s error, lack of form callback for form, formId:%{public}" PRId64 ".", __func__, formId); + APP_LOGW("%{public}s error, lack of form callback for form, formId:%{public}" PRId64 ".", + __func__, + formId); continue; } formCallback = appCallbackIterator->second; } - if(formCallback == nullptr) { + if (formCallback == nullptr) { APP_LOGW("%{public}s failed, callback is nullptr.", __func__); continue; - } + } FormJsInfo formJsInfo; formJsInfo.formId = formId; @@ -2412,7 +2433,7 @@ void Ability::OnDeathReceived() /** * @brief Reacquire a specified form when the death callback is received. - * + * * @param formId Indicates the form ID. * @param want Indicates the detailed information about the form to be obtained. * @return Returns true if the request is successfully initiated; returns false otherwise. @@ -2452,13 +2473,13 @@ bool Ability::CheckFMSReady() APP_LOGI("%{public}s called.", __func__); sptr systemAbilityManager = - SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); auto remoteObject = systemAbilityManager->GetSystemAbility(FORM_MGR_SERVICE_ID); if (remoteObject == nullptr) { APP_LOGI("%{public}s, form manager service is not ready.", __func__); return false; } - + return true; } @@ -2477,7 +2498,7 @@ bool Ability::GetAllFormsInfo(std::vector &formInfos) APP_LOGE("%{public}s error, failed to get IBundleMgr.", __func__); return false; } - + if (!CheckPermission()) { return false; } @@ -2498,7 +2519,7 @@ bool Ability::GetFormsInfoByApp(std::string &bundleName, std::vector & bool IsGetFormsInfoByApp = false; if (bundleName.empty()) { APP_LOGW("save info fail, empty bundle name"); - return IsGetFormsInfoByApp; + IsGetFormsInfoByApp = false; } sptr iBundleMgr = GetBundleMgr(); @@ -2506,21 +2527,20 @@ bool Ability::GetFormsInfoByApp(std::string &bundleName, std::vector & APP_LOGE("%{public}s error, failed to get IBundleMgr.", __func__); return IsGetFormsInfoByApp; } - + if (!CheckPermission()) { return IsGetFormsInfoByApp; } - + IsGetFormsInfoByApp = iBundleMgr->GetFormsInfoByApp(bundleName, formInfos); - if (formInfos.size() == 0){ + if (formInfos.size() == 0) { return IsGetFormsInfoByApp; } - + return IsGetFormsInfoByApp; } - - /** +/** * @brief Get forms info by application name and module name. * * @param bundleName Application name. @@ -2547,9 +2567,11 @@ bool Ability::GetFormsInfoByModule(std::string &bundleName, std::string &moduleN if (!CheckPermission()) { return IsGetFormsInfoByModule; } - + IsGetFormsInfoByModule = iBundleMgr->GetFormsInfoByModule(bundleName, moduleName, formInfos); - + if (formInfos.size() == 0){ + IsGetFormsInfoByModule = false; + } return IsGetFormsInfoByModule; } @@ -2563,7 +2585,7 @@ sptr Ability::GetBundleMgr() if (iBundleMgr_ == nullptr) { sptr systemAbilityManager = - SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); auto remoteObject = systemAbilityManager->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); if (remoteObject == nullptr) { APP_LOGE("%{public}s error, failed to get bundle manager service.", __func__); @@ -2571,12 +2593,12 @@ sptr Ability::GetBundleMgr() } iBundleMgr_ = iface_cast(remoteObject); - if (iBundleMgr_ == nullptr) { + if (iBundleMgr_ == nullptr) { APP_LOGE("%{public}s error, failed to get bundle manager service", __func__); - return nullptr; + return nullptr; } } - + return iBundleMgr_; } @@ -2584,7 +2606,8 @@ sptr Ability::GetBundleMgr() * @brief check permission of bundle, if it not existed. * @return returns the permission is vaild, or false for failed. */ -bool Ability::CheckPermission() { +bool Ability::CheckPermission() +{ APP_LOGI("%{public}s called.", __func__); int32_t uid = IPCSkeleton::GetCallingUid(); @@ -2600,9 +2623,20 @@ bool Ability::CheckPermission() { return false; } - return true; + return CheckFormPermission(bundleName); } +bool Ability::CheckFormPermission(const std::string &bundleName) const +{ + APP_LOGI("%{public}s called.", __func__); + + int result = PermissionKit::VerifyPermission(bundleName, Constants::PERMISSION_REQUIRE_FORM, 0); + if (result != PermissionState::PERMISSION_GRANTED) { + APP_LOGW("permission = %{public}s, bundleName = %{public}s, result = %{public}d", + Constants::PERMISSION_REQUIRE_FORM.c_str(), bundleName.c_str(), result); + } + return result == PermissionState::PERMISSION_GRANTED; +} /** * @brief Add the bundle manager instance for debug. * @param bundleManager the bundle manager ipc object. @@ -2621,10 +2655,10 @@ void Ability::SetBundleManager(const sptr &bundleManager) sptr Ability::GetFormRemoteObject() { APP_LOGI("%{public}s start", __func__); - if(providerRemoteObject_ == nullptr) { + if (providerRemoteObject_ == nullptr) { sptr providerClient = new (std::nothrow) FormProviderClient(); std::shared_ptr thisAbility = this->shared_from_this(); - if(thisAbility == nullptr) { + if (thisAbility == nullptr) { APP_LOGE("%{public}s failed, thisAbility is nullptr", __func__); } providerClient->SetOwner(thisAbility); @@ -2634,5 +2668,14 @@ sptr Ability::GetFormRemoteObject() return providerRemoteObject_; } +/** + * @brief Set the start ability setting. + * @param setting the start ability setting. + */ +void Ability::SetStartAbilitySetting(std::shared_ptr setting) +{ + APP_LOGI("%{public}s called.", __func__); + setting_ = setting; +} } // namespace AppExecFwk } // namespace OHOS diff --git a/frameworks/kits/ability/native/src/ability_thread.cpp b/frameworks/kits/ability/native/src/ability_thread.cpp index db87af94789..64a178b4541 100644 --- a/frameworks/kits/ability/native/src/ability_thread.cpp +++ b/frameworks/kits/ability/native/src/ability_thread.cpp @@ -852,12 +852,26 @@ int AbilityThread::BatchInsert(const Uri &uri, const std::vector & void AbilityThread::NotifyMultiWinModeChanged(int32_t winModeKey, bool flag) { APP_LOGI("NotifyMultiWinModeChanged.key:%{public}d,flag:%{public}d", winModeKey, flag); + sptr window = currentAbility_->GetWindow(); + if (window == nullptr) { + APP_LOGE("NotifyMultiWinModeChanged window == nullptr"); + return; + } + return; } void AbilityThread::NotifyTopActiveAbilityChanged(bool flag) { APP_LOGI("NotifyTopActiveAbilityChanged,flag:%{public}d", flag); + sptr window = currentAbility_->GetWindow(); + if (window == nullptr) { + APP_LOGE("NotifyMultiWinModeChanged window == nullptr"); + return; + } + if (flag) { + window->SwitchTop(); + } return; } diff --git a/interfaces/kits/napi/aafwk/abilityManager/native_module.cpp b/interfaces/kits/napi/aafwk/abilityManager/native_module.cpp index ecb52951b52..f412a79a663 100644 --- a/interfaces/kits/napi/aafwk/abilityManager/native_module.cpp +++ b/interfaces/kits/napi/aafwk/abilityManager/native_module.cpp @@ -67,7 +67,7 @@ static napi_module _module = {.nm_version = 1, .nm_flags = 0, .nm_filename = nullptr, .nm_register_func = Init, - .nm_modname = "app.abilitymanager", + .nm_modname = "app.abilityManager", .nm_priv = ((void *)0), .reserved = {0}}; diff --git a/interfaces/kits/napi/aafwk/featureAbility/native_module.cpp b/interfaces/kits/napi/aafwk/featureAbility/native_module.cpp index c01d8940d99..1a17648bab3 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/native_module.cpp +++ b/interfaces/kits/napi/aafwk/featureAbility/native_module.cpp @@ -19,6 +19,7 @@ #include #include "feature_ability.h" +#include "feature_ability_constant.h" #include "napi_context.h" #include "napi_data_ability_helper.h" #include "napi/native_api.h" @@ -34,6 +35,7 @@ static napi_value Init(napi_env env, napi_value exports) FeatureAbilityInit(env, exports); ContextPermissionInit(env, exports); DataAbilityHelperInit(env, exports); + FAConstantInit(env, exports); return exports; } EXTERN_C_END @@ -45,7 +47,7 @@ static napi_module _module = {.nm_version = 1, .nm_flags = 0, .nm_filename = nullptr, .nm_register_func = Init, - .nm_modname = "ability.featureability", + .nm_modname = "ability.featureAbility", .nm_priv = ((void *)0), .reserved = {0}}; diff --git a/interfaces/kits/napi/aafwk/particleAbility/native_module.cpp b/interfaces/kits/napi/aafwk/particleAbility/native_module.cpp index 2b856a4f689..ef229427ace 100755 --- a/interfaces/kits/napi/aafwk/particleAbility/native_module.cpp +++ b/interfaces/kits/napi/aafwk/particleAbility/native_module.cpp @@ -40,7 +40,7 @@ static napi_module _module = {.nm_version = 1, .nm_flags = 0, .nm_filename = nullptr, .nm_register_func = ParticleInit, - .nm_modname = "ability.particleability", + .nm_modname = "ability.particleAbility", .nm_priv = ((void *)0), .reserved = {0}}; diff --git a/interfaces/kits/napi/aafwk/wantConstant/native_module.cpp b/interfaces/kits/napi/aafwk/wantConstant/native_module.cpp index 036f3cb76fe..5c076cf874b 100644 --- a/interfaces/kits/napi/aafwk/wantConstant/native_module.cpp +++ b/interfaces/kits/napi/aafwk/wantConstant/native_module.cpp @@ -41,7 +41,7 @@ static napi_module _module = {.nm_version = 1, .nm_flags = 0, .nm_filename = nullptr, .nm_register_func = Init, - .nm_modname = "ability.wantconstant", + .nm_modname = "ability.wantConstant", .nm_priv = ((void *)0), .reserved = {0}}; -- Gitee