From 4774a53b8c3d893fadf89fac0cc0e19bf55ca962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E9=B8=BF?= Date: Wed, 29 May 2024 10:05:49 +0800 Subject: [PATCH 01/54] =?UTF-8?q?IssueNo:=20#I9T0HG:[=E6=96=B0=E9=9C=80?= =?UTF-8?q?=E6=B1=82]:=20=E6=96=B0=E5=A2=9E=E5=9E=82=E5=9F=9F=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E6=89=A9=E5=B1=95=E8=83=BD=E5=8A=9B-=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BC=96=E8=BE=91=20Description:=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=9E=82=E5=9F=9F=E4=B8=89=E6=96=B9=E6=89=A9=E5=B1=95=E8=83=BD?= =?UTF-8?q?=E5=8A=9B-=E5=9B=BE=E7=89=87=E7=BC=96=E8=BE=91=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴鸿 --- bundle.json | 937 +++++++++--------- frameworks/js/napi/BUILD.gn | 2 + .../photo_editor_extension_ability/BUILD.gn | 50 + .../photo_editor_extension_ability.js | 23 + .../photo_editor_extension_ability_module.cpp | 54 + .../photo_editor_extension_context/BUILD.gn | 50 + .../photo_editor_extension_context.js | 32 + .../photo_editor_extension_context_module.cpp | 55 + frameworks/native/ability/native/BUILD.gn | 85 ++ .../native/extension_ability_thread.cpp | 4 +- .../js_photo_editor_extension.cpp | 77 ++ .../js_photo_editor_extension_context.cpp | 215 ++++ .../js_photo_editor_extension_impl.cpp | 182 ++++ .../photo_editor_extension.cpp | 38 + .../photo_editor_extension_context.cpp | 152 +++ .../photo_editor_extension_module_loader.cpp | 47 + .../js_photo_editor_extension.h | 65 ++ .../js_photo_editor_extension_context.h | 57 ++ .../js_photo_editor_extension_impl.h | 56 ++ .../photo_editor_extension.h | 44 + .../photo_editor_extension_context.h | 81 ++ .../photo_editor_extension_module_loader.h | 48 + services/common/include/ui_extension_utils.h | 5 +- test/unittest/BUILD.gn | 1 + .../photo_editor_extension_test/BUILD.gn | 151 +++ ...to_editor_extension_module_loader_test.cpp | 100 ++ .../photo_editor_extension_test.cpp | 102 ++ 27 files changed, 2239 insertions(+), 474 deletions(-) create mode 100755 frameworks/js/napi/photo_editor_extension_ability/BUILD.gn create mode 100644 frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js create mode 100644 frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp create mode 100755 frameworks/js/napi/photo_editor_extension_context/BUILD.gn create mode 100755 frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js create mode 100755 frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp create mode 100644 frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp create mode 100644 frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp create mode 100644 frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp create mode 100644 frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp create mode 100644 frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp create mode 100644 frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp create mode 100644 interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.h create mode 100644 interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h create mode 100644 interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.h create mode 100644 interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension.h create mode 100644 interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h create mode 100644 interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.h create mode 100644 test/unittest/photo_editor_extension_test/BUILD.gn create mode 100644 test/unittest/photo_editor_extension_test/photo_editor_extension_module_loader_test.cpp create mode 100644 test/unittest/photo_editor_extension_test/photo_editor_extension_test.cpp diff --git a/bundle.json b/bundle.json index 090d7539de0..75f2e078048 100644 --- a/bundle.json +++ b/bundle.json @@ -1,475 +1,468 @@ { - "name": "@ohos/ability_runtime", - "description": "Ability管理服务统一调度和管理应用中各Ability和应用管理服务, 用于管理应用运行关系、调度应用进程生命周期及状态", - "version": "3.1", - "license": "Apache License 2.0", - "publishAs": "code-segment", - "segment": { - "destPath": "foundation/ability/ability_runtime" - }, - "dirs": {}, - "scripts": {}, - "component": { - "name": "ability_runtime", - "subsystem": "ability", - "syscap": [ - "SystemCapability.Ability.AbilityRuntime.Core", - "SystemCapability.Ability.AbilityRuntime.FAModel", - "SystemCapability.Ability.AbilityRuntime.AbilityCore", - "SystemCapability.Ability.AbilityRuntime.Mission", - "SystemCapability.Ability.AbilityRuntime.QuickFix", - "SystemCapability.Ability.AbilityTools.AbilityAssistant", - "SystemCapability.Ability.AppStartup" - ], - "features": [ - "ability_runtime_auto_fill_ability", - "ability_runtime_graphics", - "ability_runtime_power" - ], - "adapted_system_type": [ - "standard" - ], - "rom": "", - "ram": "", - "hisysevent_config":[ - "//foundation/ability/ability_runtime/hisysevent.yaml" - ], - "deps": { - "components": [ - "ability_base", - "accessibility", - "access_token", - "ace_engine", - "appspawn", - "background_task_mgr", - "bundle_framework", - "common_event_service", - "config_policy", - "c_utils", - "data_share", - "dlp_permission_service", - "dsoftbus", - "efficiency_manager", - "eventhandler", - "ets_runtime", - "ets_utils", - "faultloggerd", - "ffrt", - "form_fwk", - "graphic_2d", - "hichecker", - "hicollie", - "hilog", - "hisysevent", - "hitrace", - "hiview", - "i18n", - "icu", - "image_framework", - "init", - "input", - "ipc", - "json", - "jsoncpp", - "kv_store", - "libuv", - "memmgr", - "memmgr_override", - "memory_utils", - "napi", - "netmanager_base", - "node", - "os_account", - "power_manager", - "relational_store", - "resource_management", - "resource_schedule_service", - "safwk", - "samgr", - "screenlock_mgr", - "storage_service", - "toolchain", - "webview", - "window_manager", - "zlib" - ], - "third_party": [ - "libjpeg-turbo" - ] - }, - "build": { - "sub_component": [ - "//foundation/ability/ability_runtime/services:ams_target", - "//foundation/ability/ability_runtime/services/sa_profile:ams_sa_profile", - "//foundation/ability/ability_runtime/services/quickfixmgr:quick_fix.cfg", - "//foundation/ability/ability_runtime/tools:tools_target", - "//foundation/ability/ability_runtime/interfaces/inner_api:innerkits_target", - "//foundation/ability/ability_runtime/frameworks/native/ability/native:ability_thread", - "//foundation/ability/ability_runtime/frameworks/native/ability/native:extension_module", - "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process", - "//foundation/ability/ability_runtime/frameworks/native/insight_intent:insight_intent_innerkits", - "//foundation/ability/ability_runtime/frameworks/js/napi:napi_packages", - "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment", - "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment", - "//foundation/ability/ability_runtime/services/abilitymgr/etc:appfwk_etc", - "//foundation/ability/ability_runtime/service_router_framework:srms_target", - "//foundation/ability/ability_runtime/service_router_framework:jsapi_target" + "name": "@ohos/ability_runtime", + "description": "Ability管理服务统一调度和管理应用中各Ability和应用管理服务, 用于管理应用运行关系、调度应用进程生命周期及状态", + "version": "3.1", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "foundation/ability/ability_runtime" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "ability_runtime", + "subsystem": "ability", + "syscap": [ + "SystemCapability.Ability.AbilityRuntime.Core", + "SystemCapability.Ability.AbilityRuntime.FAModel", + "SystemCapability.Ability.AbilityRuntime.AbilityCore", + "SystemCapability.Ability.AbilityRuntime.Mission", + "SystemCapability.Ability.AbilityRuntime.QuickFix", + "SystemCapability.Ability.AbilityTools.AbilityAssistant", + "SystemCapability.Ability.AppStartup" ], - "inner_api": [ - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper/include", - "header_files": [ - "os_account_manager_wrapper.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper:ability_deps_wrapper" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils/include", - "header_files": [ - "ability_runtime_error_util.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils:ability_runtime_error_util" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent/include/", - "header_files": [ - "pending_want.h", - "trigger_info.h", - "want_agent_constant.h", - "want_agent_helper.h", - "want_agent_info.h", - "want_agent.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent:wantagent_innerkits" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "ability_manager_client.h", - "launch_param.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/ability_runtime", - "header_files": [ - "ability_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability:ability_context_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/js_environment/interfaces/inner_api", - "header_files": [ - "js_environment.h", - "js_environment_impl.h" - ] - }, - "name": "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/cj_environment/interfaces/inner_api", - "header_files": [ - "cj_environment.h" - ] - }, - "name": "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime/include/", - "header_files": [ - "js_runtime.h", - "runtime.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime:runtime" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context/include", - "header_files": [ - "napi_base_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context:napi_base_context" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common", - "header_files": [ - "napi_common_configuration.h", - "napi_common_start_options.h", - "napi_common_util.h", - "napi_common_want.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common:napi_common" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common", - "header_files": [ - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common:napi_ability_common" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include", - "header_files": [ - "appmgr/app_mgr_client.h", - "appmgr/page_state_data.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager:app_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager/include", - "header_files": [ - "connection_observer_client.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager:connection_obs_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [ - "service_extension.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:service_extension" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [ - "extension.h", - "extension_base.h", - "extension_module_loader.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:extensionkit_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [ - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:abilitykit_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [ - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:data_ability_helper" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/app/", - "header_files": [ - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:appkit_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info/include", - "header_files": [ - "request_info.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info:dialog_request_info" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "ability_connect_callback_stub.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_connect_callback_stub" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/ability_runtime/context", - "header_files": [ - "application_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:app_context" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/c/ability/ability_runtime/child_process", - "header_files": [ - "native_child_process.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission/include/", - "header_files": [ - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission:uri_permission_mgr" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix/include/", - "header_files": [ - "quick_fix_manager_client.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix:quickfix_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager/", - "header_files": [ - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager:dataobs_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api/include", - "header_files": [ - "service_info.h", - "service_router_mgr_interface.h", - "service_router_mgr_proxy.h" - ] - }, - "name": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api:srms_fwk" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/simulator", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/frameworks/simulator/ability_simulator:ability_simulator" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/tools/aa/include", - "header_files": [ - "shell_command.h" - ] - }, - "name": "//foundation/ability/ability_runtime/tools/aa:tools_aa_source_set" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "ability_start_setting.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_setting" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "process_options.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:process_options" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "mission_info.h", - "mission_snapshot.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:mission_info" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/ui_extension_ability", - "header_files": [ - "ui_extension_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:ui_extension" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager/include", - "header_files": [ - "extension_manager_client.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager:extension_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler/include", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler:session_handler" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager/include", - "header_files": [ - "auto_fill_error.h", - "auto_fill_manager.h", - "fill_request_callback_interface.h", - "save_request_callback_interface.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager:auto_fill_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "start_options.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_options" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/dialog_request_callback", - "header_files": [ - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:dialog_request_callback" - } + "features": [ + "ability_runtime_auto_fill_ability", + "ability_runtime_graphics", + "ability_runtime_power" ], - "test": [ - "//foundation/ability/ability_runtime/test/moduletest:moduletest", - "//foundation/ability/ability_runtime/test/fuzztest:fuzztest", - "//foundation/ability/ability_runtime/test/unittest:unittest", - "//foundation/ability/ability_runtime/test/sample:sample", - "//foundation/ability/ability_runtime/tools/test:moduletest", - "//foundation/ability/ability_runtime/tools/test:systemtest", - "//foundation/ability/ability_runtime/tools/test:unittest", - "//foundation/ability/ability_runtime/js_environment/test/unittest:unittest", - "//foundation/ability/ability_runtime/service_router_framework:test_target" - ] - } - } -} + "adapted_system_type": [ + "standard" + ], + "rom": "", + "ram": "", + "hisysevent_config": [ + "//foundation/ability/ability_runtime/hisysevent.yaml" + ], + "deps": { + "components": [ + "ability_base", + "accessibility", + "access_token", + "ace_engine", + "appspawn", + "background_task_mgr", + "bundle_framework", + "common_event_service", + "config_policy", + "c_utils", + "data_share", + "dlp_permission_service", + "dsoftbus", + "efficiency_manager", + "eventhandler", + "ets_runtime", + "ets_utils", + "faultloggerd", + "ffrt", + "form_fwk", + "graphic_2d", + "hichecker", + "hicollie", + "hilog", + "hisysevent", + "hitrace", + "hiview", + "i18n", + "icu", + "image_framework", + "init", + "input", + "ipc", + "json", + "jsoncpp", + "kv_store", + "libuv", + "memmgr", + "memmgr_override", + "memory_utils", + "napi", + "netmanager_base", + "node", + "os_account", + "power_manager", + "relational_store", + "resource_management", + "resource_schedule_service", + "safwk", + "samgr", + "screenlock_mgr", + "storage_service", + "toolchain", + "webview", + "window_manager", + "zlib", + "app_file_service" + ], + "third_party": [ + "libjpeg-turbo" + ] + }, + "build": { + "sub_component": [ + "//foundation/ability/ability_runtime/services:ams_target", + "//foundation/ability/ability_runtime/services/sa_profile:ams_sa_profile", + "//foundation/ability/ability_runtime/services/quickfixmgr:quick_fix.cfg", + "//foundation/ability/ability_runtime/tools:tools_target", + "//foundation/ability/ability_runtime/interfaces/inner_api:innerkits_target", + "//foundation/ability/ability_runtime/frameworks/native/ability/native:ability_thread", + "//foundation/ability/ability_runtime/frameworks/native/ability/native:extension_module", + "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process", + "//foundation/ability/ability_runtime/frameworks/native/insight_intent:insight_intent_innerkits", + "//foundation/ability/ability_runtime/frameworks/js/napi:napi_packages", + "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment", + "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment", + "//foundation/ability/ability_runtime/services/abilitymgr/etc:appfwk_etc", + "//foundation/ability/ability_runtime/service_router_framework:srms_target", + "//foundation/ability/ability_runtime/service_router_framework:jsapi_target" + ], + "inner_api": [{ + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper/include", + "header_files": [ + "os_account_manager_wrapper.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper:ability_deps_wrapper" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils/include", + "header_files": [ + "ability_runtime_error_util.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils:ability_runtime_error_util" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent/include/", + "header_files": [ + "pending_want.h", + "trigger_info.h", + "want_agent_constant.h", + "want_agent_helper.h", + "want_agent_info.h", + "want_agent.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent:wantagent_innerkits" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "ability_manager_client.h", + "launch_param.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/ability_runtime", + "header_files": [ + "ability_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability:ability_context_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/js_environment/interfaces/inner_api", + "header_files": [ + "js_environment.h", + "js_environment_impl.h" + ] + }, + "name": "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/cj_environment/interfaces/inner_api", + "header_files": [ + "cj_environment.h" + ] + }, + "name": "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime/include/", + "header_files": [ + "js_runtime.h", + "runtime.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime:runtime" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context/include", + "header_files": [ + "napi_base_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context:napi_base_context" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common", + "header_files": [ + "napi_common_configuration.h", + "napi_common_start_options.h", + "napi_common_util.h", + "napi_common_want.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common:napi_common" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common:napi_ability_common" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include", + "header_files": [ + "appmgr/app_mgr_client.h", + "appmgr/page_state_data.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager:app_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager/include", + "header_files": [ + "connection_observer_client.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager:connection_obs_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [ + "service_extension.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:service_extension" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [ + "extension.h", + "extension_base.h", + "extension_module_loader.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:extensionkit_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:abilitykit_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:data_ability_helper" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/app/", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:appkit_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info/include", + "header_files": [ + "request_info.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info:dialog_request_info" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "ability_connect_callback_stub.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_connect_callback_stub" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/ability_runtime/context", + "header_files": [ + "application_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:app_context" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/c/ability/ability_runtime/child_process", + "header_files": [ + "native_child_process.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission/include/", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission:uri_permission_mgr" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix/include/", + "header_files": [ + "quick_fix_manager_client.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix:quickfix_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager/", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager:dataobs_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api/include", + "header_files": [ + "service_info.h", + "service_router_mgr_interface.h", + "service_router_mgr_proxy.h" + ] + }, + "name": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api:srms_fwk" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/simulator", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/frameworks/simulator/ability_simulator:ability_simulator" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/tools/aa/include", + "header_files": [ + "shell_command.h" + ] + }, + "name": "//foundation/ability/ability_runtime/tools/aa:tools_aa_source_set" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "ability_start_setting.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_setting" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "process_options.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:process_options" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "mission_info.h", + "mission_snapshot.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:mission_info" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/ui_extension_ability", + "header_files": [ + "ui_extension_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:ui_extension" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager/include", + "header_files": [ + "extension_manager_client.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager:extension_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler/include", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler:session_handler" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager/include", + "header_files": [ + "auto_fill_error.h", + "auto_fill_manager.h", + "fill_request_callback_interface.h", + "save_request_callback_interface.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager:auto_fill_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "start_options.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_options" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/dialog_request_callback", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:dialog_request_callback" + } + ], + "test": [ + "//foundation/ability/ability_runtime/test/moduletest:moduletest", + "//foundation/ability/ability_runtime/test/fuzztest:fuzztest", + "//foundation/ability/ability_runtime/test/unittest:unittest", + "//foundation/ability/ability_runtime/test/sample:sample", + "//foundation/ability/ability_runtime/tools/test:moduletest", + "//foundation/ability/ability_runtime/tools/test:systemtest", + "//foundation/ability/ability_runtime/tools/test:unittest", + "//foundation/ability/ability_runtime/js_environment/test/unittest:unittest", + "//foundation/ability/ability_runtime/service_router_framework:test_target" + ] + } + } +} \ No newline at end of file diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index 2cdc32765be..d023a37eb92 100644 --- a/frameworks/js/napi/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -91,5 +91,7 @@ group("napi_packages") { "${ability_runtime_napi_path}/wantConstant:wantconstant_napi", "${ability_runtime_napi_path}/wantagent:napi_wantAgent", "${ability_runtime_napi_path}/wantagent:wantagent", + "${ability_runtime_napi_path}/photo_editor_extension_ability:photoeditorextensionability_napi", + "${ability_runtime_napi_path}/photo_editor_extension_context:photoeditorextensioncontext_napi", ] } diff --git a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn new file mode 100755 index 00000000000..092ebaa2662 --- /dev/null +++ b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") +import("//build/ohos.gni") + +es2abc_gen_abc("gen_photo_editor_extension_ability_abc") { + src_js = rebase_path("photo_editor_extension_ability.js") + dst_file = rebase_path(target_out_dir + "/photo_editor_extension_ability.abc") + in_puts = [ "photo_editor_extension_ability.js" ] + out_puts = [ target_out_dir + "/photo_editor_extension_ability.abc" ] + extra_args = [ "--module" ] +} + +gen_js_obj("photo_editor_extension_ability_js") { + input = "photo_editor_extension_ability.js" + output = target_out_dir + "/photo_editor_extension_ability.o" +} + +gen_js_obj("photo_editor_extension_ability_abc") { + input = get_label_info(":gen_photo_editor_extension_ability_abc", "target_out_dir") + + "/photo_editor_extension_ability.abc" + output = target_out_dir + "/photo_editor_extension_ability_abc.o" + dep = ":gen_photo_editor_extension_ability_abc" +} + +ohos_shared_library("photoeditorextensionability_napi") { + sources = [ "photo_editor_extension_ability_module.cpp" ] + + deps = [ + ":photo_editor_extension_ability_abc", + ":photo_editor_extension_ability_js", + ] + + external_deps = [ "napi:ace_napi" ] + + relative_install_dir = "module/app/ability" + subsystem_name = "ability" + part_name = "ability_runtime" +} diff --git a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js new file mode 100644 index 00000000000..6ae8de40ff9 --- /dev/null +++ b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let UIExtensionAbility = requireNapi('app.ability.UIExtensionAbility'); + +export default class PhotoEditorExtensionAbility extends UIExtensionAbility { + + onStartContentEditing(uri, want, session) { + console.log("onStartContentEditing: " + uri); + } +} \ No newline at end of file diff --git a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp new file mode 100644 index 00000000000..6202e03e832 --- /dev/null +++ b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "native_engine/native_engine.h" + +extern const char _binary_photo_editor_extension_ability_js_start[]; +extern const char _binary_photo_editor_extension_ability_js_end[]; +extern const char _binary_photo_editor_extension_ability_abc_start[]; +extern const char _binary_photo_editor_extension_ability_abc_end[]; + +static napi_module _module = { + .nm_version = 0, + .nm_filename = "app/ability/libphotoeditorextensionability_napi.so/photo_editor_extension_ability.js", + .nm_modname = "app.ability.PhotoEditorExtensionAbility", +}; +extern "C" __attribute__((constructor)) void NAPI_app_ability_PhotoEditorExtensionAbility_AutoRegister() +{ + napi_module_register(&_module); +} + +extern "C" __attribute__((visibility("default"))) void +NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode(const char **buf, int *bufLen) +{ + if (buf != nullptr) { + *buf = _binary_photo_editor_extension_ability_js_start; + } + + if (bufLen != nullptr) { + *bufLen = _binary_photo_editor_extension_ability_js_end - _binary_photo_editor_extension_ability_js_start; + } +} + +extern "C" __attribute__((visibility("default"))) void +NAPI_app_ability_PhotoEditorExtensionAbility_GetABCCode(const char **buf, int *buflen) +{ + if (buf != nullptr) { + *buf = _binary_photo_editor_extension_ability_abc_start; + } + if (buflen != nullptr) { + *buflen = _binary_photo_editor_extension_ability_abc_end - _binary_photo_editor_extension_ability_abc_start; + } +} \ No newline at end of file diff --git a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn new file mode 100755 index 00000000000..6070cee55b7 --- /dev/null +++ b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") +import("//build/ohos.gni") + +es2abc_gen_abc("gen_photo_editor_extension_context_abc") { + src_js = rebase_path("photo_editor_extension_context.js") + dst_file = rebase_path(target_out_dir + "/photo_editor_extension_context.abc") + in_puts = [ "photo_editor_extension_context.js" ] + out_puts = [ target_out_dir + "/photo_editor_extension_context.abc" ] + extra_args = [ "--module" ] +} + +gen_js_obj("photo_editor_extension_context_js") { + input = "photo_editor_extension_context.js" + output = target_out_dir + "/photo_editor_extension_context.o" +} + +gen_js_obj("photo_editor_extension_context_abc") { + input = get_label_info(":gen_photo_editor_extension_context_abc", "target_out_dir") + + "/photo_editor_extension_context.abc" + output = target_out_dir + "/photo_editor_extension_context_abc.o" + dep = ":gen_photo_editor_extension_context_abc" +} + +ohos_shared_library("photoeditorextensioncontext_napi") { + sources = [ "photo_editor_extension_context_module.cpp" ] + + deps = [ + ":photo_editor_extension_context_abc", + ":photo_editor_extension_context_js", + ] + + external_deps = [ "napi:ace_napi" ] + + relative_install_dir = "module/application" + subsystem_name = "ability" + part_name = "ability_runtime" +} diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js new file mode 100755 index 00000000000..6dab992a8c7 --- /dev/null +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let UIExtensionContext = requireNapi('application.UIExtensionContext'); + +export class PhotoEditorExtensionContext extends UIExtensionContext { + constructor(obj) { + super(obj); + } + + saveEditedContentWithUri(uri, asyncCallback) { + console.log("saveEditedContent with uri: " + uri); + return this.__context_impl__.saveEditedContentWithUri(uri, asyncCallback); + } + + saveEditedContentWithImage(image, option, asyncCallback) { + console.log("saveEditedContent with image pixmap."); + return this.__context_impl__.saveEditedContentWithImage(image, option, asyncCallback); + } +} \ No newline at end of file diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp new file mode 100755 index 00000000000..17f60e93525 --- /dev/null +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "native_engine/native_engine.h" + +extern const char _binary_photo_editor_extension_context_js_start[]; +extern const char _binary_photo_editor_extension_context_js_end[]; +extern const char _binary_photo_editor_extension_context_abc_start[]; +extern const char _binary_photo_editor_extension_context_abc_end[]; + +static napi_module _module = { + .nm_version = 0, + .nm_filename = "application/libphotoeditorextensioncontext_napi.so/photo_editor_extension_context.js", + .nm_modname = "application.PhotoEditorExtensionContext", +}; +extern "C" __attribute__((constructor)) void NAPI_application_PhotoEditorExtensionContext_AutoRegister() +{ + napi_module_register(&_module); +} + +extern "C" __attribute__((visibility("default"))) void +NAPI_application_PhotoEditorExtensionContext_GetJSCode(const char **buf, int *bufLen) +{ + if (buf != nullptr) { + *buf = _binary_photo_editor_extension_context_js_start; + } + + if (bufLen != nullptr) { + *bufLen = _binary_photo_editor_extension_context_js_end - _binary_photo_editor_extension_context_js_start; + } +} + +// ability_context JS register +extern "C" __attribute__((visibility("default"))) void +NAPI_application_PhotoEditorExtensionContext_GetABCCode(const char **buf, int *buflen) +{ + if (buf != nullptr) { + *buf = _binary_photo_editor_extension_context_abc_start; + } + if (buflen != nullptr) { + *buflen = _binary_photo_editor_extension_context_abc_end - _binary_photo_editor_extension_context_abc_start; + } +} diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index c748845ccf0..0fac3af6ece 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -980,6 +980,7 @@ group("extension_module") { ":service_extension_module", ":share_extension_module", ":ui_extension_module", + ":photo_editor_extension_module" ] if (ability_runtime_graphics) { @@ -1511,3 +1512,87 @@ ohos_shared_library("auto_fill_extension_module") { subsystem_name = "ability" part_name = "ability_runtime" } + +config("photo_editor_extension_config") { + visibility = [ ":*" ] + include_dirs = [ + "${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime", + "${ability_runtime_path}/interfaces/kits/native/ability/native/ui_extension_ability", + "${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime", + "${ability_runtime_path}/interfaces/kits/native/ability/native", + "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", + "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", + "${ability_runtime_path}/interfaces/kits/native/ability/native/photo_editor_extension_ability" + ] +} + +ohos_shared_library("photo_editor_extension") { + configs = [ ":photo_editor_extension_config" ] + + sources = [ + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp", + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp", + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp", + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp", + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp" + ] + + deps = [ + ":abilitykit_native", + ":ui_extension", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/runtime:runtime", + "${ability_runtime_napi_path}/inner/napi_common:napi_common", + "${ability_runtime_native_path}/ability:ability_context_native", + "${ability_runtime_native_path}/ability/native:ability_business_error", + "${ability_runtime_native_path}/appkit:app_context", + ] + + external_deps = [ + "ability_base:want", + "ability_base:zuri", + "c_utils:utils", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_napi", + "napi:ace_napi", + "app_file_service:fileuri_native", + "image_framework:image", + "image_framework:image_native" + ] + + if (ability_runtime_graphics) { + external_deps += [ "window_manager:libwm" ] + } + + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_shared_library("photo_editor_extension_module") { + sources = [ "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp" ] + + configs = [ + ":ability_config", + ":photo_editor_extension_config", + ] + + deps = [ + ":photo_editor_extension", + "${ability_runtime_innerkits_path}/runtime:runtime", + ] + + external_deps = [ + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "bundle_framework:appexecfwk_core", + "hilog:libhilog", + "napi:ace_napi", + ] + + relative_install_dir = "extensionability/" + subsystem_name = "ability" + part_name = "ability_runtime" +} diff --git a/frameworks/native/ability/native/extension_ability_thread.cpp b/frameworks/native/ability/native/extension_ability_thread.cpp index e6998c0045c..4ba697128e4 100644 --- a/frameworks/native/ability/native/extension_ability_thread.cpp +++ b/frameworks/native/ability/native/extension_ability_thread.cpp @@ -38,6 +38,7 @@ constexpr static char ACTION_EXTENSION[] = "ActionExtensionAbility"; constexpr static char SHARE_EXTENSION[] = "ShareExtensionAbility"; constexpr static char AUTO_FILL_EXTENSION[] = "AutoFillExtensionAbility"; constexpr static char EMBEDDED_UI_EXTENSION[] = "EmbeddedUIExtensionAbility"; +constexpr static char PHOTO_EDITOR_EXTENSION[] = "PhotoEditorExtensionAbility"; #endif constexpr static char BASE_SERVICE_EXTENSION[] = "ServiceExtension"; constexpr static char BASE_DRIVER_EXTENSION[] = "DriverExtension"; @@ -58,7 +59,8 @@ const std::map UI_EXTENSION_NAME_ { AppExecFwk::ExtensionAbilityType::ACTION, ACTION_EXTENSION }, { AppExecFwk::ExtensionAbilityType::AUTO_FILL_PASSWORD, AUTO_FILL_EXTENSION }, { AppExecFwk::ExtensionAbilityType::AUTO_FILL_SMART, AUTO_FILL_EXTENSION }, - { AppExecFwk::ExtensionAbilityType::EMBEDDED_UI, EMBEDDED_UI_EXTENSION } + { AppExecFwk::ExtensionAbilityType::EMBEDDED_UI, EMBEDDED_UI_EXTENSION }, + { AppExecFwk::ExtensionAbilityType::PHOTO_EDITOR, PHOTO_EDITOR_EXTENSION } }; ExtensionAbilityThread::ExtensionAbilityThread() : extensionImpl_(nullptr), currentExtension_(nullptr) {} diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp new file mode 100644 index 00000000000..bb1ae970402 --- /dev/null +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "js_photo_editor_extension.h" +#include "js_photo_editor_extension_context.h" +#include "js_photo_editor_extension_impl.h" +#include "hilog_tag_wrapper.h" + +namespace OHOS { +namespace AbilityRuntime { + +JsPhotoEditorExtension *JsPhotoEditorExtension::Create(const std::unique_ptr &runtime) +{ + return new (std::nothrow) JsPhotoEditorExtension(runtime); +} + +JsPhotoEditorExtension::JsPhotoEditorExtension(const std::unique_ptr &runtime) +{ + impl_ = std::make_shared(runtime); + SetUIExtensionBaseImpl(impl_); +} + +void JsPhotoEditorExtension::Init(const std::shared_ptr &record, + const std::shared_ptr &application, + std::shared_ptr &handler, + const sptr &token) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "Begin init photo editor extension."); + std::shared_ptr context = std::make_shared(); + context->SetToken(token); + auto appContext = Context::GetApplicationContext(); + if (appContext == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "ServiceExtension::CreateAndInitContext appContext is nullptr."); + return; + } + context->SetApplicationInfo(appContext->GetApplicationInfo()); + context->SetResourceManager(appContext->GetResourceManager()); + context->SetParentContext(appContext); + + if (record == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "ServiceExtension::CreateAndInitContext record is nullptr."); + return; + } + TAG_LOGD(AAFwkTag::UI_EXT, "Begin init abilityInfo."); + auto abilityInfo = record->GetAbilityInfo(); + context->SetAbilityInfo(abilityInfo); + context->InitHapModuleInfo(abilityInfo); + context->SetConfiguration(appContext->GetConfiguration()); + if (abilityInfo->applicationInfo.multiProjects) { + std::shared_ptr moduleContext = context->CreateModuleContext(abilityInfo->moduleName); + if (moduleContext != nullptr) { + auto rm = moduleContext->GetResourceManager(); + context->SetResourceManager(rm); + } + } + + Extension::Init(record, application, handler, token); + impl_->SetContext(context); + impl_->SetAbilityInfo(Extension::abilityInfo_); + auto extensionCommon = impl_->Init(record, application, handler, token); + ExtensionBase::SetExtensionCommon(extensionCommon); +} + +} // namespace AbilityRuntime +} // namespace OHOS diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp new file mode 100644 index 00000000000..ebdb759dbd8 --- /dev/null +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "js_photo_editor_extension_context.h" +#include "hilog_tag_wrapper.h" +#include "js_error_utils.h" +#include "js_runtime.h" +#include "js_runtime_utils.h" +#include "js_ui_extension_context.h" +#include "napi/native_api.h" +#include "napi_common_util.h" +#include "napi_common_want.h" +#include "pixel_map_napi.h" + +namespace OHOS { +namespace AbilityRuntime { +namespace { +constexpr size_t ARGC_TWO = 2; +constexpr size_t ARGC_THREE = 3; +constexpr const char *ERR_MSG_PARAMS_ERROR = "Params error"; +constexpr const char *ERR_MSG_INTERNAL_ERROR = "Internal error"; +constexpr int32_t INDEX_ZERO = 0; +constexpr int32_t INDEX_ONE = 1; +constexpr int32_t INDEX_TWO = 2; +} // namespace + +void JsPhotoEditorExtensionContext::Finalizer(napi_env env, void *data, void *hint) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "JsUIExtensionContext finalizer is called"); + std::unique_ptr(static_cast(data)); +} + +napi_value +JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(napi_env env, + std::shared_ptr context) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "CreateJsPhotoEditorExtensionContext begin."); + std::shared_ptr abilityInfo = nullptr; + if (context) { + abilityInfo = context->GetAbilityInfo(); + } + + napi_value objValue = JsUIExtensionContext::CreateJsUIExtensionContext(env, context); + std::unique_ptr jsContext = std::make_unique(context); + napi_status status = napi_wrap(env, objValue, jsContext.release(), Finalizer, nullptr, nullptr); + if (status != napi_ok) { + TAG_LOGE(AAFwkTag::UI_EXT, "Failed to do napi wrap."); + } + + const char *moduleName = "JsPhotoEditorExtensionContext"; + BindNativeFunction(env, objValue, "saveEditedContentWithUri", moduleName, SaveEditedContentWithUri); + BindNativeFunction(env, objValue, "saveEditedContentWithImage", moduleName, SaveEditedContentWithImage); + + return objValue; +} + +napi_value JsPhotoEditorExtensionContext::SaveEditedContentWithUri(napi_env env, napi_callback_info info) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "SaveEditedContentWithUri is called."); + GET_NAPI_INFO_AND_CALL(env, info, JsPhotoEditorExtensionContext, OnSaveEditedContentWithUri); +} + +napi_value JsPhotoEditorExtensionContext::SaveEditedContentWithImage(napi_env env, napi_callback_info info) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "SaveEditedContentWithImage is called."); + GET_NAPI_INFO_AND_CALL(env, info, JsPhotoEditorExtensionContext, OnSaveEditedContentWithImage); +} + +napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env env, NapiCallbackInfo &info) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithUri is called: param size: %{public}d.", + static_cast(info.argc)); + + if (info.argc != ARGC_TWO) { + ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); + return CreateJsUndefined(env); + } + + std::string uri = AppExecFwk::UnwrapStringFromJS(env, info.argv[INDEX_ZERO]); + TAG_LOGD(AAFwkTag::UI_EXT, "Uri: %{public}s.", uri.c_str()); + + auto context = context_.lock(); + if (context == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Context is released."); + ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR), ERR_MSG_INTERNAL_ERROR); + return CreateJsUndefined(env); + } + + NapiAsyncTask::CompleteCallback complete = [weak = context_, uri](napi_env env, NapiAsyncTask &task, + int32_t status) { + TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithUri begin."); + auto context = weak.lock(); + if (!context) { + TAG_LOGE(AAFwkTag::UI_EXT, "Context is released."); + task.Reject(env, CreateJsError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR))); + return; + } + + AAFwk::Want newWant; + PhotoEditorErrorCode errCode = context->SaveEditedContent(uri, newWant); + napi_value abilityResult = AppExecFwk::WrapAbilityResult(env, static_cast(errCode), newWant); + if (abilityResult == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Wrap abilityResult failed."); + task.Reject(env, CreateJsError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR))); + return; + } + + task.Resolve(env, abilityResult); + }; + + napi_value lastParam = (info.argc > INDEX_ONE) ? info.argv[INDEX_ONE] : nullptr; + napi_value result = nullptr; + NapiAsyncTask::ScheduleHighQos("JsPhotoEditorExtensionContext OnSaveEditedContentWithUri", env, + CreateAsyncTaskWithLastParam(env, lastParam, nullptr, std::move(complete), &result)); + return result; +} + +napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithImage(napi_env env, NapiCallbackInfo &info) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage is called: param size: %{public}d.", + static_cast(info.argc)); + + if (info.argc != ARGC_THREE) { + ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); + return CreateJsUndefined(env); + } + + auto image = Media::PixelMapNapi::GetPixelMap(env, info.argv[INDEX_ZERO]); + if (!image) { + TAG_LOGE(AAFwkTag::UI_EXT, "Get edited image fail."); + ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); + return CreateJsUndefined(env); + } + + Media::PackOption packOption; + if (!UnwrapPackOption(env, info.argv[INDEX_ONE], packOption)) { + return CreateJsUndefined(env); + } + + auto context = context_.lock(); + if (context == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Context is released."); + ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR), ERR_MSG_INTERNAL_ERROR); + return CreateJsUndefined(env); + } + + NapiAsyncTask::CompleteCallback complete = [weak = context_, image, packOption = std::move(packOption)]( + napi_env env, NapiAsyncTask &task, int32_t status) { + TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage begin."); + auto context = weak.lock(); + if (!context) { + TAG_LOGE(AAFwkTag::UI_EXT, "Context is released."); + task.Reject(env, CreateJsError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR))); + return; + } + + AAFwk::Want newWant; + PhotoEditorErrorCode errCode = context->SaveEditedContent(image, packOption, newWant); + napi_value abilityResult = AppExecFwk::WrapAbilityResult(env, static_cast(errCode), newWant); + if (abilityResult == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Wrap abilityResult failed."); + task.Reject(env, CreateJsError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR))); + return; + } + + task.Resolve(env, abilityResult); + }; + + napi_value lastParam = nullptr; + if (AppExecFwk::IsTypeForNapiValue(env, info.argv[INDEX_TWO], napi_function)) { + lastParam = info.argv[INDEX_TWO]; + } + napi_value result = nullptr; + NapiAsyncTask::ScheduleHighQos("JsPhotoEditorExtensionContext OnSaveEditedContentWithImage", env, + CreateAsyncTaskWithLastParam(env, lastParam, nullptr, std::move(complete), &result)); + return result; +} + +bool JsPhotoEditorExtensionContext::UnwrapPackOption(napi_env env, napi_value jsOption, Media::PackOption &packOption) +{ + if (!AppExecFwk::IsTypeForNapiValue(env, jsOption, napi_object)) { + TAG_LOGE(AAFwkTag::UI_EXT, "Packing option error, not object"); + ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); + return false; + } + + napi_value jsFormat = AppExecFwk::GetPropertyValueByPropertyName(env, jsOption, "format", napi_string); + std::string format = AppExecFwk::UnwrapStringFromJS(env, jsFormat, ""); + if (format == "") { + ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); + return false; + } + napi_value jsQuality = AppExecFwk::GetPropertyValueByPropertyName(env, jsOption, "quality", napi_number); + int quality = AppExecFwk::UnwrapInt32FromJS(env, jsQuality, 100); + TAG_LOGD(AAFwkTag::UI_EXT, "Unwrap pack option result, format=%{public}s, quality=%{public}d.", format.c_str(), + quality); + packOption.format = format; + packOption.quality = static_cast(quality); + return true; +} + +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp new file mode 100644 index 00000000000..e030f47e0bb --- /dev/null +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "js_photo_editor_extension_impl.h" +#include "hilog_tag_wrapper.h" +#include "napi/native_api.h" +#include "napi/native_node_api.h" +#include "js_photo_editor_extension_context.h" +#include "js_ui_extension_content_session.h" +#include "napi_common_want.h" + +namespace OHOS { +namespace AbilityRuntime { + +namespace { +constexpr size_t ARGC_ONE = 1; +constexpr size_t ARGC_THREE = 3; +} // namespace + +napi_value AttachUIExtensionContext(napi_env env, void *value, void *) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "AttachUIExtensionContext."); + if (value == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Invalid param value."); + return nullptr; + } + + auto ptr = reinterpret_cast *>(value)->lock(); + if (ptr == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Invalid context."); + return nullptr; + } + napi_value object = JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(env, ptr); + auto contextRef = + JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &object, ARGC_ONE); + if (contextRef == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to load module."); + return nullptr; + } + auto contextObj = contextRef->GetNapiValue(); + if (contextObj == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Load context error."); + return nullptr; + } + napi_coerce_to_native_binding_object(env, contextObj, DetachCallbackFunc, AttachUIExtensionContext, value, nullptr); + auto workContext = new (std::nothrow) std::weak_ptr(ptr); + napi_wrap( + env, contextObj, workContext, + [](napi_env, void *data, void *) { + TAG_LOGD(AAFwkTag::UI_EXT, "Finalizer for weak_ptr ui extension context is called."); + if (data == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr."); + return; + } + delete static_cast *>(data); + }, + nullptr, nullptr); + return contextObj; +} + +JsPhotoEditorExtensionImpl::JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime) : + JsUIExtensionBase(runtime) +{} + +void JsPhotoEditorExtensionImpl::BindContext() +{ + HandleScope handleScope(jsRuntime_); + if (jsObj_ == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "jsobj_ is nullptr."); + return; + } + + napi_env env = jsRuntime_.GetNapiEnv(); + napi_value obj = jsObj_->GetNapiValue(); + if (!CheckTypeForNapiValue(env, obj, napi_object)) { + TAG_LOGE(AAFwkTag::UI_EXT, "obj is not object."); + return; + } + + if (context_ == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Context is nullptr."); + return; + } + + TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsPhotoEditorExtensionContext."); + napi_value contextObj = JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(env, context_); + if (contextObj == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Create js ui extension context error."); + return; + } + + shellContextRef_ = + JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &contextObj, ARGC_ONE); + if (shellContextRef_ == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get loadSystemModuleByEngine."); + return; + } + contextObj = shellContextRef_->GetNapiValue(); + if (!CheckTypeForNapiValue(env, contextObj, napi_object)) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get context native object."); + return; + } + + auto workContext = new (std::nothrow) std::weak_ptr(context_); + napi_coerce_to_native_binding_object(env, contextObj, DetachCallbackFunc, AttachUIExtensionContext, workContext, + nullptr); + context_->Bind(jsRuntime_, shellContextRef_.get()); + napi_set_named_property(env, obj, "context", contextObj); + napi_wrap( + env, contextObj, workContext, + [](napi_env, void *data, void *) { + TAG_LOGD(AAFwkTag::UI_EXT, "Finalizer for weak_ptr ui extension context is called."); + if (data == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr."); + return; + } + delete static_cast *>(data); + }, + nullptr, nullptr); + TAG_LOGD(AAFwkTag::UI_EXT, "Bind context end."); +} + +void JsPhotoEditorExtensionImpl::OnForeground(const Want &want, sptr sessionInfo) +{ + JsUIExtensionBase::OnForeground(want, sessionInfo); + auto componentId = sessionInfo->uiExtensionComponentId; + if (uiExtensionComponentIdSet_.find(componentId) == uiExtensionComponentIdSet_.end()) { + OnStartContentEditing(want, sessionInfo); + uiExtensionComponentIdSet_.emplace(componentId); + } +} + +void JsPhotoEditorExtensionImpl::OnStartContentEditing(const AAFwk::Want &want, + const sptr &sessionInfo) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "JsPhotoEditorExtension want: (%{public}s), begin.", want.ToUri().c_str()); + + std::string imageUri = want.GetStringParam("ability.params.stream"); + if (imageUri.empty()) { + TAG_LOGE(AAFwkTag::UI_EXT, "OnStartContentEditing failed, imageUri is empty."); + return; + } + + TAG_LOGD(AAFwkTag::UI_EXT, "JsPhotoEditorExtension imageUri: (%{public}s), begin.", imageUri.c_str()); + if (context_ == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "PhotoEditorExtension context is nullptr."); + return; + } + context_->SetWant(std::make_shared(want)); + + HandleScope handleScope(jsRuntime_); + napi_env env = jsRuntime_.GetNapiEnv(); + if (env == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Env is nullptr."); + return; + } + napi_value jsWant = AppExecFwk::WrapWant(env, want); + if (jsWant == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get want."); + return; + } + napi_value jsImageUri; + napi_create_string_utf8(env, imageUri.c_str(), imageUri.size(), &jsImageUri); + napi_value argv[] = {jsImageUri, jsWant, contentSessions_[sessionInfo->uiExtensionComponentId]->GetNapiValue()}; + + CallObjectMethod("onStartContentEditing", argv, ARGC_THREE); +} + +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp new file mode 100644 index 00000000000..0e9689bc81c --- /dev/null +++ b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "photo_editor_extension.h" +#include "hilog_tag_wrapper.h" +#include "js_photo_editor_extension.h" +#include "runtime.h" +#include "photo_editor_extension_context.h" + +namespace OHOS { +namespace AbilityRuntime { +PhotoEditorExtension *PhotoEditorExtension::Create(const std::unique_ptr &runtime) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "called"); + if (!runtime) { + return new PhotoEditorExtension(); + } + switch (runtime->GetLanguage()) { + case Runtime::Language::JS: + return JsPhotoEditorExtension::Create(runtime); + default: + return new PhotoEditorExtension(); + } +} +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp new file mode 100644 index 00000000000..b8fd3b53739 --- /dev/null +++ b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "photo_editor_extension_context.h" +#include +#include "media_errors.h" +#include "hilog_tag_wrapper.h" +#include "file_uri.h" +#include "sandbox_helper.h" + +namespace OHOS { +namespace AbilityRuntime { + +const size_t PhotoEditorExtensionContext::CONTEXT_TYPE_ID(std::hash{}("PhotoEditorExtensionContext")); +constexpr const char *PANEL_TRANSFER_FILE_PATH = "transferFile"; +const uint64_t MAX_IMAGE_SIZE = 50 * 1024 * 1024; + +PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::string &uri, AAFwk::Want &newWant) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "Save content editing with uri begin, uri: %{public}s.", uri.c_str()); + + const std::string panelUri = want_->GetStringParam(PANEL_TRANSFER_FILE_PATH); + TAG_LOGD(AAFwkTag::UI_EXT, "PanelUri: %{public}s.", panelUri.c_str()); + + PhotoEditorErrorCode errCode = CopyImageToPanel(uri, panelUri); + if (errCode == PhotoEditorErrorCode::ERROR_OK) { + TAG_LOGD(AAFwkTag::UI_EXT, "Save content succeed."); + auto pos = uri.find_last_of("."); + newWant.SetUri(panelUri); + newWant.SetType("image/" + uri.substr(pos + 1)); + } + return errCode; +} + +PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::shared_ptr &image, + const Media::PackOption &packOption, + AAFwk::Want &newWant) +{ + const std::string panelUri = want_->GetStringParam(PANEL_TRANSFER_FILE_PATH); + TAG_LOGD(AAFwkTag::UI_EXT, "PanelUri: %{public}s.", panelUri.c_str()); + AppFileService::ModuleFileUri::FileUri fileUri(panelUri); + std::string panelPhysicalPath = fileUri.GetRealPath(); + std::ofstream panelFile; + panelFile.open(panelPhysicalPath, std::ios::binary); + if (!panelFile.is_open()) { + TAG_LOGE(AAFwkTag::UI_EXT, "Can not open panel file."); + panelFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR; + } + + Media::ImagePacker imagePacker; + uint32_t err = imagePacker.StartPacking(panelFile, packOption); + if (err != Media::SUCCESS) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to StartPacking %{public}d.", err); + panelFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_INTERNAL_ERROR; + } + + err = imagePacker.AddImage(*image); + if (err != Media::SUCCESS) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to AddImage %{public}d.", err); + panelFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR; + } + + int64_t packedSize = 0; + if (imagePacker.FinalizePacking(packedSize) != Media::SUCCESS) { + TAG_LOGE(AAFwkTag::UI_EXT, "FinalizePacking failed."); + panelFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR; + } + + if (packedSize > static_cast(MAX_IMAGE_SIZE)) { + TAG_LOGE(AAFwkTag::UI_EXT, "Image is too big, bigger than 50M."); + panelFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_IMAGE_TOO_BIG_ERROR; + } + + panelFile.close(); + newWant.SetUri(panelUri); + newWant.SetType(packOption.format); + TAG_LOGD(AAFwkTag::UI_EXT, "Save content succeed."); + return PhotoEditorErrorCode::ERROR_OK; +} + +void PhotoEditorExtensionContext::SetWant(const std::shared_ptr &want) +{ + want_ = want; + TAG_LOGD(AAFwkTag::UI_EXT, "Set want done."); +} + +PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::string &imageUri, + const std::string &panelUri) +{ + AppFileService::ModuleFileUri::FileUri fileUri(panelUri); + std::string panelPhysicalPath = fileUri.GetRealPath(); + + TAG_LOGD(AAFwkTag::UI_EXT, "ImageUri: %{public}s, panelPhysicalPath: %{public}s.", imageUri.c_str(), + panelPhysicalPath.c_str()); + + std::ifstream sourceFile; + sourceFile.open(imageUri, std::ios::binary); + if (!sourceFile.is_open()) { + TAG_LOGE(AAFwkTag::UI_EXT, "Can not open source file."); + sourceFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR; + } + + sourceFile.seekg(0, sourceFile.end); + std::streampos imageSize = sourceFile.tellg(); + if (static_cast(imageSize) > MAX_IMAGE_SIZE) { + TAG_LOGE(AAFwkTag::UI_EXT, "Image is too big, bigger than 50M."); + sourceFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_IMAGE_TOO_BIG_ERROR; + } + sourceFile.seekg(0, sourceFile.beg); + + std::ofstream panelFile; + panelFile.open(panelPhysicalPath, std::ios::binary); + if (!panelFile.is_open()) { + TAG_LOGE(AAFwkTag::UI_EXT, "Can not open panel file."); + sourceFile.close(); + return PhotoEditorErrorCode::ERROR_CODE_IMAGE_INPUT_ERROR; + } + + char buffer[4096]; + while (sourceFile.read(buffer, sizeof(buffer))) { + panelFile.write(buffer, sizeof(buffer)); + } + size_t remainingBytes = sourceFile.gcount(); + panelFile.write(buffer, remainingBytes); + sourceFile.close(); + panelFile.close(); + + TAG_LOGD(AAFwkTag::UI_EXT, "Copy succeed."); + return PhotoEditorErrorCode::ERROR_OK; +} + +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp new file mode 100644 index 00000000000..13e47af9d28 --- /dev/null +++ b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "photo_editor_extension_module_loader.h" +#include "hilog_tag_wrapper.h" +#include "photo_editor_extension.h" + +namespace OHOS { +namespace AbilityRuntime { +PhotoEditorExtensionModuleLoader::PhotoEditorExtensionModuleLoader() = default; +PhotoEditorExtensionModuleLoader::~PhotoEditorExtensionModuleLoader() = default; + +Extension *PhotoEditorExtensionModuleLoader::Create(const std::unique_ptr &runtime) const +{ + TAG_LOGD(AAFwkTag::UI_EXT, "Called."); + return PhotoEditorExtension::Create(runtime); +} + +std::map PhotoEditorExtensionModuleLoader::GetParams() +{ + TAG_LOGD(AAFwkTag::UI_EXT, "called"); + std::map params; + // type means extension type in ExtensionAbilityType of + // extension_ability_info.h, 266 means photoEditorExtension. + params.insert(std::pair("type", "266")); + params.insert(std::pair("name", "PhotoEditorExtensionAbility")); + return params; +} + +extern "C" __attribute__((visibility("default"))) void *OHOS_EXTENSION_GetExtensionModule() +{ + return &PhotoEditorExtensionModuleLoader::GetInstance(); +} +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.h new file mode 100644 index 00000000000..f95455a7181 --- /dev/null +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_H +#define OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_H + +#include "photo_editor_extension.h" +#include "configuration.h" +#include "js_ui_extension_base.h" +#include + +namespace OHOS { +namespace AbilityRuntime { +class Runtime; +class JsPhotoEditorExtensionImpl; + +/** + * @brief Basic photo editor extension components. + */ +class JsPhotoEditorExtension : public PhotoEditorExtension, + public std::enable_shared_from_this { +public: + explicit JsPhotoEditorExtension(const std::unique_ptr &runtime); + + virtual ~JsPhotoEditorExtension() override = default; + + /** + * @brief Init the photo editor extension. + * + * @param record the photo editor extension record. + * @param application the application info. + * @param handler the photo editor extension handler. + * @param token the remote token. + */ + virtual void Init(const std::shared_ptr &record, + const std::shared_ptr &application, + std::shared_ptr &handler, const sptr &token) override; + + /** + * @brief Create JsPhotoEditorExtension. + * + * @param runtime The runtime. + * @return The JsPhotoEditorExtension instance. + */ + static JsPhotoEditorExtension *Create(const std::unique_ptr &runtime); + +private: + std::shared_ptr impl_ = nullptr; +}; +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_H \ No newline at end of file diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h new file mode 100644 index 00000000000..26c15592bec --- /dev/null +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_CONTEXT_H +#define OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_CONTEXT_H + +#include "photo_editor_extension_context.h" +#include "native_engine/native_engine.h" +#include "image_packer.h" + +namespace OHOS { +namespace AbilityRuntime { +struct NapiCallbackInfo; + +class JsPhotoEditorExtensionContext { +public: + explicit JsPhotoEditorExtensionContext(const std::shared_ptr &context) : + context_(context) + {} + + virtual ~JsPhotoEditorExtensionContext() = default; + + static void Finalizer(napi_env env, void *data, void *hint); + + static napi_value CreateJsPhotoEditorExtensionContext(napi_env env, + std::shared_ptr context); + + static napi_value SaveEditedContentWithUri(napi_env env, napi_callback_info info); + + static napi_value SaveEditedContentWithImage(napi_env env, napi_callback_info info); + +private: + napi_value OnSaveEditedContentWithUri(napi_env env, NapiCallbackInfo &info); + + napi_value OnSaveEditedContentWithImage(napi_env env, NapiCallbackInfo &info); + + bool UnwrapPackOption(napi_env env, napi_value jsOption, Media::PackOption &packOption); + +private: + std::weak_ptr context_; +}; +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_CONTEXT_H \ No newline at end of file diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.h new file mode 100644 index 00000000000..d69d61b8eaa --- /dev/null +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_IMPL_H +#define OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_IMPL_H + +#include "js_ui_extension_base.h" +#include "photo_editor_extension_context.h" +#include + +namespace OHOS { +namespace AbilityRuntime { + +class PhotoEditorExtensionContext; + +class JsPhotoEditorExtensionImpl : public JsUIExtensionBase { +public: + explicit JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime); + virtual ~JsPhotoEditorExtensionImpl() override = default; + + void SetContext(const std::shared_ptr &context) + { + context_ = context; + JsUIExtensionBase::SetContext(context); + } + +protected: + void BindContext() override; + void OnForeground(const Want &want, sptr sessionInfo) override; + +private: + void OnStartContentEditing(const AAFwk::Want &want, const sptr &sessionInfo); + +protected: + std::shared_ptr context_ = nullptr; + std::set uiExtensionComponentIdSet_; + +private: + using JsUIExtensionBase::SetContext; +}; +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_IMPL_H \ No newline at end of file diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension.h new file mode 100644 index 00000000000..35c0a9c61db --- /dev/null +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_H +#define OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_H + +#include "ui_extension_base.h" + +namespace OHOS { +namespace AbilityRuntime { +class PhotoEditorExtensionContext; +class Runtime; + +class PhotoEditorExtension : public UIExtensionBase { +public: + PhotoEditorExtension() = default; + + virtual ~PhotoEditorExtension() = default; + + /** + * @brief Create photo editor extension + * + * @param runtime The runtime + * @return The photo editor extension instance + */ + static PhotoEditorExtension *Create(const std::unique_ptr &runtime); +}; + +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_H \ No newline at end of file diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h new file mode 100644 index 00000000000..d8e5f616bc7 --- /dev/null +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_CONTEXT_H +#define OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_CONTEXT_H + +#include "ui_extension_context.h" +#include "pixel_map_napi.h" +#include "image_packer.h" + +namespace OHOS { +namespace AbilityRuntime { + +enum class PhotoEditorErrorCode { + // success + ERROR_OK = 0, + + // param error + ERROR_CODE_PARAM_ERROR = 1500000001, + + // internal error + ERROR_CODE_INTERNAL_ERROR = 1500000002, + + // image input error + ERROR_CODE_IMAGE_INPUT_ERROR = 1500000003, + + // image too big + ERROR_CODE_IMAGE_TOO_BIG_ERROR = 1500000004 +}; + +class PhotoEditorExtensionContext : public UIExtensionContext { +public: + PhotoEditorExtensionContext() = default; + + virtual ~PhotoEditorExtensionContext() = default; + + /** + * @brief Create Extension + + * @param newWant newWant + * @return errCode + */ + PhotoEditorErrorCode SaveEditedContent(const std::string &uri, AAFwk::Want &newWant); + + /** + * @brief Save content editing + + * @param image image + * @param option option + * @param newWant newWant + * @return errCode + */ + PhotoEditorErrorCode SaveEditedContent(const std::shared_ptr &image, + const Media::PackOption &packOption, AAFwk::Want &newWant); + + void SetWant(const std::shared_ptr &want); + + static const size_t CONTEXT_TYPE_ID; + +private: + PhotoEditorErrorCode CopyImageToPanel(const std::string &imageUri, const std::string &panelUri); + +private: + std::shared_ptr want_; +}; +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_CONTEXT_H \ No newline at end of file diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.h new file mode 100644 index 00000000000..a9f37d02303 --- /dev/null +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_MODULE_LOADER_H +#define OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_MODULE_LOADER_H + +#include "extension_module_loader.h" + +namespace OHOS { +namespace AbilityRuntime { +class PhotoEditorExtensionModuleLoader : public ExtensionModuleLoader, + public Singleton { + DECLARE_SINGLETON(PhotoEditorExtensionModuleLoader); + +public: + /** + * @brief Create extension + * + * @param runtime runtime + * @return the extension instance + */ + Extension *Create(const std::unique_ptr &runtime) const override; + + /** + * @brief Get the params object + * + * @param runtime runtime + * @return td::map The map of extension type and extension name. + */ + std::map GetParams() override; +}; + +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_PHOTO_EDITOR_EXTENSION_MODULE_LOADER_H diff --git a/services/common/include/ui_extension_utils.h b/services/common/include/ui_extension_utils.h index 12e2e80b8bf..628d5baedd9 100755 --- a/services/common/include/ui_extension_utils.h +++ b/services/common/include/ui_extension_utils.h @@ -60,7 +60,9 @@ inline std::unordered_set GetUiExtensionSet() AppExecFwk::ExtensionAbilityType::SYSPICKER_CAMERA, AppExecFwk::ExtensionAbilityType::SYSPICKER_FILEPICKER, AppExecFwk::ExtensionAbilityType::AUTO_FILL_SMART, - AppExecFwk::ExtensionAbilityType::LIVEVIEW_LOCKSCREEN + AppExecFwk::ExtensionAbilityType::LIVEVIEW_LOCKSCREEN, + AppExecFwk::ExtensionAbilityType::SYSPICKER_PHOTOEDITOR, + AppExecFwk::ExtensionAbilityType::PHOTO_EDITOR }; } @@ -88,6 +90,7 @@ inline bool IsSystemUIExtension(const AppExecFwk::ExtensionAbilityType type) AppExecFwk::ExtensionAbilityType::SYSPICKER_APPSELECTOR, AppExecFwk::ExtensionAbilityType::UI, AppExecFwk::ExtensionAbilityType::SYS_COMMON_UI, + AppExecFwk::ExtensionAbilityType::SYSPICKER_PHOTOEDITOR }; return systemUiExtensionSet.find(type) != systemUiExtensionSet.end(); } diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index f60d60d8efa..52ff3413b92 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -523,6 +523,7 @@ group("unittest") { "want_sender_proxy_test:unittest", "want_sender_stub_test:unittest", "wants_info_test:unittest", + "photo_editor_extension_test:unittest" ] if (ability_runtime_graphics) { diff --git a/test/unittest/photo_editor_extension_test/BUILD.gn b/test/unittest/photo_editor_extension_test/BUILD.gn new file mode 100644 index 00000000000..5f65db40725 --- /dev/null +++ b/test/unittest/photo_editor_extension_test/BUILD.gn @@ -0,0 +1,151 @@ +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//build/test.gni") +import("//foundation/ability/ability_runtime/ability_runtime.gni") + +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "${ability_runtime_innerkits_path}/ability_manager/include", + "${ability_runtime_innerkits_path}/app_manager/include/appmgr", + "${ability_runtime_path}/interfaces/kits/native/ability/native", + "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", + "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include", + "${ability_runtime_path}/interfaces/kits/native/appkit/app", + "${ability_runtime_path}/interfaces/kits/native/appkit/app/task", + "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit/include", + "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include", + "${ability_runtime_services_path}/abilitymgr/include", + "${ability_runtime_services_path}/common/include", + "${distributeddatamgr_path}/distributeddatamgr/interfaces/innerkits/app_distributeddata/include", + "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include", + "${ability_base_kits_path}/extractortool/include", + "${ability_runtime_test_path}/mock/services_appmgr_test/include", + "${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime", + ] + cflags = [] + if (target_cpu == "arm") { + cflags += [ "-DBINDER_IPC_32BIT" ] + } + defines = [ "AMS_LOG_TAG = \"AbilityUnitTest\"" ] + + if (ability_runtime_graphics) { + include_dirs += [ + "${global_path}/i18n/frameworks/intl/include", + "${form_fwk_path}/interfaces/kits/native/include", + ] + } +} + +config("module_ability_context_config") { + visibility = [ ":*" ] + include_dirs = [ + "${ability_runtime_innerkits_path}/app_manager/include/appmgr", + "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include", + "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include", + "${ability_runtime_innerkits_path}/ability_manager/include", + "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include", + "//third_party/googletest/googlemock/include", + "${ability_runtime_path}/interfaces/kits/native/ability/native", + "${ability_runtime_path}/interfaces/kits/native/appkit/app", + "${multimodalinput_path}/interfaces/native/innerkits/event/include", + "//third_party/libuv/include", + "${global_path}/resource_management/interfaces/inner_api/include", + ] + cflags = [] + if (target_cpu == "arm") { + cflags += [ "-DBINDER_IPC_32BIT" ] + } + defines = [ "AMS_LOG_TAG = \"AbilityUnitTest\"" ] +} + +ohos_unittest("photo_editor_extension_module_loader_test") { + module_out_path = "ability_runtime/photo_editor_extension" + + sources = [ + "photo_editor_extension_module_loader_test.cpp", + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp", + ] + + cflags = [] + + include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/ability/native/photo_editor_extension_ability" ] + + if (target_cpu == "arm") { + cflags += [ "-DBINDER_IPC_32BIT" ] + } + + deps = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_native_path}/ability/native:abilitykit_native", + "${ability_runtime_native_path}/ability/native:ui_extension", + "${ability_runtime_native_path}/ability/native:photo_editor_extension", + "${ability_runtime_native_path}/appkit:app_context", + "${ability_runtime_native_path}/appkit:appkit_native", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "napi:ace_napi", + ] +} + +ohos_unittest("photo_editor_extension_test") { + module_out_path = "ability_runtime/photo_editor_extension" + + include_dirs = [ + "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include", + "${ability_runtime_path}/interfaces/kits/native/ability/native/photo_editor_extension_ability", + ] + + sources = [ "photo_editor_extension_test.cpp" ] + + configs = [ ":module_private_config" ] + + deps = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/runtime:runtime", + "${ability_runtime_native_path}/ability/native:abilitykit_native", + "${ability_runtime_native_path}/ability/native:photo_editor_extension", + "${ability_runtime_native_path}/ability/native:ui_extension", + "${ability_runtime_native_path}/appkit:app_context", + "${ability_runtime_native_path}/appkit:appkit_native", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + + external_deps = [ + "ability_base:base", + "ability_base:want", + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "eventhandler:libeventhandler", + "hilog:libhilog", + "init:libbegetutil", + "ipc:ipc_core", + "napi:ace_napi", + ] +} + +group("unittest") { + testonly = true + deps = [ + ":photo_editor_extension_module_loader_test", + ":photo_editor_extension_test" + ] +} \ No newline at end of file diff --git a/test/unittest/photo_editor_extension_test/photo_editor_extension_module_loader_test.cpp b/test/unittest/photo_editor_extension_test/photo_editor_extension_module_loader_test.cpp new file mode 100644 index 00000000000..80481536a08 --- /dev/null +++ b/test/unittest/photo_editor_extension_test/photo_editor_extension_module_loader_test.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "photo_editor_extension_module_loader.h" + +namespace OHOS { +namespace AbilityRuntime { +using namespace testing::ext; + +class PhotoEditorExtensionModuleLoaderTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; + +void PhotoEditorExtensionModuleLoaderTest::SetUpTestCase(void) +{} + +void PhotoEditorExtensionModuleLoaderTest::TearDownTestCase(void) +{} + +void PhotoEditorExtensionModuleLoaderTest::SetUp(void) +{} + +void PhotoEditorExtensionModuleLoaderTest::TearDown(void) +{} + +/** + * @tc.number: PhotoEditorExtensionModuleLoader_0100 + * @tc.name: OHOS_EXTENSION_GetExtensionModule + * @tc.desc: Verify OHOS_EXTENSION_GetExtensionModule succeeded. + */ +HWTEST_F(PhotoEditorExtensionModuleLoaderTest, PhotoEditorExtensionModuleLoader_0100, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) << "PhotoEditorExtensionModuleLoader_0100 start"; + void *handle = dlopen("/system/lib/extensionability/libphoto_editor_extension_module.z.so", RTLD_LAZY); + if (handle != nullptr) { + auto obj = + reinterpret_cast(dlsym(handle, "OHOS_EXTENSION_GetExtensionModule")); + EXPECT_TRUE(obj != nullptr); + } + dlclose(handle); + GTEST_LOG_(INFO) << "PhotoEditorExtensionModuleLoader_0100 end"; +} + +/** + * @tc.number: PhotoEditorExtensionModuleLoader_0200 + * @tc.name: Create + * @tc.desc: Verify Create succeeded. + */ +HWTEST_F(PhotoEditorExtensionModuleLoaderTest, PhotoEditorExtensionModuleLoader_0200, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) << "PhotoEditorExtensionModuleLoader_0200 start"; + std::unique_ptr runtime; + auto extension = PhotoEditorExtensionModuleLoader::GetInstance().Create(runtime); + EXPECT_TRUE(extension != nullptr); + GTEST_LOG_(INFO) << "PhotoEditorExtensionModuleLoader_0200 end"; +} + +/** + * @tc.number: PhotoEditorExtensionModuleLoader_0300 + * @tc.name: GetParams + * @tc.desc: Verify GetParams succeeded. + */ +HWTEST_F(PhotoEditorExtensionModuleLoaderTest, PhotoEditorExtensionModuleLoader_0300, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) << "PhotoEditorExtensionModuleLoader_0300 start"; + auto params = PhotoEditorExtensionModuleLoader::GetInstance().GetParams(); + + std::string key = "type"; + auto finder = params.find(key); + if (finder != params.end()) { + EXPECT_STREQ(finder->second.c_str(), "266"); + } + + key = "name"; + auto iter = params.find(key); + if (iter != params.end()) { + EXPECT_STREQ(iter->second.c_str(), "PhotoEditorExtensionAbility"); + } + GTEST_LOG_(INFO) << "PhotoEditorExtensionModuleLoader_0300 end"; +} +} // namespace AbilityRuntime +} // namespace OHOS diff --git a/test/unittest/photo_editor_extension_test/photo_editor_extension_test.cpp b/test/unittest/photo_editor_extension_test/photo_editor_extension_test.cpp new file mode 100644 index 00000000000..d4cb80b4674 --- /dev/null +++ b/test/unittest/photo_editor_extension_test/photo_editor_extension_test.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "ability_handler.h" +#include "js_photo_editor_extension.h" +#include "mock_ability_token.h" +#include "ohos_application.h" +#include "runtime.h" + +namespace OHOS { +namespace AbilityRuntime { +using namespace testing::ext; + +class PhotoEditorExtensionTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; + +void PhotoEditorExtensionTest::SetUpTestCase(void) +{} + +void PhotoEditorExtensionTest::TearDownTestCase(void) +{} + +void PhotoEditorExtensionTest::SetUp(void) +{} + +void PhotoEditorExtensionTest::TearDown(void) +{} + +/** + * @tc.number: PhotoEditor_Extension_0100 + * @tc.name: Create + * @tc.desc: The runtime is nullptr, and the verification of create succeeds. + */ +HWTEST_F(PhotoEditorExtensionTest, PhotoEditor_Extension_0100, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) << "PhotoEditor_Extension_0100 start"; + std::unique_ptr runtime; + auto photoEditorExtension = PhotoEditorExtension::Create(runtime); + EXPECT_TRUE(photoEditorExtension != nullptr); + GTEST_LOG_(INFO) << "PhotoEditor_Extension_0100 end"; +} + +/** + * @tc.number: PhotoEditor_Extension_0200 + * @tc.name: Create + * @tc.desc: The language is js, and the verification of create is successful. + */ +HWTEST_F(PhotoEditorExtensionTest, PhotoEditor_Extension_0200, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) << "PhotoEditor_Extension_0200 start"; + Runtime::Options options; + auto runtime = Runtime::Create(options); + auto photoEditorExtension = PhotoEditorExtension::Create(runtime); + EXPECT_TRUE(photoEditorExtension != nullptr); + GTEST_LOG_(INFO) << "PhotoEditor_Extension_0200 end"; +} + +/** + * @tc.number: PhotoEditor_Extension_0300 + * @tc.name: Init + * @tc.desc: Validation initialization succeeded. + */ +HWTEST_F(PhotoEditorExtensionTest, PhotoEditor_Extension_0300, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) << "PhotoEditor_Extension_0300 start"; + auto abilityInfo = std::make_shared(); + sptr token = new AppExecFwk::MockAbilityToken(); + auto record = std::make_shared(abilityInfo, token); + auto application = std::make_shared(); + auto contextImpl = std::make_shared(); + auto applicationContext = ApplicationContext::GetInstance(); + applicationContext->AttachContextImpl(contextImpl); + application->SetApplicationContext(applicationContext); + auto handler = std::make_shared(nullptr); + Runtime::Options options; + std::unique_ptr runtime = Runtime::Create(options); + Extension *photoEditorExtension = PhotoEditorExtension::Create(runtime); + photoEditorExtension->Init(record, application, handler, token); + EXPECT_TRUE(photoEditorExtension != nullptr); + GTEST_LOG_(INFO) << "PhotoEditor_Extension_0300 end"; +} +} // namespace AbilityRuntime +} // namespace OHOS -- Gitee From 45613a7cf077edc1f19bc0678feb7e3d4a6016bc Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 03:05:28 +0000 Subject: [PATCH 02/54] update frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp. Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_context_module.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp index 17f60e93525..82b61bf1d32 100755 --- a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp @@ -15,10 +15,10 @@ #include "native_engine/native_engine.h" -extern const char _binary_photo_editor_extension_context_js_start[]; -extern const char _binary_photo_editor_extension_context_js_end[]; -extern const char _binary_photo_editor_extension_context_abc_start[]; -extern const char _binary_photo_editor_extension_context_abc_end[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_START[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_END[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_START[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_END[]; static napi_module _module = { .nm_version = 0, @@ -34,11 +34,11 @@ extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetJSCode(const char **buf, int *bufLen) { if (buf != nullptr) { - *buf = _binary_photo_editor_extension_context_js_start; + *buf = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_START; } if (bufLen != nullptr) { - *bufLen = _binary_photo_editor_extension_context_js_end - _binary_photo_editor_extension_context_js_start; + *bufLen = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_END - _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_START; } } @@ -47,9 +47,9 @@ extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetABCCode(const char **buf, int *buflen) { if (buf != nullptr) { - *buf = _binary_photo_editor_extension_context_abc_start; + *buf = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_START; } if (buflen != nullptr) { - *buflen = _binary_photo_editor_extension_context_abc_end - _binary_photo_editor_extension_context_abc_start; + *buflen = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_END - _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_START; } } -- Gitee From 40ac9ab68a40e125a4736cff83f01da58ce81928 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 03:08:49 +0000 Subject: [PATCH 03/54] update frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp. Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_ability_module.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp index 6202e03e832..fc8963ba7bf 100644 --- a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp @@ -15,10 +15,10 @@ #include "native_engine/native_engine.h" -extern const char _binary_photo_editor_extension_ability_js_start[]; -extern const char _binary_photo_editor_extension_ability_js_end[]; -extern const char _binary_photo_editor_extension_ability_abc_start[]; -extern const char _binary_photo_editor_extension_ability_abc_end[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_START[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_END[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_START[]; +extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_END[]; static napi_module _module = { .nm_version = 0, @@ -34,11 +34,11 @@ extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode(const char **buf, int *bufLen) { if (buf != nullptr) { - *buf = _binary_photo_editor_extension_ability_js_start; + *buf = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_START; } if (bufLen != nullptr) { - *bufLen = _binary_photo_editor_extension_ability_js_end - _binary_photo_editor_extension_ability_js_start; + *bufLen = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_END - _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_START; } } @@ -46,9 +46,9 @@ extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetABCCode(const char **buf, int *buflen) { if (buf != nullptr) { - *buf = _binary_photo_editor_extension_ability_abc_start; + *buf = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_START; } if (buflen != nullptr) { - *buflen = _binary_photo_editor_extension_ability_abc_end - _binary_photo_editor_extension_ability_abc_start; + *buflen = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_END - _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_START; } } \ No newline at end of file -- Gitee From 038ffa964bfd631073e0f5cb2816f7cc90225cce Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 03:12:36 +0000 Subject: [PATCH 04/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_impl.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp index e030f47e0bb..e36c1d69e4e 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp @@ -88,12 +88,10 @@ void JsPhotoEditorExtensionImpl::BindContext() TAG_LOGE(AAFwkTag::UI_EXT, "obj is not object."); return; } - if (context_ == nullptr) { TAG_LOGE(AAFwkTag::UI_EXT, "Context is nullptr."); return; } - TAG_LOGD(AAFwkTag::UI_EXT, "BindContext CreateJsPhotoEditorExtensionContext."); napi_value contextObj = JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(env, context_); if (contextObj == nullptr) { -- Gitee From 251e0288e73dfb069ecd023b5b37f11b7005f11f Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 03:19:15 +0000 Subject: [PATCH 05/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp index e36c1d69e4e..e05e6115653 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp @@ -70,8 +70,8 @@ napi_value AttachUIExtensionContext(napi_env env, void *value, void *) return contextObj; } -JsPhotoEditorExtensionImpl::JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime) : - JsUIExtensionBase(runtime) +JsPhotoEditorExtensionImpl::JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime) + : JsUIExtensionBase(runtime) {} void JsPhotoEditorExtensionImpl::BindContext() -- Gitee From 4fac2a8f0f0ad3155253702fa55edf334ce57295 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 03:23:07 +0000 Subject: [PATCH 06/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp index ebdb759dbd8..321b699c192 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp @@ -42,8 +42,7 @@ void JsPhotoEditorExtensionContext::Finalizer(napi_env env, void *data, void *hi std::unique_ptr(static_cast(data)); } -napi_value -JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(napi_env env, +napi_value JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(napi_env env, std::shared_ptr context) { TAG_LOGD(AAFwkTag::UI_EXT, "CreateJsPhotoEditorExtensionContext begin."); -- Gitee From 7854f2c1b74b1df72ab2cbc8dae3da9d8735a1cc Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 03:38:18 +0000 Subject: [PATCH 07/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_ability_module.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp index fc8963ba7bf..6202e03e832 100644 --- a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp @@ -15,10 +15,10 @@ #include "native_engine/native_engine.h" -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_START[]; -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_END[]; -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_START[]; -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_END[]; +extern const char _binary_photo_editor_extension_ability_js_start[]; +extern const char _binary_photo_editor_extension_ability_js_end[]; +extern const char _binary_photo_editor_extension_ability_abc_start[]; +extern const char _binary_photo_editor_extension_ability_abc_end[]; static napi_module _module = { .nm_version = 0, @@ -34,11 +34,11 @@ extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode(const char **buf, int *bufLen) { if (buf != nullptr) { - *buf = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_START; + *buf = _binary_photo_editor_extension_ability_js_start; } if (bufLen != nullptr) { - *bufLen = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_END - _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_JS_START; + *bufLen = _binary_photo_editor_extension_ability_js_end - _binary_photo_editor_extension_ability_js_start; } } @@ -46,9 +46,9 @@ extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetABCCode(const char **buf, int *buflen) { if (buf != nullptr) { - *buf = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_START; + *buf = _binary_photo_editor_extension_ability_abc_start; } if (buflen != nullptr) { - *buflen = _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_END - _BINARY_PHOTO_EDITOR_EXTENSION_ABILITY_ABC_START; + *buflen = _binary_photo_editor_extension_ability_abc_end - _binary_photo_editor_extension_ability_abc_start; } } \ No newline at end of file -- Gitee From f36f02834e3e9f8c7d850c71e850234e08989b78 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 03:40:01 +0000 Subject: [PATCH 08/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_context_module.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp index 82b61bf1d32..17f60e93525 100755 --- a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp @@ -15,10 +15,10 @@ #include "native_engine/native_engine.h" -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_START[]; -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_END[]; -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_START[]; -extern const char _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_END[]; +extern const char _binary_photo_editor_extension_context_js_start[]; +extern const char _binary_photo_editor_extension_context_js_end[]; +extern const char _binary_photo_editor_extension_context_abc_start[]; +extern const char _binary_photo_editor_extension_context_abc_end[]; static napi_module _module = { .nm_version = 0, @@ -34,11 +34,11 @@ extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetJSCode(const char **buf, int *bufLen) { if (buf != nullptr) { - *buf = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_START; + *buf = _binary_photo_editor_extension_context_js_start; } if (bufLen != nullptr) { - *bufLen = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_END - _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_JS_START; + *bufLen = _binary_photo_editor_extension_context_js_end - _binary_photo_editor_extension_context_js_start; } } @@ -47,9 +47,9 @@ extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetABCCode(const char **buf, int *buflen) { if (buf != nullptr) { - *buf = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_START; + *buf = _binary_photo_editor_extension_context_abc_start; } if (buflen != nullptr) { - *buflen = _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_END - _BINARY_PHOTO_EDITOR_EXTENSION_CONTEXT_ABC_START; + *buflen = _binary_photo_editor_extension_context_abc_end - _binary_photo_editor_extension_context_abc_start; } } -- Gitee From 0375ae29c6288b91050f7101982f92f718d4663c Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 05:55:49 +0000 Subject: [PATCH 09/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_ability/photo_editor_extension.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp index 0e9689bc81c..f7ec4413a12 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp @@ -28,9 +28,9 @@ PhotoEditorExtension *PhotoEditorExtension::Create(const std::unique_ptrGetLanguage()) { - case Runtime::Language::JS: + case Runtime::Language::JS: return JsPhotoEditorExtension::Create(runtime); - default: + default: return new PhotoEditorExtension(); } } -- Gitee From e8005477d121c7cba5979e0d5a783b9a1f413f21 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 05:57:26 +0000 Subject: [PATCH 10/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp index 321b699c192..b1f70aa321d 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp @@ -42,8 +42,7 @@ void JsPhotoEditorExtensionContext::Finalizer(napi_env env, void *data, void *hi std::unique_ptr(static_cast(data)); } -napi_value JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(napi_env env, - std::shared_ptr context) +napi_value JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(napi_env env, std::shared_ptr context) { TAG_LOGD(AAFwkTag::UI_EXT, "CreateJsPhotoEditorExtensionContext begin."); std::shared_ptr abilityInfo = nullptr; -- Gitee From f0df79de43d720be4f80b73d8b17232538e47137 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 05:59:06 +0000 Subject: [PATCH 11/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_ability_module.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp index 6202e03e832..ba74abb04a4 100644 --- a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp @@ -30,8 +30,7 @@ extern "C" __attribute__((constructor)) void NAPI_app_ability_PhotoEditorExtensi napi_module_register(&_module); } -extern "C" __attribute__((visibility("default"))) void -NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode(const char **buf, int *bufLen) +extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode(const char **buf, int *bufLen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_ability_js_start; @@ -42,8 +41,7 @@ NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode(const char **buf, int *bu } } -extern "C" __attribute__((visibility("default"))) void -NAPI_app_ability_PhotoEditorExtensionAbility_GetABCCode(const char **buf, int *buflen) +extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetABCCode(const char **buf, int *buflen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_ability_abc_start; -- Gitee From 547720960ab138445070d4cbaabd262789bdc1bc Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 05:59:45 +0000 Subject: [PATCH 12/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_context_module.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp index 17f60e93525..d740bc1b2e3 100755 --- a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp @@ -30,8 +30,7 @@ extern "C" __attribute__((constructor)) void NAPI_application_PhotoEditorExtensi napi_module_register(&_module); } -extern "C" __attribute__((visibility("default"))) void -NAPI_application_PhotoEditorExtensionContext_GetJSCode(const char **buf, int *bufLen) +extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetJSCode(const char **buf, int *bufLen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_context_js_start; @@ -43,8 +42,7 @@ NAPI_application_PhotoEditorExtensionContext_GetJSCode(const char **buf, int *bu } // ability_context JS register -extern "C" __attribute__((visibility("default"))) void -NAPI_application_PhotoEditorExtensionContext_GetABCCode(const char **buf, int *buflen) +extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetABCCode(const char **buf, int *buflen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_context_abc_start; -- Gitee From dce28a919736410a6b1b74be293d08d7c0d96cde Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:01:51 +0000 Subject: [PATCH 13/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h index 26c15592bec..45484d1f7f0 100644 --- a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h @@ -26,8 +26,7 @@ struct NapiCallbackInfo; class JsPhotoEditorExtensionContext { public: - explicit JsPhotoEditorExtensionContext(const std::shared_ptr &context) : - context_(context) + explicit JsPhotoEditorExtensionContext(const std::shared_ptr &context) : context_(context) {} virtual ~JsPhotoEditorExtensionContext() = default; -- Gitee From c47db010cb35237035b593cabc7c4764db450cb1 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:03:20 +0000 Subject: [PATCH 14/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_impl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp index e05e6115653..f1a68adf3a2 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp @@ -70,8 +70,7 @@ napi_value AttachUIExtensionContext(napi_env env, void *value, void *) return contextObj; } -JsPhotoEditorExtensionImpl::JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime) - : JsUIExtensionBase(runtime) +JsPhotoEditorExtensionImpl::JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime) : JsUIExtensionBase(runtime) {} void JsPhotoEditorExtensionImpl::BindContext() -- Gitee From 90fa6f6584965b30e022ee73d22527d87d620b88 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:05:32 +0000 Subject: [PATCH 15/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_impl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp index f1a68adf3a2..da273452adc 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp @@ -98,8 +98,7 @@ void JsPhotoEditorExtensionImpl::BindContext() return; } - shellContextRef_ = - JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &contextObj, ARGC_ONE); + shellContextRef_ = JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &contextObj, ARGC_ONE); if (shellContextRef_ == nullptr) { TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get loadSystemModuleByEngine."); return; -- Gitee From 5fb37b47a77348121bdb1dab9362b60c0585ff44 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:07:00 +0000 Subject: [PATCH 16/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp index b1f70aa321d..55a9b909a75 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp @@ -127,8 +127,7 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env en napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithImage(napi_env env, NapiCallbackInfo &info) { - TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage is called: param size: %{public}d.", - static_cast(info.argc)); + TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage is called: param size: %{public}d.", static_cast(info.argc)); if (info.argc != ARGC_THREE) { ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); -- Gitee From b5eb5f4cb415f2ce2051e23dc821e35b3a9318ec Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:39:56 +0000 Subject: [PATCH 17/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_impl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp index da273452adc..e8ed07ff860 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp @@ -70,7 +70,8 @@ napi_value AttachUIExtensionContext(napi_env env, void *value, void *) return contextObj; } -JsPhotoEditorExtensionImpl::JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime) : JsUIExtensionBase(runtime) +JsPhotoEditorExtensionImpl::JsPhotoEditorExtensionImpl(const std::unique_ptr &runtime) + : JsUIExtensionBase(runtime) {} void JsPhotoEditorExtensionImpl::BindContext() -- Gitee From 971585fe3d18249bedf96ecb0235682f70fc5af9 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:41:22 +0000 Subject: [PATCH 18/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h index 45484d1f7f0..8278e4bec84 100644 --- a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h @@ -26,7 +26,8 @@ struct NapiCallbackInfo; class JsPhotoEditorExtensionContext { public: - explicit JsPhotoEditorExtensionContext(const std::shared_ptr &context) : context_(context) + explicit JsPhotoEditorExtensionContext(const std::shared_ptr &context) + : context_(context) {} virtual ~JsPhotoEditorExtensionContext() = default; -- Gitee From 274ee5dce0fc038521096535da0fd1fd9f0074d6 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:43:52 +0000 Subject: [PATCH 19/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_ability_module.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp index ba74abb04a4..b0f21824bb3 100644 --- a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability_module.cpp @@ -30,7 +30,8 @@ extern "C" __attribute__((constructor)) void NAPI_app_ability_PhotoEditorExtensi napi_module_register(&_module); } -extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode(const char **buf, int *bufLen) +extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetJSCode( + const char **buf, int *bufLen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_ability_js_start; @@ -41,7 +42,8 @@ extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEdi } } -extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetABCCode(const char **buf, int *buflen) +extern "C" __attribute__((visibility("default"))) void NAPI_app_ability_PhotoEditorExtensionAbility_GetABCCode( + const char **buf, int *buflen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_ability_abc_start; -- Gitee From 22e46a368a23c4b803930e33e0be981ac8fb1b41 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:45:09 +0000 Subject: [PATCH 20/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_context_module.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp index d740bc1b2e3..ea41f3bb137 100755 --- a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp @@ -30,7 +30,8 @@ extern "C" __attribute__((constructor)) void NAPI_application_PhotoEditorExtensi napi_module_register(&_module); } -extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetJSCode(const char **buf, int *bufLen) +extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetJSCode( + const char **buf, int *bufLen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_context_js_start; @@ -42,7 +43,8 @@ extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEdi } // ability_context JS register -extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetABCCode(const char **buf, int *buflen) +extern "C" __attribute__((visibility("default"))) void NAPI_application_PhotoEditorExtensionContext_GetABCCode( + const char **buf, int *buflen) { if (buf != nullptr) { *buf = _binary_photo_editor_extension_context_abc_start; -- Gitee From eebb46f308971e80471cac1c2af745d66bfd27d1 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 06:47:33 +0000 Subject: [PATCH 21/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp index e8ed07ff860..987810c0097 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp @@ -99,7 +99,8 @@ void JsPhotoEditorExtensionImpl::BindContext() return; } - shellContextRef_ = JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &contextObj, ARGC_ONE); + shellContextRef_ = + JsRuntime::LoadSystemModuleByEngine(env, "application.PhotoEditorExtensionContext", &contextObj, ARGC_ONE); if (shellContextRef_ == nullptr) { TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get loadSystemModuleByEngine."); return; @@ -115,8 +116,7 @@ void JsPhotoEditorExtensionImpl::BindContext() nullptr); context_->Bind(jsRuntime_, shellContextRef_.get()); napi_set_named_property(env, obj, "context", contextObj); - napi_wrap( - env, contextObj, workContext, + napi_wrap(env, contextObj, workContext, [](napi_env, void *data, void *) { TAG_LOGD(AAFwkTag::UI_EXT, "Finalizer for weak_ptr ui extension context is called."); if (data == nullptr) { -- Gitee From be02d18610c5e4570e2736de73ce1f67796aa2b7 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 07:04:42 +0000 Subject: [PATCH 22/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp index 55a9b909a75..d0719cb2da2 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp @@ -127,7 +127,8 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env en napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithImage(napi_env env, NapiCallbackInfo &info) { - TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage is called: param size: %{public}d.", static_cast(info.argc)); + TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage is called: param size: %{public}d.", + static_cast(info.argc)); if (info.argc != ARGC_THREE) { ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); -- Gitee From 9d065935e2c9ccb241770184bd25d82a0925faab Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 07:05:25 +0000 Subject: [PATCH 23/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp index d0719cb2da2..bc622b5541a 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp @@ -42,7 +42,8 @@ void JsPhotoEditorExtensionContext::Finalizer(napi_env env, void *data, void *hi std::unique_ptr(static_cast(data)); } -napi_value JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext(napi_env env, std::shared_ptr context) +napi_value JsPhotoEditorExtensionContext::CreateJsPhotoEditorExtensionContext( + napi_env env, std::shared_ptr context) { TAG_LOGD(AAFwkTag::UI_EXT, "CreateJsPhotoEditorExtensionContext begin."); std::shared_ptr abilityInfo = nullptr; -- Gitee From 3d3c74c13a3872ee6bb603fb8b3153566eaac9e8 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 07:07:03 +0000 Subject: [PATCH 24/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h index 8278e4bec84..52e0dff6d08 100644 --- a/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.h @@ -27,7 +27,7 @@ struct NapiCallbackInfo; class JsPhotoEditorExtensionContext { public: explicit JsPhotoEditorExtensionContext(const std::shared_ptr &context) - : context_(context) + : context_(context) {} virtual ~JsPhotoEditorExtensionContext() = default; -- Gitee From 43c35e610beb2affba7caf2d5c40cb5f6e12bd6a Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 07:34:27 +0000 Subject: [PATCH 25/54] codecheck Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js_photo_editor_extension_context.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp index bc622b5541a..15b58f5e019 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp @@ -28,7 +28,6 @@ namespace OHOS { namespace AbilityRuntime { namespace { constexpr size_t ARGC_TWO = 2; -constexpr size_t ARGC_THREE = 3; constexpr const char *ERR_MSG_PARAMS_ERROR = "Params error"; constexpr const char *ERR_MSG_INTERNAL_ERROR = "Internal error"; constexpr int32_t INDEX_ZERO = 0; @@ -129,12 +128,7 @@ napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithUri(napi_env en napi_value JsPhotoEditorExtensionContext::OnSaveEditedContentWithImage(napi_env env, NapiCallbackInfo &info) { TAG_LOGD(AAFwkTag::UI_EXT, "OnSaveEditedContentWithImage is called: param size: %{public}d.", - static_cast(info.argc)); - - if (info.argc != ARGC_THREE) { - ThrowError(env, static_cast(PhotoEditorErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); - return CreateJsUndefined(env); - } + static_cast(info.argc)); auto image = Media::PixelMapNapi::GetPixelMap(env, info.argv[INDEX_ZERO]); if (!image) { -- Gitee From 5f2f81ec54d608ff103d195de163dc9abcfc5351 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 07:56:20 +0000 Subject: [PATCH 26/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9sanitize=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/native/ability/native/BUILD.gn | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index 0fac3af6ece..d426bbf7b17 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -1527,6 +1527,15 @@ config("photo_editor_extension_config") { } ohos_shared_library("photo_editor_extension") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } configs = [ ":photo_editor_extension_config" ] sources = [ @@ -1571,6 +1580,16 @@ ohos_shared_library("photo_editor_extension") { } ohos_shared_library("photo_editor_extension_module") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + sources = [ "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp" ] configs = [ -- Gitee From f7f2d30f09cbdc339c52cf431c82be14f1867884 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 08:19:47 +0000 Subject: [PATCH 27/54] update bundle.json. Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- bundle.json | 938 ++++++++++++++++++++++++++-------------------------- 1 file changed, 473 insertions(+), 465 deletions(-) diff --git a/bundle.json b/bundle.json index 75f2e078048..d37e1cf0417 100644 --- a/bundle.json +++ b/bundle.json @@ -1,468 +1,476 @@ { - "name": "@ohos/ability_runtime", - "description": "Ability管理服务统一调度和管理应用中各Ability和应用管理服务, 用于管理应用运行关系、调度应用进程生命周期及状态", - "version": "3.1", - "license": "Apache License 2.0", - "publishAs": "code-segment", - "segment": { - "destPath": "foundation/ability/ability_runtime" - }, - "dirs": {}, - "scripts": {}, - "component": { - "name": "ability_runtime", - "subsystem": "ability", - "syscap": [ - "SystemCapability.Ability.AbilityRuntime.Core", - "SystemCapability.Ability.AbilityRuntime.FAModel", - "SystemCapability.Ability.AbilityRuntime.AbilityCore", - "SystemCapability.Ability.AbilityRuntime.Mission", - "SystemCapability.Ability.AbilityRuntime.QuickFix", - "SystemCapability.Ability.AbilityTools.AbilityAssistant", - "SystemCapability.Ability.AppStartup" + "name": "@ohos/ability_runtime", + "description": "Ability管理服务统一调度和管理应用中各Ability和应用管理服务, 用于管理应用运行关系、调度应用进程生命周期及状态", + "version": "3.1", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "foundation/ability/ability_runtime" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "ability_runtime", + "subsystem": "ability", + "syscap": [ + "SystemCapability.Ability.AbilityRuntime.Core", + "SystemCapability.Ability.AbilityRuntime.FAModel", + "SystemCapability.Ability.AbilityRuntime.AbilityCore", + "SystemCapability.Ability.AbilityRuntime.Mission", + "SystemCapability.Ability.AbilityRuntime.QuickFix", + "SystemCapability.Ability.AbilityTools.AbilityAssistant", + "SystemCapability.Ability.AppStartup" + ], + "features": [ + "ability_runtime_auto_fill_ability", + "ability_runtime_graphics", + "ability_runtime_power" + ], + "adapted_system_type": [ + "standard" + ], + "rom": "", + "ram": "", + "hisysevent_config":[ + "//foundation/ability/ability_runtime/hisysevent.yaml" + ], + "deps": { + "components": [ + "ability_base", + "accessibility", + "access_token", + "ace_engine", + "appspawn", + "background_task_mgr", + "bundle_framework", + "common_event_service", + "config_policy", + "c_utils", + "data_share", + "dlp_permission_service", + "dsoftbus", + "efficiency_manager", + "eventhandler", + "ets_runtime", + "ets_utils", + "faultloggerd", + "ffrt", + "form_fwk", + "graphic_2d", + "hichecker", + "hicollie", + "hilog", + "hisysevent", + "hitrace", + "hiview", + "i18n", + "icu", + "image_framework", + "init", + "input", + "ipc", + "json", + "jsoncpp", + "kv_store", + "libuv", + "memmgr", + "memmgr_override", + "memory_utils", + "napi", + "netmanager_base", + "node", + "os_account", + "power_manager", + "relational_store", + "resource_management", + "resource_schedule_service", + "safwk", + "samgr", + "screenlock_mgr", + "storage_service", + "toolchain", + "webview", + "window_manager", + "zlib", + "app_file_service" + ], + "third_party": [ + "libjpeg-turbo" + ] + }, + "build": { + "sub_component": [ + "//foundation/ability/ability_runtime/services:ams_target", + "//foundation/ability/ability_runtime/services/sa_profile:ams_sa_profile", + "//foundation/ability/ability_runtime/services/quickfixmgr:quick_fix.cfg", + "//foundation/ability/ability_runtime/tools:tools_target", + "//foundation/ability/ability_runtime/interfaces/inner_api:innerkits_target", + "//foundation/ability/ability_runtime/frameworks/native/ability/native:ability_thread", + "//foundation/ability/ability_runtime/frameworks/native/ability/native:extension_module", + "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process", + "//foundation/ability/ability_runtime/frameworks/native/insight_intent:insight_intent_innerkits", + "//foundation/ability/ability_runtime/frameworks/js/napi:napi_packages", + "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment", + "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment", + "//foundation/ability/ability_runtime/services/abilitymgr/etc:appfwk_etc", + "//foundation/ability/ability_runtime/service_router_framework:srms_target", + "//foundation/ability/ability_runtime/service_router_framework:jsapi_target" ], - "features": [ - "ability_runtime_auto_fill_ability", - "ability_runtime_graphics", - "ability_runtime_power" + "inner_api": [ + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper/include", + "header_files": [ + "os_account_manager_wrapper.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper:ability_deps_wrapper" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils/include", + "header_files": [ + "ability_runtime_error_util.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils:ability_runtime_error_util" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent/include/", + "header_files": [ + "pending_want.h", + "trigger_info.h", + "want_agent_constant.h", + "want_agent_helper.h", + "want_agent_info.h", + "want_agent.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent:wantagent_innerkits" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "ability_manager_client.h", + "launch_param.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/ability_runtime", + "header_files": [ + "ability_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability:ability_context_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/js_environment/interfaces/inner_api", + "header_files": [ + "js_environment.h", + "js_environment_impl.h" + ] + }, + "name": "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/cj_environment/interfaces/inner_api", + "header_files": [ + "cj_environment.h" + ] + }, + "name": "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime/include/", + "header_files": [ + "js_runtime.h", + "runtime.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime:runtime" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context/include", + "header_files": [ + "napi_base_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context:napi_base_context" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common", + "header_files": [ + "napi_common_configuration.h", + "napi_common_start_options.h", + "napi_common_util.h", + "napi_common_want.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common:napi_common" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common", + "header_files": [ + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common:napi_ability_common" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include", + "header_files": [ + "appmgr/app_mgr_client.h", + "appmgr/page_state_data.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager:app_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager/include", + "header_files": [ + "connection_observer_client.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager:connection_obs_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [ + "service_extension.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:service_extension" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [ + "extension.h", + "extension_base.h", + "extension_module_loader.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:extensionkit_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [ + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:abilitykit_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", + "header_files": [ + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:data_ability_helper" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/app/", + "header_files": [ + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:appkit_native" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info/include", + "header_files": [ + "request_info.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info:dialog_request_info" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "ability_connect_callback_stub.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_connect_callback_stub" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/ability_runtime/context", + "header_files": [ + "application_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:app_context" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/c/ability/ability_runtime/child_process", + "header_files": [ + "native_child_process.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission/include/", + "header_files": [ + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission:uri_permission_mgr" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix/include/", + "header_files": [ + "quick_fix_manager_client.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix:quickfix_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager/", + "header_files": [ + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager:dataobs_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api/include", + "header_files": [ + "service_info.h", + "service_router_mgr_interface.h", + "service_router_mgr_proxy.h" + ] + }, + "name": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api:srms_fwk" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/frameworks/simulator", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/frameworks/simulator/ability_simulator:ability_simulator" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/tools/aa/include", + "header_files": [ + "shell_command.h" + ] + }, + "name": "//foundation/ability/ability_runtime/tools/aa:tools_aa_source_set" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "ability_start_setting.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_setting" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "process_options.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:process_options" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "mission_info.h", + "mission_snapshot.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:mission_info" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/ui_extension_ability", + "header_files": [ + "ui_extension_context.h" + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:ui_extension" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager/include", + "header_files": [ + "extension_manager_client.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager:extension_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler/include", + "header_files": [] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler:session_handler" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager/include", + "header_files": [ + "auto_fill_error.h", + "auto_fill_manager.h", + "fill_request_callback_interface.h", + "save_request_callback_interface.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager:auto_fill_manager" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", + "header_files": [ + "start_options.h" + ] + }, + "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_options" + }, + { + "header": { + "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/dialog_request_callback", + "header_files": [ + ] + }, + "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:dialog_request_callback" + } ], - "adapted_system_type": [ - "standard" - ], - "rom": "", - "ram": "", - "hisysevent_config": [ - "//foundation/ability/ability_runtime/hisysevent.yaml" - ], - "deps": { - "components": [ - "ability_base", - "accessibility", - "access_token", - "ace_engine", - "appspawn", - "background_task_mgr", - "bundle_framework", - "common_event_service", - "config_policy", - "c_utils", - "data_share", - "dlp_permission_service", - "dsoftbus", - "efficiency_manager", - "eventhandler", - "ets_runtime", - "ets_utils", - "faultloggerd", - "ffrt", - "form_fwk", - "graphic_2d", - "hichecker", - "hicollie", - "hilog", - "hisysevent", - "hitrace", - "hiview", - "i18n", - "icu", - "image_framework", - "init", - "input", - "ipc", - "json", - "jsoncpp", - "kv_store", - "libuv", - "memmgr", - "memmgr_override", - "memory_utils", - "napi", - "netmanager_base", - "node", - "os_account", - "power_manager", - "relational_store", - "resource_management", - "resource_schedule_service", - "safwk", - "samgr", - "screenlock_mgr", - "storage_service", - "toolchain", - "webview", - "window_manager", - "zlib", - "app_file_service" - ], - "third_party": [ - "libjpeg-turbo" - ] - }, - "build": { - "sub_component": [ - "//foundation/ability/ability_runtime/services:ams_target", - "//foundation/ability/ability_runtime/services/sa_profile:ams_sa_profile", - "//foundation/ability/ability_runtime/services/quickfixmgr:quick_fix.cfg", - "//foundation/ability/ability_runtime/tools:tools_target", - "//foundation/ability/ability_runtime/interfaces/inner_api:innerkits_target", - "//foundation/ability/ability_runtime/frameworks/native/ability/native:ability_thread", - "//foundation/ability/ability_runtime/frameworks/native/ability/native:extension_module", - "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process", - "//foundation/ability/ability_runtime/frameworks/native/insight_intent:insight_intent_innerkits", - "//foundation/ability/ability_runtime/frameworks/js/napi:napi_packages", - "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment", - "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment", - "//foundation/ability/ability_runtime/services/abilitymgr/etc:appfwk_etc", - "//foundation/ability/ability_runtime/service_router_framework:srms_target", - "//foundation/ability/ability_runtime/service_router_framework:jsapi_target" - ], - "inner_api": [{ - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper/include", - "header_files": [ - "os_account_manager_wrapper.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/deps_wrapper:ability_deps_wrapper" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils/include", - "header_files": [ - "ability_runtime_error_util.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/error_utils:ability_runtime_error_util" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent/include/", - "header_files": [ - "pending_want.h", - "trigger_info.h", - "want_agent_constant.h", - "want_agent_helper.h", - "want_agent_info.h", - "want_agent.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent:wantagent_innerkits" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "ability_manager_client.h", - "launch_param.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/ability_runtime", - "header_files": [ - "ability_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability:ability_context_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/js_environment/interfaces/inner_api", - "header_files": [ - "js_environment.h", - "js_environment_impl.h" - ] - }, - "name": "//foundation/ability/ability_runtime/js_environment/frameworks/js_environment:js_environment" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/cj_environment/interfaces/inner_api", - "header_files": [ - "cj_environment.h" - ] - }, - "name": "//foundation/ability/ability_runtime/cj_environment/frameworks/cj_environment:cj_environment" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime/include/", - "header_files": [ - "js_runtime.h", - "runtime.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/runtime:runtime" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context/include", - "header_files": [ - "napi_base_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/napi_base_context:napi_base_context" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common", - "header_files": [ - "napi_common_configuration.h", - "napi_common_start_options.h", - "napi_common_util.h", - "napi_common_want.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_common:napi_common" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/frameworks/js/napi/inner/napi_ability_common:napi_ability_common" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include", - "header_files": [ - "appmgr/app_mgr_client.h", - "appmgr/page_state_data.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager:app_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager/include", - "header_files": [ - "connection_observer_client.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/connectionobs_manager:connection_obs_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [ - "service_extension.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:service_extension" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [ - "extension.h", - "extension_base.h", - "extension_module_loader.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:extensionkit_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:abilitykit_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:data_ability_helper" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/app/", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:appkit_native" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info/include", - "header_files": [ - "request_info.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/js/napi/dialog_request_info:dialog_request_info" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "ability_connect_callback_stub.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_connect_callback_stub" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/ability_runtime/context", - "header_files": [ - "application_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/appkit:app_context" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/c/ability/ability_runtime/child_process", - "header_files": [ - "native_child_process.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/child_process:child_process" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission/include/", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/uri_permission:uri_permission_mgr" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix/include/", - "header_files": [ - "quick_fix_manager_client.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/quick_fix:quickfix_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager/", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/dataobs_manager:dataobs_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api/include", - "header_files": [ - "service_info.h", - "service_router_mgr_interface.h", - "service_router_mgr_proxy.h" - ] - }, - "name": "//foundation/ability/ability_runtime/service_router_framework/interfaces/inner_api:srms_fwk" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/frameworks/simulator", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/frameworks/simulator/ability_simulator:ability_simulator" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/tools/aa/include", - "header_files": [ - "shell_command.h" - ] - }, - "name": "//foundation/ability/ability_runtime/tools/aa:tools_aa_source_set" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "ability_start_setting.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_setting" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "process_options.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:process_options" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "mission_info.h", - "mission_snapshot.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:mission_info" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/ui_extension_ability", - "header_files": [ - "ui_extension_context.h" - ] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:ui_extension" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager/include", - "header_files": [ - "extension_manager_client.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/extension_manager:extension_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler/include", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/session_handler:session_handler" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager/include", - "header_files": [ - "auto_fill_error.h", - "auto_fill_manager.h", - "fill_request_callback_interface.h", - "save_request_callback_interface.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/auto_fill_manager:auto_fill_manager" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "header_files": [ - "start_options.h" - ] - }, - "name": "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_start_options" - }, - { - "header": { - "header_base": "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native/dialog_request_callback", - "header_files": [] - }, - "name": "//foundation/ability/ability_runtime/frameworks/native/ability/native:dialog_request_callback" - } - ], - "test": [ - "//foundation/ability/ability_runtime/test/moduletest:moduletest", - "//foundation/ability/ability_runtime/test/fuzztest:fuzztest", - "//foundation/ability/ability_runtime/test/unittest:unittest", - "//foundation/ability/ability_runtime/test/sample:sample", - "//foundation/ability/ability_runtime/tools/test:moduletest", - "//foundation/ability/ability_runtime/tools/test:systemtest", - "//foundation/ability/ability_runtime/tools/test:unittest", - "//foundation/ability/ability_runtime/js_environment/test/unittest:unittest", - "//foundation/ability/ability_runtime/service_router_framework:test_target" - ] - } - } -} \ No newline at end of file + "test": [ + "//foundation/ability/ability_runtime/test/moduletest:moduletest", + "//foundation/ability/ability_runtime/test/fuzztest:fuzztest", + "//foundation/ability/ability_runtime/test/unittest:unittest", + "//foundation/ability/ability_runtime/test/sample:sample", + "//foundation/ability/ability_runtime/tools/test:moduletest", + "//foundation/ability/ability_runtime/tools/test:systemtest", + "//foundation/ability/ability_runtime/tools/test:unittest", + "//foundation/ability/ability_runtime/js_environment/test/unittest:unittest", + "//foundation/ability/ability_runtime/service_router_framework:test_target" + ] + } + } +} -- Gitee From b7e4503ed5d085781c985315f69da6113176a472 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Wed, 29 May 2024 09:11:00 +0000 Subject: [PATCH 28/54] =?UTF-8?q?=E5=A2=9E=E5=8A=A0sanitize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- test/unittest/photo_editor_extension_test/BUILD.gn | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unittest/photo_editor_extension_test/BUILD.gn b/test/unittest/photo_editor_extension_test/BUILD.gn index 5f65db40725..29aa7ddf5a9 100644 --- a/test/unittest/photo_editor_extension_test/BUILD.gn +++ b/test/unittest/photo_editor_extension_test/BUILD.gn @@ -72,6 +72,12 @@ config("module_ability_context_config") { } ohos_unittest("photo_editor_extension_module_loader_test") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = "ability_runtime/photo_editor_extension" sources = [ @@ -106,6 +112,12 @@ ohos_unittest("photo_editor_extension_module_loader_test") { } ohos_unittest("photo_editor_extension_test") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + module_out_path = "ability_runtime/photo_editor_extension" include_dirs = [ -- Gitee From 8cb57b81ea5a6a282a1ae823ad7ea69949e95cc3 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 01:43:02 +0000 Subject: [PATCH 29/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=A3=E5=86=B3=20?= =?UTF-8?q?=E2=80=9C=E7=A6=81=E6=AD=A2include=5Fdirs=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E8=B7=AF=E5=BE=84=E5=BC=95=E7=94=A8=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E9=83=A8=E4=BB=B6InnerAPI=E5=A4=B4=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/native/ability/native/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index d426bbf7b17..df742a78d74 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -1593,7 +1593,6 @@ ohos_shared_library("photo_editor_extension_module") { sources = [ "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp" ] configs = [ - ":ability_config", ":photo_editor_extension_config", ] -- Gitee From 5982a5fb400396b4c198358f309e9be91ff75683 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 01:55:19 +0000 Subject: [PATCH 30/54] =?UTF-8?q?=E5=A2=9E=E5=8A=A0sanitize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js/napi/photo_editor_extension_context/BUILD.gn | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn index 6070cee55b7..013cd30d5eb 100755 --- a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn @@ -35,6 +35,16 @@ gen_js_obj("photo_editor_extension_context_abc") { } ohos_shared_library("photoeditorextensioncontext_napi") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + sources = [ "photo_editor_extension_context_module.cpp" ] deps = [ -- Gitee From afe60871c8d997178fad238543a422a612070f3f Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 01:55:56 +0000 Subject: [PATCH 31/54] =?UTF-8?q?=E5=A2=9E=E5=8A=A0sanitize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../js/napi/photo_editor_extension_ability/BUILD.gn | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn index 092ebaa2662..31a90ebbe95 100755 --- a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn @@ -35,6 +35,16 @@ gen_js_obj("photo_editor_extension_ability_abc") { } ohos_shared_library("photoeditorextensionability_napi") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + sources = [ "photo_editor_extension_ability_module.cpp" ] deps = [ -- Gitee From eb70fb2a2fa07f0fc1d18a5ee394c938cb0b5f0f Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 02:25:50 +0000 Subject: [PATCH 32/54] =?UTF-8?q?=E5=A2=9E=E5=8A=A0photoEditorExtensionMod?= =?UTF-8?q?ule=E7=BC=96=E8=AF=91=E7=9A=84=E5=A4=96=E9=83=A8=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/native/ability/native/BUILD.gn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index df742a78d74..5bfa30c7f54 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -1610,6 +1610,10 @@ ohos_shared_library("photo_editor_extension_module") { "napi:ace_napi", ] + if (ability_runtime_graphics) { + external_deps += [ "window_manager:libwm" ] + } + relative_install_dir = "extensionability/" subsystem_name = "ability" part_name = "ability_runtime" -- Gitee From 312421c2914e4be11fab79ed7bec288b1fcf9491 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 03:26:47 +0000 Subject: [PATCH 33/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E7=9A=84format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/js/napi/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index d023a37eb92..fee3fa07d2f 100644 --- a/frameworks/js/napi/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -79,6 +79,8 @@ group("napi_packages") { "${ability_runtime_napi_path}/mission_manager:distributedmissionmanager", "${ability_runtime_napi_path}/mission_manager:missionmanager_napi", "${ability_runtime_napi_path}/particleAbility:particleability", + "${ability_runtime_napi_path}/photo_editor_extension_ability:photoeditorextensionability_napi", + "${ability_runtime_napi_path}/photo_editor_extension_context:photoeditorextensioncontext_napi", "${ability_runtime_napi_path}/quick_fix:quickfixmanager_napi", "${ability_runtime_napi_path}/service_extension_ability:serviceextensionability", "${ability_runtime_napi_path}/service_extension_ability:serviceextensionability_napi", @@ -91,7 +93,5 @@ group("napi_packages") { "${ability_runtime_napi_path}/wantConstant:wantconstant_napi", "${ability_runtime_napi_path}/wantagent:napi_wantAgent", "${ability_runtime_napi_path}/wantagent:wantagent", - "${ability_runtime_napi_path}/photo_editor_extension_ability:photoeditorextensionability_napi", - "${ability_runtime_napi_path}/photo_editor_extension_context:photoeditorextensioncontext_napi", ] } -- Gitee From ada5d3feea7a43a7d2a4cdbe9e1966e51b47514c Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 11:29:09 +0000 Subject: [PATCH 34/54] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/native/ability/native/extension_ability_thread.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/native/ability/native/extension_ability_thread.cpp b/frameworks/native/ability/native/extension_ability_thread.cpp index 76d8a1de3ac..4dd889aaa11 100644 --- a/frameworks/native/ability/native/extension_ability_thread.cpp +++ b/frameworks/native/ability/native/extension_ability_thread.cpp @@ -62,6 +62,7 @@ const std::map UI_EXTENSION_NAME_ { AppExecFwk::ExtensionAbilityType::AUTO_FILL_SMART, AUTO_FILL_EXTENSION }, { AppExecFwk::ExtensionAbilityType::EMBEDDED_UI, EMBEDDED_UI_EXTENSION }, { AppExecFwk::ExtensionAbilityType::PHOTO_EDITOR, PHOTO_EDITOR_EXTENSION } +#endif //SUPPORT_GRAPHICS }; ExtensionAbilityThread::ExtensionAbilityThread() : extensionImpl_(nullptr), currentExtension_(nullptr) {} -- Gitee From 46b425d778fe29eaf84836ef4bcb8bb89cb9bdcc Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 12:04:03 +0000 Subject: [PATCH 35/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/js/napi/photo_editor_extension_ability/BUILD.gn | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn index 31a90ebbe95..f90c692203d 100755 --- a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn @@ -28,8 +28,9 @@ gen_js_obj("photo_editor_extension_ability_js") { } gen_js_obj("photo_editor_extension_ability_abc") { - input = get_label_info(":gen_photo_editor_extension_ability_abc", "target_out_dir") + - "/photo_editor_extension_ability.abc" + input = + get_label_info(":gen_photo_editor_extension_ability_abc", + "target_out_dir") + "/photo_editor_extension_ability.abc" output = target_out_dir + "/photo_editor_extension_ability_abc.o" dep = ":gen_photo_editor_extension_ability_abc" } @@ -44,7 +45,7 @@ ohos_shared_library("photoeditorextensionability_napi") { cfi_vcall_icall_only = true debug = false } - + sources = [ "photo_editor_extension_ability_module.cpp" ] deps = [ -- Gitee From a97e882b1bc3e940f5ebc8ef5b715068dfc781ab Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 12:47:37 +0000 Subject: [PATCH 36/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E7=9A=84format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/js/napi/photo_editor_extension_context/BUILD.gn | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn index 013cd30d5eb..ace1a8019ac 100755 --- a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn @@ -28,8 +28,9 @@ gen_js_obj("photo_editor_extension_context_js") { } gen_js_obj("photo_editor_extension_context_abc") { - input = get_label_info(":gen_photo_editor_extension_context_abc", "target_out_dir") + - "/photo_editor_extension_context.abc" + input = + get_label_info(":gen_photo_editor_extension_context_abc", + "target_out_dir") + "/photo_editor_extension_context.abc" output = target_out_dir + "/photo_editor_extension_context_abc.o" dep = ":gen_photo_editor_extension_context_abc" } @@ -44,7 +45,7 @@ ohos_shared_library("photoeditorextensioncontext_napi") { cfi_vcall_icall_only = true debug = false } - + sources = [ "photo_editor_extension_context_module.cpp" ] deps = [ -- Gitee From 5a7650cb1540c3b95d1feb94f75491937a0c9eec Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 13:04:00 +0000 Subject: [PATCH 37/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E7=9A=84format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/native/ability/native/BUILD.gn | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index 104796344e9..dccaa1dea92 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -999,10 +999,10 @@ group("extension_module") { ":action_extension_module", ":auto_fill_extension_module", ":embedded_ui_extension_module", + ":photo_editor_extension_module", ":service_extension_module", ":share_extension_module", ":ui_extension_module", - ":photo_editor_extension_module" ] if (ability_runtime_graphics) { @@ -1545,7 +1545,7 @@ config("photo_editor_extension_config") { "${ability_runtime_path}/interfaces/kits/native/ability/native", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", - "${ability_runtime_path}/interfaces/kits/native/ability/native/photo_editor_extension_ability" + "${ability_runtime_path}/interfaces/kits/native/ability/native/photo_editor_extension_ability", ] } @@ -1558,15 +1558,15 @@ ohos_shared_library("photo_editor_extension") { cfi_cross_dso = true cfi_vcall_icall_only = true debug = false - } + } configs = [ ":photo_editor_extension_config" ] sources = [ "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp", - "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp", "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/js_photo_editor_extension_context.cpp", + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp", + "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension.cpp", "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp", - "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/js_photo_editor_extension_impl.cpp" ] deps = [ @@ -1583,15 +1583,15 @@ ohos_shared_library("photo_editor_extension") { external_deps = [ "ability_base:want", "ability_base:zuri", + "app_file_service:fileuri_native", "c_utils:utils", "eventhandler:libeventhandler", "hilog:libhilog", "hitrace:hitrace_meter", + "image_framework:image", + "image_framework:image_native", "ipc:ipc_napi", "napi:ace_napi", - "app_file_service:fileuri_native", - "image_framework:image", - "image_framework:image_native" ] if (ability_runtime_graphics) { @@ -1612,12 +1612,10 @@ ohos_shared_library("photo_editor_extension_module") { cfi_vcall_icall_only = true debug = false } - + sources = [ "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp" ] - configs = [ - ":photo_editor_extension_config", - ] + configs = [ ":photo_editor_extension_config" ] deps = [ ":photo_editor_extension", -- Gitee From 3ef587d76b9c779c06998916525f21d7e69e9bb0 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 13:08:48 +0000 Subject: [PATCH 38/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E7=9A=84format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- test/unittest/photo_editor_extension_test/BUILD.gn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/unittest/photo_editor_extension_test/BUILD.gn b/test/unittest/photo_editor_extension_test/BUILD.gn index 29aa7ddf5a9..c64eba605ba 100644 --- a/test/unittest/photo_editor_extension_test/BUILD.gn +++ b/test/unittest/photo_editor_extension_test/BUILD.gn @@ -81,8 +81,8 @@ ohos_unittest("photo_editor_extension_module_loader_test") { module_out_path = "ability_runtime/photo_editor_extension" sources = [ - "photo_editor_extension_module_loader_test.cpp", "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp", + "photo_editor_extension_module_loader_test.cpp", ] cflags = [] @@ -96,8 +96,8 @@ ohos_unittest("photo_editor_extension_module_loader_test") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", - "${ability_runtime_native_path}/ability/native:ui_extension", "${ability_runtime_native_path}/ability/native:photo_editor_extension", + "${ability_runtime_native_path}/ability/native:ui_extension", "${ability_runtime_native_path}/appkit:app_context", "${ability_runtime_native_path}/appkit:appkit_native", "//third_party/googletest:gmock_main", @@ -117,7 +117,7 @@ ohos_unittest("photo_editor_extension_test") { cfi_cross_dso = true debug = false } - + module_out_path = "ability_runtime/photo_editor_extension" include_dirs = [ @@ -156,8 +156,8 @@ ohos_unittest("photo_editor_extension_test") { group("unittest") { testonly = true - deps = [ + deps = [ ":photo_editor_extension_module_loader_test", - ":photo_editor_extension_test" + ":photo_editor_extension_test", ] } \ No newline at end of file -- Gitee From 92d7ac8266c1ea1690508f6704ad51ca19bf04ee Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Thu, 30 May 2024 13:19:02 +0000 Subject: [PATCH 39/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E7=9A=84format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- test/unittest/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index a33fee7c88b..de235763029 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -483,6 +483,7 @@ group("unittest") { "pending_want_record_test:unittest", "pending_want_test:unittest", "permission_verification_test:unittest", + "photo_editor_extension_test:unittest", "quick_fix:unittest", "remote_mission_listener_proxy_test:unittest", "remote_mission_listener_stub_test:unittest", @@ -524,7 +525,6 @@ group("unittest") { "want_sender_proxy_test:unittest", "want_sender_stub_test:unittest", "wants_info_test:unittest", - "photo_editor_extension_test:unittest" ] if (ability_runtime_graphics) { -- Gitee From 94908aa48ef943ba61ba3ee40af086c518d6d321 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Fri, 31 May 2024 01:23:07 +0000 Subject: [PATCH 40/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E7=9A=84format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- test/unittest/photo_editor_extension_test/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittest/photo_editor_extension_test/BUILD.gn b/test/unittest/photo_editor_extension_test/BUILD.gn index c64eba605ba..77b97394cbb 100644 --- a/test/unittest/photo_editor_extension_test/BUILD.gn +++ b/test/unittest/photo_editor_extension_test/BUILD.gn @@ -160,4 +160,4 @@ group("unittest") { ":photo_editor_extension_module_loader_test", ":photo_editor_extension_test", ] -} \ No newline at end of file +} -- Gitee From 45e4e947a02a7c9a246269816ba3f13089e9e79c Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Tue, 4 Jun 2024 02:58:51 +0000 Subject: [PATCH 41/54] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AF=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86=E7=9A=84=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- bundle.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bundle.json b/bundle.json index 6882343bcfe..8127c7d4bcb 100644 --- a/bundle.json +++ b/bundle.json @@ -91,8 +91,7 @@ "toolchain", "webview", "window_manager", - "zlib", - "app_file_service" + "zlib" ], "third_party": [ "libjpeg-turbo" -- Gitee From 1cd0446c530cda13fcc43049eea723ad2612363e Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Tue, 4 Jun 2024 03:00:04 +0000 Subject: [PATCH 42/54] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AF=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86=E7=9A=84=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- frameworks/native/ability/native/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index 09c6febdc18..0b7d9f9d728 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -1584,7 +1584,6 @@ ohos_shared_library("photo_editor_extension") { external_deps = [ "ability_base:want", "ability_base:zuri", - "app_file_service:fileuri_native", "c_utils:utils", "eventhandler:libeventhandler", "hilog:libhilog", -- Gitee From 823521d785570b6d7946ba6241ede089cba558ac Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Tue, 4 Jun 2024 03:01:30 +0000 Subject: [PATCH 43/54] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AF=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86=E7=9A=84=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_context.cpp | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp index b8fd3b53739..14fb0c77a93 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp @@ -17,8 +17,6 @@ #include #include "media_errors.h" #include "hilog_tag_wrapper.h" -#include "file_uri.h" -#include "sandbox_helper.h" namespace OHOS { namespace AbilityRuntime { @@ -50,8 +48,13 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::s { const std::string panelUri = want_->GetStringParam(PANEL_TRANSFER_FILE_PATH); TAG_LOGD(AAFwkTag::UI_EXT, "PanelUri: %{public}s.", panelUri.c_str()); - AppFileService::ModuleFileUri::FileUri fileUri(panelUri); - std::string panelPhysicalPath = fileUri.GetRealPath(); + + std::string panelPhysicalPath = panelUri; + std::string bundleName = GetRealPath(panelPhysicalPath); + const std::string pathShare = "/data/storage/el2/share"; + const std::string modeRw = "/rw/"; + panelPhysicalPath = pathShare + modeRw + bundleName + panelPhysicalPath; + std::ofstream panelFile; panelFile.open(panelPhysicalPath, std::ios::binary); if (!panelFile.is_open()) { @@ -104,8 +107,11 @@ void PhotoEditorExtensionContext::SetWant(const std::shared_ptr &wa PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::string &imageUri, const std::string &panelUri) { - AppFileService::ModuleFileUri::FileUri fileUri(panelUri); - std::string panelPhysicalPath = fileUri.GetRealPath(); + std::string panelPhysicalPath = panelUri; + std::string bundleName = GetRealPath(panelPhysicalPath); + const std::string pathShare = "/data/storage/el2/share"; + const std::string modeRw = "/rw/"; + panelPhysicalPath = pathShare + modeRw + bundleName + panelPhysicalPath; TAG_LOGD(AAFwkTag::UI_EXT, "ImageUri: %{public}s, panelPhysicalPath: %{public}s.", imageUri.c_str(), panelPhysicalPath.c_str()); @@ -148,5 +154,15 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::st return PhotoEditorErrorCode::ERROR_OK; } +std::string PhotoEditorExtensionContext::GetRealPath(std::string &uri) +{ + const std::string filePrefix = "file://"; + uri.replace(0, filePrefix.size(), ""); + auto pos = uri.find_first_of("//"); + std::string bundleName = uri.substr(0, pos); + uri = uri.substr(pos); + return bundleName; +} + } // namespace AbilityRuntime } // namespace OHOS \ No newline at end of file -- Gitee From 569457fd9ed93958c9a2aecf673ab8a8f421fa1e Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Tue, 4 Jun 2024 03:02:17 +0000 Subject: [PATCH 44/54] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AF=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86=E7=9A=84=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_context.h | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h index d8e5f616bc7..a4192238023 100644 --- a/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h +++ b/interfaces/kits/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.h @@ -71,6 +71,7 @@ public: private: PhotoEditorErrorCode CopyImageToPanel(const std::string &imageUri, const std::string &panelUri); + std::string GetRealPath(std::string &uri); private: std::shared_ptr want_; -- Gitee From 4380ba0e92b6d25b05120043bdf2c3ccb4a4a168 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Tue, 4 Jun 2024 03:07:43 +0000 Subject: [PATCH 45/54] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AF=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86=E7=9A=84=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- .../photo_editor_extension_context.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp index 14fb0c77a93..d7dc6592209 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/photo_editor_extension_context.cpp @@ -24,6 +24,8 @@ namespace AbilityRuntime { const size_t PhotoEditorExtensionContext::CONTEXT_TYPE_ID(std::hash{}("PhotoEditorExtensionContext")); constexpr const char *PANEL_TRANSFER_FILE_PATH = "transferFile"; const uint64_t MAX_IMAGE_SIZE = 50 * 1024 * 1024; +const std::string PATH_SHARE = "/data/storage/el2/share"; +const std::string MODE_RW = "/rw/"; PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::string &uri, AAFwk::Want &newWant) { @@ -51,9 +53,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::SaveEditedContent(const std::s std::string panelPhysicalPath = panelUri; std::string bundleName = GetRealPath(panelPhysicalPath); - const std::string pathShare = "/data/storage/el2/share"; - const std::string modeRw = "/rw/"; - panelPhysicalPath = pathShare + modeRw + bundleName + panelPhysicalPath; + panelPhysicalPath = PATH_SHARE + MODE_RW + bundleName + panelPhysicalPath; std::ofstream panelFile; panelFile.open(panelPhysicalPath, std::ios::binary); @@ -109,9 +109,7 @@ PhotoEditorErrorCode PhotoEditorExtensionContext::CopyImageToPanel(const std::st { std::string panelPhysicalPath = panelUri; std::string bundleName = GetRealPath(panelPhysicalPath); - const std::string pathShare = "/data/storage/el2/share"; - const std::string modeRw = "/rw/"; - panelPhysicalPath = pathShare + modeRw + bundleName + panelPhysicalPath; + panelPhysicalPath = PATH_SHARE + MODE_RW + bundleName + panelPhysicalPath; TAG_LOGD(AAFwkTag::UI_EXT, "ImageUri: %{public}s, panelPhysicalPath: %{public}s.", imageUri.c_str(), panelPhysicalPath.c_str()); -- Gitee From 092b4a2063ff29a76b3ced1b3063d64190ce75b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E5=B3=B0?= Date: Tue, 4 Jun 2024 12:09:06 +0000 Subject: [PATCH 46/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/js/napi/photo_editor_extension_ability/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn index f90c692203d..28f96ada2f7 100755 --- a/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_ability/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -- Gitee From 280449eb251cc0cf823202a6cbfa8ed45d3e9682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E5=B3=B0?= Date: Tue, 4 Jun 2024 12:09:19 +0000 Subject: [PATCH 47/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/js/napi/photo_editor_extension_context/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn index ace1a8019ac..0083cb3d584 100755 --- a/frameworks/js/napi/photo_editor_extension_context/BUILD.gn +++ b/frameworks/js/napi/photo_editor_extension_context/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -- Gitee From f827920579b34289dbe007ef7584ccfa7c987b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E5=B3=B0?= Date: Tue, 4 Jun 2024 12:09:37 +0000 Subject: [PATCH 48/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../photo_editor_extension_ability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js index 6ae8de40ff9..ed321878ece 100644 --- a/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js +++ b/frameworks/js/napi/photo_editor_extension_ability/photo_editor_extension_ability.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 6c8451ad4574b0c1be99f04ed910ed7ae8868e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E5=B3=B0?= Date: Tue, 4 Jun 2024 12:09:52 +0000 Subject: [PATCH 49/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../photo_editor_extension_context.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js index 6dab992a8c7..081a1bb4a4d 100755 --- a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 6500a980cde936ded0bef299726e9329db424b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E5=B3=B0?= Date: Tue, 4 Jun 2024 12:10:08 +0000 Subject: [PATCH 50/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../photo_editor_extension_context_module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp index ea41f3bb137..31020abe286 100755 --- a/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp +++ b/frameworks/js/napi/photo_editor_extension_context/photo_editor_extension_context_module.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From df9d05ce6967da1da53ae5d48e1450da36ac2cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E5=B3=B0?= Date: Tue, 4 Jun 2024 12:10:22 +0000 Subject: [PATCH 51/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js_photo_editor_extension.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp index bb1ae970402..1e435580896 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp @@ -42,7 +42,7 @@ void JsPhotoEditorExtension::Init(const std::shared_ptrSetToken(token); auto appContext = Context::GetApplicationContext(); if (appContext == nullptr) { - TAG_LOGE(AAFwkTag::UI_EXT, "ServiceExtension::CreateAndInitContext appContext is nullptr."); + TAG_LOGE(AAFwkTag::UI_EXT, "JsPhotoEditorExtension::CreateAndInitContext appContext is nullptr."); return; } context->SetApplicationInfo(appContext->GetApplicationInfo()); -- Gitee From 73854dfffb50119c60206daf87756620e5c7897f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E5=B3=B0?= Date: Tue, 4 Jun 2024 12:10:34 +0000 Subject: [PATCH 52/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js_photo_editor_extension.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp index 1e435580896..5c20c42f831 100644 --- a/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp +++ b/frameworks/native/ability/native/photo_editor_extension_ability/js_photo_editor_extension.cpp @@ -50,7 +50,7 @@ void JsPhotoEditorExtension::Init(const std::shared_ptrSetParentContext(appContext); if (record == nullptr) { - TAG_LOGE(AAFwkTag::UI_EXT, "ServiceExtension::CreateAndInitContext record is nullptr."); + TAG_LOGE(AAFwkTag::UI_EXT, "JsPhotoEditorExtension::CreateAndInitContext record is nullptr."); return; } TAG_LOGD(AAFwkTag::UI_EXT, "Begin init abilityInfo."); -- Gitee From 2e83e4d5a584e3c5cd4837a4e5e9c356f5aa6815 Mon Sep 17 00:00:00 2001 From: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> Date: Fri, 7 Jun 2024 02:46:21 +0000 Subject: [PATCH 53/54] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=BE=85=E6=8B=89?= =?UTF-8?q?=E8=B5=B7extension=E8=A6=81=E6=B1=82caller=E6=96=B9=E6=98=AF?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=BA=94=E7=94=A8=E7=9A=84=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: mars10577020 <8651080+mars10577020@user.noreply.gitee.com> --- services/common/include/ui_extension_utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/common/include/ui_extension_utils.h b/services/common/include/ui_extension_utils.h index e54b61ac2f6..cb852bb5fd8 100755 --- a/services/common/include/ui_extension_utils.h +++ b/services/common/include/ui_extension_utils.h @@ -124,6 +124,14 @@ inline bool IsWindowExtension(const AppExecFwk::ExtensionAbilityType type) { return type == AppExecFwk::ExtensionAbilityType::WINDOW; } + +// In this case, extension which be starting needs that caller should be the system app, otherwise not supported. +inline bool IsSystemCallerNeeded(const AppExecFwk::ExtensionAbilityType type) +{ + const std::unordered_set uiExtensionStartingSet = { + AppExecFwk::ExtensionAbilityType::PHOTO_EDITOR}; + return uiExtensionStartingSet.find(type) != uiExtensionStartingSet.end(); +} } // namespace UIExtensionUtils } // namespace AAFwk } // namespace OHOS -- Gitee From 7367879683f613ab7274b1c897d7016cad63c03a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E9=B8=BF?= Date: Fri, 7 Jun 2024 10:57:27 +0800 Subject: [PATCH 54/54] =?UTF-8?q?IssueNo:=20#I9T0HG:=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E5=BE=85=E6=8B=89=E8=B5=B7extension=E8=A6=81=E6=B1=82caller?= =?UTF-8?q?=E6=96=B9=E6=98=AF=E7=B3=BB=E7=BB=9F=E5=BA=94=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴鸿 --- .../abilitymgr/src/ability_manager_service.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index b00a5f03711..9888f940127 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -8809,6 +8809,24 @@ int AbilityManagerService::CheckUIExtensionPermission(const AbilityRequest &abil return CHECK_PERMISSION_FAILED; } } + + if (AAFwk::UIExtensionUtils::IsSystemCallerNeeded(extensionType)) { + auto callerRecord = Token::GetAbilityRecordByToken(abilityRequest.callerToken); + if (callerRecord == nullptr) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "Invalid caller."); + return NO_FOUND_ABILITY_BY_CALLER; + } + + if (!callerRecord->GetApplicationInfo().isSystemApp + && !AAFwk::PermissionVerification::GetInstance()->IsSACall()) { + TAG_LOGE(AAFwkTag::ABILITYMGR, + "Bundle %{public}s wanna to start but caller bundle %{public}s " + "isn't system app, type %{public}d not allowed.", + abilityRequest.appInfo.bundleName.c_str(), callerRecord->GetApplicationInfo().bundleName.c_str(), + extensionType); + return CHECK_PERMISSION_FAILED; + } + } return ERR_OK; } -- Gitee