From 01ca57519ce559feba2fa72d4057e0090ca28cb6 Mon Sep 17 00:00:00 2001 From: sandee Date: Tue, 25 Feb 2025 20:31:18 +0800 Subject: [PATCH 1/2] Support 2.0 Runtime in AppSpawn Issue: https://gitee.com/openharmony/startup_appspawn/issues/IBIXEM Signed-off-by: sandee Change-Id: Ied9bf1c8ed437542943e2a4cab276f7ef493a760 --- modules/ace_adapter/ace_adapter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/ace_adapter/ace_adapter.cpp b/modules/ace_adapter/ace_adapter.cpp index 8aaa6468..346d1fff 100644 --- a/modules/ace_adapter/ace_adapter.cpp +++ b/modules/ace_adapter/ace_adapter.cpp @@ -94,6 +94,13 @@ static void PreloadModule(void) return; } + options.lang = OHOS::AbilityRuntime::Runtime::Language::STS; + auto staticRuntime = OHOS::AbilityRuntime::Runtime::Create(options); + if (!staticRuntime) { + APPSPAWN_LOGE("LoadExtendLib: Failed to create static runtime"); + return; + } + ParseJsonContext context = {}; (void)ParseJsonConfig("etc/appspawn", PRELOAD_JSON_CONFIG.c_str(), GetModuleSet, &context); for (std::string moduleName : context.modules) { -- Gitee From 2de856d3698e820bb89a77061ad3f20d71095f01 Mon Sep 17 00:00:00 2001 From: sandee Date: Wed, 26 Feb 2025 17:08:28 +0800 Subject: [PATCH 2/2] Support 2.0 Runtime in AppSpawn Issue: https://gitee.com/openharmony/startup_appspawn/issues/IBIXEM Signed-off-by: sandee Change-Id: Ia3591d33b2dff058b8c0b589d73e3eeb1c55c7b2 --- modules/ace_adapter/ace_adapter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ace_adapter/ace_adapter.cpp b/modules/ace_adapter/ace_adapter.cpp index 346d1fff..30e87563 100644 --- a/modules/ace_adapter/ace_adapter.cpp +++ b/modules/ace_adapter/ace_adapter.cpp @@ -84,7 +84,7 @@ static int GetModuleSet(const cJSON *root, ParseJsonContext *context) static void PreloadModule(void) { OHOS::AbilityRuntime::Runtime::Options options; - options.lang = OHOS::AbilityRuntime::Runtime::Language::JS; + options.lang = {{OHOS::AbilityRuntime::Runtime::Language::JS, true}}; options.loadAce = true; options.preload = true; @@ -94,7 +94,7 @@ static void PreloadModule(void) return; } - options.lang = OHOS::AbilityRuntime::Runtime::Language::STS; + options.lang = {{OHOS::AbilityRuntime::Runtime::Language::STS, true}}; auto staticRuntime = OHOS::AbilityRuntime::Runtime::Create(options); if (!staticRuntime) { APPSPAWN_LOGE("LoadExtendLib: Failed to create static runtime"); @@ -106,6 +106,7 @@ static void PreloadModule(void) for (std::string moduleName : context.modules) { APPSPAWN_LOGI("moduleName %{public}s", moduleName.c_str()); runtime->PreloadSystemModule(moduleName); + staticRuntime->PreloadSystemModule(moduleName); } // Save preloaded runtime OHOS::AbilityRuntime::Runtime::SavePreloaded(std::move(runtime)); -- Gitee