!166 NAPI correction (bundleFlag)

Merge pull request !166 from blackleon/update_master_1201
This commit is contained in:
openharmony_ci 2021-12-01 06:08:25 +00:00 committed by Gitee
commit 539b3fe45f
4 changed files with 26 additions and 0 deletions

View File

@ -32,6 +32,8 @@ enum class BundleFlag {
GET_BUNDLE_DEFAULT = 0x00000000,
// get bundle info include abilityInfos
GET_BUNDLE_WITH_ABILITIES = 0x00000001,
// get application info include permission
GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008,
};
// configuration information about a bundle

View File

@ -4087,6 +4087,24 @@ void CreateQueryShortCutFlagObject(napi_env env, napi_value value)
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, value, "QUERY_SHORTCUT_HOME", nQueryShortCutHome));
}
void CreateBundleFlagObject(napi_env env, napi_value value)
{
napi_value nDefault;
NAPI_CALL_RETURN_VOID(
env, napi_create_int32(env, static_cast<int32_t>(BundleFlag::GET_BUNDLE_DEFAULT), &nDefault));
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, value, "GET_BUNDLE_DEFAULT", nDefault));
napi_value nWithAbilities;
NAPI_CALL_RETURN_VOID(
env, napi_create_int32(env, static_cast<int32_t>(BundleFlag::GET_BUNDLE_WITH_ABILITIES), &nWithAbilities));
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, value, "GET_BUNDLE_WITH_ABILITIES", nWithAbilities));
napi_value nWithPermission;
NAPI_CALL_RETURN_VOID(
env, napi_create_int32(
env, static_cast<int32_t>(BundleFlag::GET_APPLICATION_INFO_WITH_PERMISSION), &nWithPermission));
NAPI_CALL_RETURN_VOID(
env, napi_set_named_property(env, value, "GET_APPLICATION_INFO_WITH_PERMISSION", nWithPermission));
}
void CreateInstallErrorCodeObject(napi_env env, napi_value value)
{
napi_value nSuccess;

View File

@ -233,6 +233,7 @@ void CreateModuleRemoveFlagObject(napi_env env, napi_value value);
void CreateSignatureCompareResultObject(napi_env env, napi_value value);
void CreateShortcutExistenceObject(napi_env env, napi_value value);
void CreateQueryShortCutFlagObject(napi_env env, napi_value value);
void CreateBundleFlagObject(napi_env env, napi_value value);
void CreateInstallErrorCodeObject(napi_env env, napi_value value);
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -77,6 +77,10 @@ static napi_value Init(napi_env env, napi_value exports)
NAPI_CALL(env, napi_create_object(env, &nQueryShortCutFlag));
CreateQueryShortCutFlagObject(env, nShortcutExistence);
napi_value nBundleFlag = nullptr;
NAPI_CALL(env, napi_create_object(env, &nBundleFlag));
CreateBundleFlagObject(env, nBundleFlag);
napi_value nInstallErrorCode = nullptr;
NAPI_CALL(env, napi_create_object(env, &nInstallErrorCode));
CreateInstallErrorCodeObject(env, nInstallErrorCode);
@ -114,6 +118,7 @@ static napi_value Init(napi_env env, napi_value exports)
DECLARE_NAPI_PROPERTY("SignatureCompareResult", nSignatureCompareResult),
DECLARE_NAPI_PROPERTY("ShortcutExistence", nShortcutExistence),
DECLARE_NAPI_PROPERTY("QueryShortCutFlag", nQueryShortCutFlag),
DECLARE_NAPI_PROPERTY("BundleFlag", nBundleFlag),
DECLARE_NAPI_PROPERTY("InstallErrorCode", nInstallErrorCode)
};
NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc));