From 832b5d7818916fd888309bdce788c0ee7af9e0b4 Mon Sep 17 00:00:00 2001 From: hua-mengzheng Date: Thu, 24 Jul 2025 09:56:42 +0800 Subject: [PATCH] dual core upload Signed-off-by: hua-mengzheng --- appdata-sandbox-app.json | 3 ++ appdata-sandbox-gpu.json | 9 ++++ appdata-sandbox-render.json | 9 ++++ appdata-sandbox.json | 45 +++++++++++++++++++ bundle.json | 3 +- modules/nweb_adapter/BUILD.gn | 9 ++++ modules/nweb_adapter/nwebspawn_adapter.cpp | 41 +++-------------- .../unittest/app_spawn_standard_test/BUILD.gn | 26 +++++++++++ 8 files changed, 110 insertions(+), 35 deletions(-) diff --git a/appdata-sandbox-app.json b/appdata-sandbox-app.json index 15d5876d..40afc89d 100644 --- a/appdata-sandbox-app.json +++ b/appdata-sandbox-app.json @@ -150,6 +150,9 @@ }, { "src-path" : "/data/app/el1/bundle/public/", "sandbox-path" : "/data/storage/el1/bundle/arkwebcore" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/storage/el1/bundle/arkwebcorelegacy" }, { "src-path" : "/data/misc", "sandbox-path" : "/data/storage/el1/bundle/misc" diff --git a/appdata-sandbox-gpu.json b/appdata-sandbox-gpu.json index 6b8d3c82..d07783c5 100644 --- a/appdata-sandbox-gpu.json +++ b/appdata-sandbox-gpu.json @@ -70,13 +70,22 @@ "mount-paths": [{ "src-path" : "/data/app/el1/bundle/public/", "sandbox-path" : "/data/storage/el1/bundle/arkwebcore" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/storage/el1/bundle/arkwebcorelegacy" }, { "src-path" : "/system/app/", "sandbox-path" : "/system/app/" }, { + "src-path" : "/system/app/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/system/app/com.ohos.arkwebcorelegacy" + }, { "src-path" : "/module_update/ArkWebCore/app/", "sandbox-path" : "/module_update/ArkWebCore/app/" }, { + "src-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy" + }, { "src-path" : "/data/app/el1//system_optimize//shader_cache", "sandbox-path" : "/data/storage/system_optimize/shader_cache" }, { diff --git a/appdata-sandbox-render.json b/appdata-sandbox-render.json index e671f9a0..191b5241 100644 --- a/appdata-sandbox-render.json +++ b/appdata-sandbox-render.json @@ -76,12 +76,21 @@ "mount-paths": [{ "src-path" : "/data/app/el1/bundle/public/", "sandbox-path" : "/data/storage/el1/bundle/arkwebcore" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/storage/el1/bundle/arkwebcorelegacy" }, { "src-path" : "/system/app/", "sandbox-path" : "/system/app/" + }, { + "src-path" : "/system/app/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/system/app/com.ohos.arkwebcorelegacy" }, { "src-path" : "/module_update/ArkWebCore/app/", "sandbox-path" : "/module_update/ArkWebCore/app/" + }, { + "src-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy" }] } } diff --git a/appdata-sandbox.json b/appdata-sandbox.json index 38115a04..d9713a3a 100755 --- a/appdata-sandbox.json +++ b/appdata-sandbox.json @@ -280,6 +280,11 @@ "sandbox-path" : "/data/storage/el1/bundle/arkwebcore", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/storage/el1/bundle/arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/system/app/ohos.global.systemres", "sandbox-path" : "/data/global/systemResources", @@ -511,6 +516,11 @@ "sandbox-path" : "/data/storage/el1/bundle/arkwebcore", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/storage/el1/bundle/arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/system/bin", "sandbox-path" : "/system/bin", @@ -531,6 +541,11 @@ "sandbox-path" : "/system/app/", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/system/app/com.huawei.arkwebcorelegacy", + "sandbox-path" : "/system/app/com.huawei.arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/vendor/lib", "sandbox-path" : "/vendor/lib", @@ -541,6 +556,11 @@ "sandbox-path" : "/data/app/el1/bundle/public/", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/system/app/NWeb", "sandbox-path" : "/system/app/NWeb", @@ -551,6 +571,11 @@ "sandbox-path" : "/module_update/ArkWebCore/app/", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" } ], "symbol-links" : [{ @@ -606,6 +631,11 @@ "sandbox-path" : "/data/storage/el1/bundle/arkwebcore", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/storage/el1/bundle/arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/system/bin", "sandbox-path" : "/system/bin", @@ -621,6 +651,11 @@ "sandbox-path" : "/system/app/", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/system/app/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/system/app/com.ohos.arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/vendor/lib", "sandbox-path" : "/vendor/lib", @@ -631,6 +666,11 @@ "sandbox-path" : "/data/app/el1/bundle/public/", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/data/app/el1/bundle/public/com.ohos.arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/system/app/NWeb", "sandbox-path" : "/system/app/NWeb", @@ -641,6 +681,11 @@ "sandbox-path" : "/module_update/ArkWebCore/app/", "sandbox-flags" : [ "bind", "rec" ], "check-action-status": "false" + }, { + "src-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy", + "sandbox-path" : "/module_update/ArkWebCore/app/com.ohos.arkwebcorelegacy", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "false" }, { "src-path" : "/vendor/etc/vulkan/icd.d", "sandbox-path" : "/vendor/etc/vulkan/icd.d", diff --git a/bundle.json b/bundle.json index 6582a611..a926ebbb 100644 --- a/bundle.json +++ b/bundle.json @@ -78,7 +78,8 @@ "json", "faultloggerd", "dlp_permission_service", - "ffrt" + "ffrt", + "webview" ], "third_party": [ "bounds_checking_function", diff --git a/modules/nweb_adapter/BUILD.gn b/modules/nweb_adapter/BUILD.gn index 1b73d080..b6df5eab 100644 --- a/modules/nweb_adapter/BUILD.gn +++ b/modules/nweb_adapter/BUILD.gn @@ -40,6 +40,15 @@ ohos_shared_library("appspawn_nweb") { "hilog:libhilog", "init:libbegetutil", ] + + if (defined(global_parts_info) && + defined(global_parts_info.web_webview)) { + external_deps += [ + "webview:libarkweb_utils", + ] + defines += [ "NWEBSPAWN_SUPPORT_ARKWEB" ] + } + if (build_seccomp) { cflags += [ "-DWITH_SECCOMP" ] if (appspawn_seccomp_privilege) { diff --git a/modules/nweb_adapter/nwebspawn_adapter.cpp b/modules/nweb_adapter/nwebspawn_adapter.cpp index a0e16f7d..81502ca6 100644 --- a/modules/nweb_adapter/nwebspawn_adapter.cpp +++ b/modules/nweb_adapter/nwebspawn_adapter.cpp @@ -29,6 +29,7 @@ #include "appspawn_hook.h" #include "appspawn_manager.h" +#include "arkweb_utils.h" #include "parameter.h" #ifdef WITH_SECCOMP @@ -36,20 +37,9 @@ #endif namespace { -#ifdef webview_arm64 - const std::string ARK_WEB_CORE_HAP_LIB_PATH = - "/data/storage/el1/bundle/arkwebcore/libs/arm64"; -#elif webview_x86_64 - const std::string ARK_WEB_CORE_HAP_LIB_PATH = - "/data/storage/el1/bundle/arkwebcore/libs/x86_64"; -#else - const std::string ARK_WEB_CORE_HAP_LIB_PATH = - "/data/storage/el1/bundle/arkwebcore/libs/arm"; -#endif const std::string ARK_WEB_ENGINE_LIB_NAME = "libarkweb_engine.so"; const std::string ARK_WEB_RENDER_LIB_NAME = "libarkweb_render.so"; - const std::string WEB_ENGINE_LIB_NAME = "libweb_engine.so"; - const std::string WEB_RENDER_LIB_NAME = "libnweb_render.so"; + const std::string ARK_WEB_ENGINE_LIB_PRELOAD_PATH = "/data/app/el1/bundle/public/com.huawei.hmos.arkwebcore/libs/arm64"; const std::string OHOS_ADPT_GLUE_SRC_LIB_PATH = @@ -86,24 +76,6 @@ static bool SetSeccompPolicyForRenderer(void *nwebRenderHandle) return true; } -APPSPAWN_STATIC std::string GetArkWebEngineLibName() -{ - std::string arkWebEngineLibPath = ARK_WEB_CORE_HAP_LIB_PATH + "/" - + ARK_WEB_ENGINE_LIB_NAME; - bool isArkWebEngineLibPathExist = access(arkWebEngineLibPath.c_str(), F_OK) == 0; - return isArkWebEngineLibPathExist ? - ARK_WEB_ENGINE_LIB_NAME : WEB_ENGINE_LIB_NAME; -} - -APPSPAWN_STATIC std::string GetArkWebRenderLibName() -{ - std::string arkWebRenderLibPath = ARK_WEB_CORE_HAP_LIB_PATH + "/" - + ARK_WEB_RENDER_LIB_NAME; - bool isArkWebRenderLibPathExist = access(arkWebRenderLibPath.c_str(), F_OK) == 0; - return isArkWebRenderLibPathExist ? - ARK_WEB_RENDER_LIB_NAME : WEB_RENDER_LIB_NAME; -} - APPSPAWN_STATIC int RunChildProcessor(AppSpawnContent *content, AppSpawnClient *client) { uint32_t len = 0; @@ -116,14 +88,15 @@ APPSPAWN_STATIC int RunChildProcessor(AppSpawnContent *content, AppSpawnClient * void *webEngineHandle = nullptr; void *nwebRenderHandle = nullptr; - const std::string& libPath = ARK_WEB_CORE_HAP_LIB_PATH; - const std::string engineLibName = GetArkWebEngineLibName(); - const std::string renderLibName = GetArkWebRenderLibName(); + std::string libPath = OHOS::ArkWeb::GetArkwebLibPath(); + std::string libNsName = OHOS::ArkWeb::GetArkwebNameSpace(); + const std::string engineLibName = ARK_WEB_ENGINE_LIB_NAME; + const std::string renderLibName = ARK_WEB_RENDER_LIB_NAME; #ifdef __MUSL__ Dl_namespace dlns; Dl_namespace ndkns; - dlns_init(&dlns, "nweb_ns"); + dlns_init(&dlns, libNsName.c_str()); dlns_create(&dlns, libPath.c_str()); dlns_get("ndk", &ndkns); dlns_inherit(&dlns, &ndkns, "allow_all_shared_libs"); diff --git a/test/unittest/app_spawn_standard_test/BUILD.gn b/test/unittest/app_spawn_standard_test/BUILD.gn index af8665d2..85ebb8c7 100644 --- a/test/unittest/app_spawn_standard_test/BUILD.gn +++ b/test/unittest/app_spawn_standard_test/BUILD.gn @@ -171,6 +171,14 @@ ohos_unittest("AppSpawn_ut") { "resource_management:global_resmgr", ] + if (defined(global_parts_info) && + defined(global_parts_info.web_webview)) { + external_deps += [ + "webview:libarkweb_utils", + ] + defines += [ "NWEBSPAWN_SUPPORT_ARKWEB" ] + } + if (appspawn_hitrace_option == true) { defines += [ "APPSPAWN_HITRACE_OPTION" ] external_deps += [ "hitrace:libhitrace_option" ] @@ -354,6 +362,15 @@ ohos_unittest("AppSpawn_coldrun_ut") { "os_account:os_account_innerkits", "resource_management:global_resmgr", ] + + if (defined(global_parts_info) && + defined(global_parts_info.web_webview)) { + external_deps += [ + "webview:libarkweb_utils", + ] + defines += [ "NWEBSPAWN_SUPPORT_ARKWEB" ] + } + if (enable_appspawn_dump_catcher) { external_deps += [ "faultloggerd:libdfx_dumpcatcher" ] } @@ -530,6 +547,15 @@ ohos_unittest("AppSpawn_common_ut") { "os_account:os_account_innerkits", "resource_management:global_resmgr", ] + + if (defined(global_parts_info) && + defined(global_parts_info.web_webview)) { + external_deps += [ + "webview:libarkweb_utils", + ] + defines += [ "NWEBSPAWN_SUPPORT_ARKWEB" ] + } + if (enable_appspawn_dump_catcher) { external_deps += [ "faultloggerd:libdfx_dumpcatcher" ] } -- Gitee