From e21162c48ebb97e133b1d8e29830acb2ea1dc0c7 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Sat, 2 Aug 2025 10:45:49 +0800 Subject: [PATCH 01/27] add libace.map and ArkUIAniUiextensionModal.ts Signed-off-by: hanshu12138 --- build/libace.map | 2 ++ .../ui_extension/ArkUIAniUiextensionModal.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/build/libace.map b/build/libace.map index eeddefc89ea..e6bf52c1bde 100644 --- a/build/libace.map +++ b/build/libace.map @@ -329,6 +329,8 @@ OHOS::Ace::NG::ServiceCollaborationAceCallback::*; OHOS::Ace::DumpLog::*; OHOS::Ace::NG::UIExtensionAdapter::*; + OHOS::Ace::NG::UIExtensionStatic::*; + OHOS::Ace::NG::SecurityUIExtensionStatic::*; virtual?thunk?to?OHOS::Ace::Animator::~Animator??; virtual?thunk?to?OHOS::Ace::Frontend::MaybeRelease*; diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts index 0b7d0ec984b..a5d4724ce63 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts @@ -55,3 +55,18 @@ export class ArkUIAniUiextensionModal { native static _Uiextension_Set_OnTerminationCallback(nodePointer: KLong, value: TerminationCallback) : void; native static _Uiextension_Set_OnReleaseCallback(nodePointer: KLong, value: ReleaseCallback) : void; } + +export class ArkUIAniSecurityUiextensionModal { + static { + ArkUIAniUiextensionLoadLibraryHelp.LoadLibrary(); + } + + native static _SecurityUiextension_Set_Option(nodePointer: KLong, option: ArkUIAniUIExtensionOptions): void + native static _SecurityUiextension_Set_Want(nodePointer: KLong, want: Want): void + native static _SecurityUiextension_Set_OnResultCallback(nodePointer: KLong, value: ResultCallback): void + native static _SecurityUiextension_Set_OnErrorCallback(nodePointer: KLong, value: ErrorCallback) : void; + native static _SecurityUiextension_Set_OnReciveCallback(nodePointer: KLong, value: ReciveCallback) : void; + native static _SecurityUiextension_Set_OnTerminationCallback(nodePointer: KLong, value: TerminationCallback) : void; + native static _SecurityUiextension_Set_OnReleaseCallback(nodePointer: KLong, value: ReleaseCallback) : void; + native static _SecurityUiextension_Set_OnDrawReadyCallback(nodePointer: KLong, value: DrawReadyCallback) : void; +} \ No newline at end of file -- Gitee From 9aa8d43d89886c3cb377e9283969c5386d6e4ee0 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Sat, 2 Aug 2025 11:15:23 +0800 Subject: [PATCH 02/27] add BUILD.gn ani_uiextension_module.cpp Signed-off-by: hanshu12138 --- .../src/ani/native/ui_extension/BUILD.gn | 3 + .../ui_extension/ani_uiextension_module.cpp | 66 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn index 913b563ea69..3c3ecb4b866 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn @@ -26,6 +26,9 @@ ohos_shared_library("arkuiuiextension_ani") { include_dirs = [ "//foundation/arkui/ace_engine/frameworks" ] sources = [ "../ani_utils.cpp", + "ani_uiextension_module.cpp", + "native_security_ui_extension.cpp", + "native_ui_extension_common.cpp", "native_ui_extension.cpp", ] external_deps = [ diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp new file mode 100644 index 00000000000..cf8e75e21dd --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2025 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 "../utils/ani_utils.h" +#include "base/log/log_wrapper.h" +#include "native_dynamic_module.h" +#include "native_security_ui_extension.h" +#include "native_ui_extension.h" +#include "native_ui_extension_common.h" + +ANI_EXPORT ani_status ANI_Constructor(ani_vm* vm, uint32_t* result) +{ + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "arkuiuiextension_ani ANI_Constructor start"); + ani_env* env; + if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "GetEnv failed when ANI_Constructor"); + return ANI_ERROR; + } + + auto ani_status = OHOS::Ace::Ani::NativeUiExtension::BindNativeUiExtension(env); + if (ani_status != ANI_OK) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "BindNativeUiExtension failed when ANI_Constructor"); + return ani_status; + } + + ani_status = OHOS::Ace::Ani::NativeUiExtension::BindNativeSecurityUiExtension(env); + if (ani_status != ANI_OK) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "BindNativeSecurityUiExtension failed when ANI_Constructor"); + return ani_status; + } + + ani_status = OHOS::Ace::Ani::NativeDynamicModule::BindNativeDynamicModule(env); + if (ani_status != ANI_OK) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "BindNativeDynamicModule failed when ANI_Constructor"); + return ani_status; + } + + ani_status = OHOS::Ace::Ani::NativeUiExtension::BindNativeUiExtensionCommon(env); + if (ani_status != ANI_OK) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "BindNativeUiExtensionCommon failed when ANI_Constructor"); + return ani_status; + } + + *result = ANI_VERSION_1; + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "arkuiuiextension_ani ANI_Constructor end"); + return ANI_OK; +} \ No newline at end of file -- Gitee From e067883ac28714a8f62aa81661dc67c5fffe7c22 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Sat, 2 Aug 2025 16:55:49 +0800 Subject: [PATCH 03/27] add native_security_ui_extension.cpp and native_security_ui_extension.h Signed-off-by: hanshu12138 --- feature.diff | 244 ++++++++++ .../native_security_ui_extension.cpp | 423 ++++++++++++++++++ .../native_security_ui_extension.h | 58 +++ 3 files changed, 725 insertions(+) create mode 100644 feature.diff create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h diff --git a/feature.diff b/feature.diff new file mode 100644 index 00000000000..59d15910116 --- /dev/null +++ b/feature.diff @@ -0,0 +1,244 @@ +diff --git a/frameworks/core/components_ng/property/BUILD.gn b/frameworks/core/components_ng/property/BUILD.gn +index fa6cf2c117ae0c7ae3e8c9d8b6e53a110290b9b5..1535de1e584af91841d2bd73ed2df9e881343cad 100644 +--- a/frameworks/core/components_ng/property/BUILD.gn ++++ b/frameworks/core/components_ng/property/BUILD.gn +@@ -17,6 +17,7 @@ import( + build_component_ng("property_ng") { + sources = [ + "accessibility_property.cpp", ++ "accessibility_property_mutilthread.cpp", + "border_property.cpp", + "calc_length.cpp", + "constraint_flags.cpp", +diff --git a/frameworks/core/components_ng/property/accessibility_property.cpp b/frameworks/core/components_ng/property/accessibility_property.cpp +index 33df0a3a36edfabb8b72347a217e8c0633f6de4e..32caee48fd64019955addd11495ca649f04cf595 100755 +--- a/frameworks/core/components_ng/property/accessibility_property.cpp ++++ b/frameworks/core/components_ng/property/accessibility_property.cpp +@@ -18,6 +18,7 @@ + #include "core/accessibility/accessibility_constants.h" + #include "core/components_ng/base/frame_node.h" + #include "core/pipeline_ng/pipeline_context.h" ++#include "frameworks/base/utils/multi_thread.h" + + namespace OHOS::Ace::NG { + constexpr uint64_t ACTIONS = std::numeric_limits::max(); +@@ -981,6 +982,8 @@ void AccessibilityProperty::SetAccessibilityGroup(bool accessibilityGroup) + return; + } + accessibilityGroup_ = accessibilityGroup; ++ auto frameNode = host_.Upgrade(); ++ FREE_NODE_CHECK(frameNode, SetAccessibilityGroup); + NotifyComponentChangeEvent(AccessibilityEventType::ELEMENT_INFO_CHANGE); + } + +@@ -1024,6 +1027,8 @@ void AccessibilityProperty::SetAccessibilityTextWithEvent(const std::string& tex + return; + } + accessibilityText_ = text; ++ auto frameNode = host_.Upgrade(); ++ FREE_NODE_CHECK(frameNode, SetAccessibilityTextWithEvent); + NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE); + } + +@@ -1047,6 +1052,8 @@ void AccessibilityProperty::SetAccessibilityDescriptionWithEvent(const std::stri + return; + } + accessibilityDescription_ = accessibilityDescription; ++ auto frameNode = host_.Upgrade(); ++ FREE_NODE_CHECK(frameNode, SetAccessibilityDescriptionWithEvent); + NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE); + } + +@@ -1106,7 +1113,8 @@ void AccessibilityProperty::SetAccessibilityLevel(const std::string& accessibili + } else { + accessibilityLevel_ = Level::AUTO; + } +- ++ auto frameNode = host_.Upgrade(); ++ FREE_NODE_CHECK(frameNode, SetAccessibilityLevel, backupLevel); + if (backupLevel != accessibilityLevel_.value_or("")) { + NotifyComponentChangeEvent(AccessibilityEventType::ELEMENT_INFO_CHANGE); + } +diff --git a/frameworks/core/components_ng/property/accessibility_property.h b/frameworks/core/components_ng/property/accessibility_property.h +index 02b1c9672ade51acfe84b5377ca588f964d45820..1accf5d997f5c35a1a5dc7d5c5ad38de91c84ea9 100644 +--- a/frameworks/core/components_ng/property/accessibility_property.h ++++ b/frameworks/core/components_ng/property/accessibility_property.h +@@ -697,6 +697,21 @@ private: + + static bool CheckHoverConsumeByComponent(const RefPtr& node, const NG::PointF& point); + ++ // the interface supports multithreading ++ void SetAccessibilityGroupMultiThread(); ++ ++ // the interface supports multithreading ++ void SetAccessibilityTextWithEventMultiThread(); ++ ++ // the interface supports multithreading ++ void SetAccessibilityDescriptionWithEventMultiThread(); ++ ++ // the interface supports multithreading ++ void SetAccessibilityLevelMultiThread(const std::string& backupLevel); ++ ++ // the interface supports multithreading ++ void NotifyComponentChangeEventMultiThread(AccessibilityEventType eventType); ++ + protected: + virtual void SetSpecificSupportAction() {} + std::optional propText_; +diff --git a/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp b/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp +new file mode 100644 +index 0000000000000000000000000000000000000000..7e6c9c336d45c2380425a1a2b0bafcfc7aecd826 +--- /dev/null ++++ b/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp +@@ -0,0 +1,55 @@ ++/* ++ * Copyright (c) 2025 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 "core/components_ng/property/accessibility_property.h" ++ ++#include "core/accessibility/accessibility_constants.h" ++#include "core/components_ng/base/frame_node.h" ++#include "core/pipeline_ng/pipeline_context.h" ++ ++namespace OHOS::Ace::NG { ++void AccessibilityProperty::SetAccessibilityGroupMultiThread() ++{ ++ NotifyComponentChangeEventMultiThread(AccessibilityEventType::ELEMENT_INFO_CHANGE); ++} ++ ++void AccessibilityProperty::SetAccessibilityTextWithEventMultiThread() ++{ ++ NotifyComponentChangeEventMultiThread(AccessibilityEventType::TEXT_CHANGE); ++} ++ ++void AccessibilityProperty::SetAccessibilityDescriptionWithEventMultiThread() ++{ ++ NotifyComponentChangeEventMultiThread(AccessibilityEventType::TEXT_CHANGE); ++} ++ ++void AccessibilityProperty::SetAccessibilityLevelMultiThread(const std::string& backupLevel) ++{ ++ if (backupLevel != accessibilityLevel_.value_or("")) { ++ NotifyComponentChangeEventMultiThread(AccessibilityEventType::ELEMENT_INFO_CHANGE); ++ } ++} ++ ++void AccessibilityProperty::NotifyComponentChangeEventMultiThread(AccessibilityEventType eventType) ++{ ++ auto frameNode = host_.Upgrade(); ++ CHECK_NULL_VOID(frameNode); ++ frameNode->PostAfterAttachMainTreeTask([weak = WeakClaim(this), eventType]() { ++ auto host = weak.Upgrade(); ++ CHECK_NULL_VOID(host); ++ host->NotifyComponentChangeEvent(eventType); ++ }); ++} ++} // namespace OHOS::Ace::NG +diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn +index 11ad0a4c22be018548429f6dbd4a8c7db226ce92..46a91e39888622db1d1beaf3df6a731022fc9b20 100644 +--- a/test/unittest/BUILD.gn ++++ b/test/unittest/BUILD.gn +@@ -394,6 +394,7 @@ ohos_source_set("ace_components_property") { + part_name = ace_engine_part + sources = [ + "$ace_root/frameworks/core/components_ng/property/accessibility_property.cpp", ++ "$ace_root/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp", + "$ace_root/frameworks/core/components_ng/property/border_property.cpp", + "$ace_root/frameworks/core/components_ng/property/calc_length.cpp", + "$ace_root/frameworks/core/components_ng/property/constraint_flags.cpp", +diff --git a/test/unittest/core/property/accessibility_property_test_three_ng.cpp b/test/unittest/core/property/accessibility_property_test_three_ng.cpp +index e6b2d07740e0580f4b3f1f95e303efe31f35a8c9..ef59d5d4ac4ad2a45b79ceec4e30975e44fe034d 100644 +--- a/test/unittest/core/property/accessibility_property_test_three_ng.cpp ++++ b/test/unittest/core/property/accessibility_property_test_three_ng.cpp +@@ -32,11 +32,16 @@ + #include "core/components_ng/property/accessibility_property.h" + #include "core/components_v2/inspector/inspector_constants.h" + #include "core/components_ng/base/view_abstract_model_ng.h" ++#include "frameworks/base/utils/multi_thread.h" + + using namespace testing; + using namespace testing::ext; + + namespace OHOS::Ace::NG { ++namespace { ++const std::string TEST_TEXT = "test text"; ++} // namespace ++ + class MockPattern : public Pattern { + public: + MockPattern() = default; +@@ -283,4 +288,62 @@ HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree011, Te + ret = accessibilityProperty.HoverTestRecursive(parentPoint, node, path, debugInfo, ancestorGroupFlag); + EXPECT_FALSE(ret); + } ++ ++/** ++ * @tc.name: AccessibilityPropertyTest012 ++ * @tc.desc: Test the method SetAccessibilityGroup. ++ * @tc.type: FUNC ++ */ ++HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree012, TestSize.Level1) ++{ ++ AccessibilityProperty accessibilityProperty; ++ EXPECT_FALSE(accessibilityProperty.accessibilityGroup_); ++ WeakPtr hostBak = accessibilityProperty.host_; ++ bool accessibilityGroup = true; ++ accessibilityProperty.SetAccessibilityGroup(accessibilityGroup); ++ EXPECT_TRUE(accessibilityProperty.accessibilityGroup_); ++} ++ ++/** ++ * @tc.name: AccessibilityPropertyTest013 ++ * @tc.desc: Test the method SetAccessibilityTextWithEvent. ++ * @tc.type: FUNC ++ */ ++HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree013, TestSize.Level1) ++{ ++ AccessibilityProperty accessibilityProperty; ++ EXPECT_FALSE(accessibilityProperty.accessibilityText_.has_value()); ++ WeakPtr hostBak = accessibilityProperty.host_; ++ accessibilityProperty.SetAccessibilityTextWithEvent(TEST_TEXT); ++ EXPECT_EQ(accessibilityProperty.accessibilityText_.value_or(""), TEST_TEXT); ++} ++ ++/** ++ * @tc.name: AccessibilityPropertyTest014 ++ * @tc.desc: Test the method SetAccessibilityDescriptionWithEvent. ++ * @tc.type: FUNC ++ */ ++HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree014, TestSize.Level1) ++{ ++ AccessibilityProperty accessibilityProperty; ++ EXPECT_FALSE(accessibilityProperty.accessibilityDescription_.has_value()); ++ WeakPtr hostBak = accessibilityProperty.host_; ++ accessibilityProperty.SetAccessibilityDescriptionWithEvent(TEST_TEXT); ++ EXPECT_EQ(accessibilityProperty.accessibilityDescription_.value_or(""), TEST_TEXT); ++} ++ ++/** ++ * @tc.name: AccessibilityPropertyTest015 ++ * @tc.desc: Test the method SetAccessibilityLevel. ++ * @tc.type: FUNC ++ */ ++HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree015, TestSize.Level1) ++{ ++ AccessibilityProperty accessibilityProperty; ++ EXPECT_FALSE(accessibilityProperty.accessibilityLevel_.has_value()); ++ WeakPtr hostBak = accessibilityProperty.host_; ++ std::string accessibilityLevel = "auto"; ++ accessibilityProperty.SetAccessibilityLevel(accessibilityLevel); ++ EXPECT_EQ(accessibilityProperty.accessibilityLevel_.value_or(""), accessibilityLevel); ++} + } // namespace OHOS::Ace::NG diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp new file mode 100644 index 00000000000..5aeb4a0f36a --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -0,0 +1,423 @@ +/* + * Copyright (c) 2025 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_security_ui_extension.h" + +#include "ani_callback_info.h" +#include "ani_common_want.h" +#include "../utils/ani_utils.h" +#include "base/log/log_wrapper.h" +#ifdef WINDOW_SCENE_SUPPORTED +#include "core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h" +#include "core/interfaces/native/implementation/frame_node_peer_impl.h" +#include "core/interfaces/native/implementation/ui_extension_proxy_peer.h" +#include "frameworks/core/interfaces/native/implementation/ui_extension_proxy_peer_base.h" +#endif //WINDOW_SCENE_SUPPORTED +#include "want.h" + +namesapce OHOS::Ace::Ani { +namespace { +constexpr int32_t FOLLOW_HOST_DPI = 0; +const char UI_EXTENSION_PLACEHOLDER_TYPE_INITIAL[] = "initPlaceholder"; +const char UI_EXTENSION_PLACEHOLDER_TYPE_UNDEFINED[] = "undefinedPlaceholder"; +const char UI_EXTENSION_PLACEHOLDER_TYPE_ROTATION[] = "rotationPlaceholder"; +const char UI_EXTENSION_PLACEHOLDER_TYPE_FOLD_TO_EXPAND[] = "flodPlaceholder"; +} +ani_status NativeSecurityUiExtension::BindNativeSecurityUiExtension(ani_env *env) +{ + ani_status ret = BindNativeSecurityUiExtensionComponent(env); + if (ret != ANI_OK) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "BindNativeSecurityUiExtensionComponent failed"); + return ret; + } + + return ANI_OK; +} + +ani_status NativeSecurityUiExtension::BindNativeSecurityUiExtensionComponent(ani_env *env) +{ + ani_class cls; + static const char *className = + "Larkui/ani/arkts/ui_extension/ArkUIAniUiextensionModal/ArkUIAniSecurityUiextensionModal;"; + auto ani_status = env->FindClass(className, &cls); + if (ani_status != ANI_OK) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "BindNativeSecurityUiExtensionComponent FindClass failed, className: %{public}s", className); + return ANI_ERROR; + } + + std::array methods = { + ani_native_function { + "_SecurityUiextension_Set_Option", + nullptr, reinterpret_cast(SetSecurityUiextensionOption)}, + ani_native_function { + "_SecurityUiextension_Set_Want", + nullptr, reinterpret_cast(SetSecurityUiextensionWant)}, + ani_native_function { + "_SecurityUiextension_Set_OnResultCallback", + nullptr, reinterpret_cast(SetSecurityOnResult)}, + ani_native_function { + "_SecurityUiextension_Set_OnErrorCallback", + nullptr, reinterpret_cast(SetSecurityOnError)}, + ani_native_function { + "_SecurityUiextension_Set_OnReciveCallback", + nullptr, reinterpret_cast(SetSecurityOnRecive)}, + ani_native_function { + "_SecurityUiextension_Set_OnTermitationCallback", + nullptr, reinterpret_cast(SetSecurityOnTermitate)}, + ani_native_function { + "_SecurityUiextension_Set_OnReleaseCallback", + nullptr, reinterpret_cast(SetSecurityOnRelease)}, + ani_native_function { + "_SecurityUiextension_Set_OnDrawReadyCallback", + nullptr, reinterpret_cast(SetSecurityOnDrawReady)}, + }; + + if (ANI_OK != env->Class_BindNativeMethods(cls, methods.data(), methods.size())) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "BindNativeSecurityUiExtensionComponent Class_BindNativeMethods failed," + " className: %{public}s", className); + return ANI_ERROR; + } + return ANI_OK; +} + +ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj) +{ + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityUiextensionOption start"); + auto frameNode = reinterpret_cast(pointer); + if (frameNode == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "frameNode is null when SetSecurityUiextensionOption"); + return ANI_ERROR; + } + + std::string optionClassName = + "Larkui/ani/arkts/ui_extension/ArkUIAniUiextensionModal/ArkUIAniUIExtensionOptions;"; + if (!AniUtils::CheckType(env, obj, optionClassName)) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "CheckType %{public}s failed when SetSecurityUiextensionOption", + optionClassName.c_str()); + return ANI_ERROR; + } + + bool isTransferringCaller = AniUtils::GetBoolOrUndefined(env, obj, "isTransferringCaller"); + bool isWindowModelFollowHost = AniUtils::GetBoolOrUndefined(env, obj, "isWindowModelFollowHost"); + int32_t dpiFollowStrategy = -1; + if (!AniUtils::GetIntByName(env, obj, "dpiFollowStrategy", dpiFollowStrategy)) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "Get dpiFollowStrategy failed when SetSecurityUiextensionOption"); + return ANI_ERROR; + } + std::map> placeholderMap; + + static const std::map placeholderTypeTable = { + { UI_EXTENSION_PLACEHOLDER_TYPE_INITIAL, NG::PlaceholderType::INITIAL }, + { UI_EXTENSION_PLACEHOLDER_TYPE_UNDEFINED, NG::PlaceholderType::UNDEFINED }, + { UI_EXTENSION_PLACEHOLDER_TYPE_ROTATION, NG::PlaceholderType::ROTATION }, + { UI_EXTENSION_PLACEHOLDER_TYPE_FOLD_TO_EXPAND, NG::PlaceholderType::FOLD_TO_EXPAND } + }; + for (auto [strName, type] : placeholderTypeTable) { + ani_long placeholder; + if (ANI_OK != env->Object_GetFieldByName_Long(obj, strName.c_str(), &placeholder)) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "Get placeholder failed."); + continue; + } + auto* frameNodePeerRaw = reinterpret_cast(placeholder); + if (frameNodePeerRaw == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "Get frameNodePeer failed."); + continue; + } + auto nodeWeak = frameNodePeerRaw->weakNode; + auto upgradePtr = nodeWeak.Upgrade(); + if (!upgradePtr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "Get frameNode RefPtr failed."); + continue; + } + placeholderMap.insert({type, upgradePtr}); + } + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "SetSecurityUiextensionOption isTransferringCaller: %{public}d, dpiFollowStrategy: %{public}d," + "isWindowModeFollowHost: %{public}d, placeholderMap size: %{public}d", + isTransferringCaller, dpiFollowStrategy, isWindowModelFollowHost, static_cast(placeholderMap.size())); +#ifdef WINDOW_SCENE_SUPPORTED + bool densityDpi = (dpiFollowStrategy == FOLLOW_HOST_DPI) ? true : false; + NG::SecurityUIExtensionStatic::UpdateSecurityUecConfig( + frameNode, isTransferringCaller, densityDpi, isWindowModelFollowHost, placeholderMap); +#endif + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityUiextensionOption end"); + return ANI_OK; +} + + +static ani_status SetSecurityUiExtensionWant( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj) +{ + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityUiextensionWant start"); + auto frameNode = reinterpret_cast(pointer); + if (frameNode == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "frameNode is null when SetSecurityUiExtensionWant"); + return ANI_ERROR; + } + + std::string wantClassName = + "L@ohos/app/ability/Want/Want;"; + if (!AniUtils::CheckType(env, obj, wantClassName)) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "CheckType failed when SetUiextensionWant"); + return ANI_ERROR; + } + + OHOS::AAFwk::Want want; + bool ret = OHOS::AppExecFwk::UnwrapWant(env, obj, want); + if (!ret) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "UnwrapWant failed when SetSecurityUiextensionWant"); + return ANI_ERROR; + } +#ifdef WINDOW_SCENE_SUPPORTED + NG::SecurityUIExtensionStatic::UpdateSecurityWant(frameNode, want); +#endif //WINDOW_SCENE_SUPPORTED +TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityUiextensionWant end"); + return ANI_OK; +} + +static ani_status SetSecurityOnError( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) +{ + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnError start"); + auto frameNode = reinterpret_cast(pointer); + if (frameNode == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "frameNode is null when SetSecurityOnError"); + return ANI_ERROR; + } + + ani_ref onErrorRef = reinterpret_cast(callbackObj); + ani_ref onErrorGlobalref; + env->GlobalReference_Create(onErrorRef, &onErrorGlobalref); + ani_vm* vm = nullptr; + env->GetVM(&vm); + auto onErrorAniReadyCallbackInfo = std::make_shared(vm, onErrorGlobalRef); + auto onErrorCallback = [onErrorAniReadyCallbackInfo] ( + int32_t code, const std::string& name, const std::string& message) { + if (onErrorAniReadyCallbackInfo == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "onErrorAniReadyCallbackInfo is nullptr"); + return; + } + + ani_ref onErrorGlobalRef = onErrorAniReadyCallbackInfo->GetOnGlobalRef(); + ani_env* env = onErrorAniReadyCallbackInfo->GetEnvRef(); + if (onErrorGlobalRef == nullptr || env == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "onErrorGlobalRef or env is nullptr"); + return; + } + + auto fnObj = reinterpret_cast(onErrorGlobalRef); + auto codeArgs = AniUtils::CreateDouble(env, code); // TODO : Change to CreateInt + if (codeArgs == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "CreateDouble failed when onErrorCallback"); + return; + } + + ani_string nameArgs; + env->String_NewUTF8(name.c_str(), name.size(), &nameArgs); + ani_string messageArgs; + env->String_NewUTF8(message.c_str(), message.size(), &messageArgs); + + ani_ref result; + std::vector tmp = { + reinterpret_cast(codeArgs), + reinterpret_cast(nameArgs), + reinterpret_cast(messageArgs) + }; + env->FunctionalObject_Call(fnObj, tmp.size(), tmp.data(), &result); + }; + +#ifdef WINDOW_SCENE_SUPPORTED + NG::SecurityUIExtensionStatic::SetSecurityOnError(frameNode, std::move(onErrorCallback)); +#endif //WINDOW_SCENE_SUPPORTED + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnError end"); + return ANI_OK; +} + +static ani_status SetSecurityOnRecive( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) +{ + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnRecive start"); + auto frameNode = reinterpret_cast(pointer); + if (frameNode == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "frameNode is null when SetSecurityOnRecive"); + return ANI_ERROR; + } + + ani_ref onReciveRef = reinterpret_cast(callbackObj); + ani_ref onReciveGolbalRef; + env->GlobalReference_Create(onReciveRef, &onReciveGolbalRef); + ani_vm* vm = nullptr; + env->GetVM(&vm); + auto onReciveAniReadyCallbackInfo = std::make_shared(vm, onReciveGlobalRef); + auto onReciveCallback = [onReciveAniReadyCallbackInfo] (const AAFwk::WantParams& params) { + if (onReciveAniReadyCallbackInfo == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "onReciveAniReadyCallbackInfo is nullptr"); + return; + } + + ani_ref onReciveGlobalRef = onReciveAniReadyCallbackInfo->GetOnGlobalRef(); + ani_env* env = onReciveAniReadyCallbackInfo->GetEnvRef(); + if (onReciveGlobalRef == nullptr || env == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "onReciveGlobalRef or env is nullptr"); + return; + } + + auto fnObj = reinterpret_cast(onReciveGlobalRef); + auto wantparamArgs = OHOS::AppExecFwk::WrapWantParams(env, params); + if (wantparamArgs == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "WrapWantParams failed when onReciveCallback"); + return; + } + + ani_ref result; + std::vector tmp = { + reinterpret_cast(wantparamArgs) + }; + env->FunctionalObject_Call(fnObj, tmp.size(), tmp.data(), &result); + }; + +#ifdef WINDOW_SCENE_SUPPRTED + NG::SecurityUIExtensionStatic::SetSecurityOnReceive(frameNode, std::move(onReciveCallback)); +#endif //WINDOW_SCENE_SUPPRTED + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnRecive end"); + return ANI_OK; +} + +static ani_status SetSecurityOnTerminate( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) +{ + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnTerminate start"); + auto frameNode = reinterpret_cast(pointer); + if (frameNode == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "frameNode is null when SetSecurityOnTerminate"); + return ANI_ERROR; + } + + ani_ref onTerminateRef = reinterpret_cast(callbackObj); + ani_ref onTerminateGolbalRef; + env->GlobalReference_Create(onTerminateRef, &onTerminateGolbalRef); + ani_vm* vm = nullptr; + env->GetVM(&vm); + auto onTerminateAniReadyCallbackInfo = std::make_shared(vm, onTerminateGolbalRef); + auto onTerminateCallback = + [env, onTerminateAniReadyCallbackInfo] (int32_t code, const RefPtr& wantWrap) { + if (onTerminateAniReadyCallbackInfo == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "onTerminateAniReadyCallbackInfo is nullptr"); + return; + } + + ani_ref onTerminateGlobalRef = onTerminateAniReadyCallbackInfo->GetOnGlobalRef(); + ani_env* env = onTerminateAniReadyCallbackInfo->GetEnvRef(); + if (onTerminateGlobalRef == nullptr || env == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "onTerminateGlobalRef or env is nullptr"); + return; + } + + AAAFwk::Want want; + if (wantWrap) { + want = wantWrap->GetWant(); + } + auto fnObj = reinterpret_cast(onTerminateGlobalRef); + auto codeArgs = AniUtils::CreateDouble(env, code); + if (codeArgs == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "CreateDouble failed when onTerminateCallback"); + return; + } + auto wantArgs = OHOS::AppExecFwk::WrapWant(env, want); + if (wantArgs == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "WrapWant failed when onTerminateCallback"); + return; + } + + ani_ref result; + std::vector tmp = + { reinterpret_cast(codeArgs), reinterpret_cast(wantArgs)}; + env->FunctionalObject_Call(fnObj, tmp.size(), tmp.data(), &result); + }; +#ifdef WINDOW_SCENE_SUPPORTED + NG::SecurityUIExtensionStatic::SetSecurityOnTerminated(frameNode, std::move(onTerminateCallback)); +#endif //WINDOW_SCENE_SUPPORTED + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnTerminate end"); + return ANI_OK; +} + + + +static ani_status SetSecurityOnRelease( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) +{ + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnRelease not supported now."); + return ANI_OK; +} + +static ani_status SetSecurityOnDrawReady( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) +{ + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityOnDrawReady not supported now."); + return ANI_OK; +} + +static ani_status SetSecurityOnResult( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) +{ + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurity OnResult not supported now."); + return ANI_OK; +} + +} // namespace OHOS::Ace::Ani \ No newline at end of file diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h new file mode 100644 index 00000000000..cad9b2c0f06 --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 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 KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_SECURITY_UI_EXTENSION +#define KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_SECURITY_UI_EXTENSION + +#include "ani.h" + +#include + +namespace OHOS::Ace::Ani { +class NativeSecurityUiExtension { +public: + static ani_status BindNativeSecurityUiExtension(ani_env *env); + static ani_status BindNativeSecurityUiExtensionComponent(ani_env *env); + +private: + // SecurityUiExtensionModal + static ani_status SetSecurityUiExtensionOption( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj); + static ani_status SetSecurityUiExtensionWant( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj); + static ani_status SetSecurityOnResult( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); + static ani_status SetSecurityOnError( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); + static ani_status SetSecurityOnReceive( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); + static ani_status SetSecurityOnTerminate( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); + static ani_status SetSecurityOnRelease( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); + static ani_status SetSecurityOnDrawReady( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); +} +} + +#endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_SECURITY_UI_EXTENSION \ No newline at end of file -- Gitee From d1faa54300a336f6784d4d1fefeeffd451a8df88 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Sat, 2 Aug 2025 16:58:15 +0800 Subject: [PATCH 04/27] del diff Signed-off-by: hanshu12138 --- feature.diff | 244 --------------------------------------------------- 1 file changed, 244 deletions(-) delete mode 100644 feature.diff diff --git a/feature.diff b/feature.diff deleted file mode 100644 index 59d15910116..00000000000 --- a/feature.diff +++ /dev/null @@ -1,244 +0,0 @@ -diff --git a/frameworks/core/components_ng/property/BUILD.gn b/frameworks/core/components_ng/property/BUILD.gn -index fa6cf2c117ae0c7ae3e8c9d8b6e53a110290b9b5..1535de1e584af91841d2bd73ed2df9e881343cad 100644 ---- a/frameworks/core/components_ng/property/BUILD.gn -+++ b/frameworks/core/components_ng/property/BUILD.gn -@@ -17,6 +17,7 @@ import( - build_component_ng("property_ng") { - sources = [ - "accessibility_property.cpp", -+ "accessibility_property_mutilthread.cpp", - "border_property.cpp", - "calc_length.cpp", - "constraint_flags.cpp", -diff --git a/frameworks/core/components_ng/property/accessibility_property.cpp b/frameworks/core/components_ng/property/accessibility_property.cpp -index 33df0a3a36edfabb8b72347a217e8c0633f6de4e..32caee48fd64019955addd11495ca649f04cf595 100755 ---- a/frameworks/core/components_ng/property/accessibility_property.cpp -+++ b/frameworks/core/components_ng/property/accessibility_property.cpp -@@ -18,6 +18,7 @@ - #include "core/accessibility/accessibility_constants.h" - #include "core/components_ng/base/frame_node.h" - #include "core/pipeline_ng/pipeline_context.h" -+#include "frameworks/base/utils/multi_thread.h" - - namespace OHOS::Ace::NG { - constexpr uint64_t ACTIONS = std::numeric_limits::max(); -@@ -981,6 +982,8 @@ void AccessibilityProperty::SetAccessibilityGroup(bool accessibilityGroup) - return; - } - accessibilityGroup_ = accessibilityGroup; -+ auto frameNode = host_.Upgrade(); -+ FREE_NODE_CHECK(frameNode, SetAccessibilityGroup); - NotifyComponentChangeEvent(AccessibilityEventType::ELEMENT_INFO_CHANGE); - } - -@@ -1024,6 +1027,8 @@ void AccessibilityProperty::SetAccessibilityTextWithEvent(const std::string& tex - return; - } - accessibilityText_ = text; -+ auto frameNode = host_.Upgrade(); -+ FREE_NODE_CHECK(frameNode, SetAccessibilityTextWithEvent); - NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE); - } - -@@ -1047,6 +1052,8 @@ void AccessibilityProperty::SetAccessibilityDescriptionWithEvent(const std::stri - return; - } - accessibilityDescription_ = accessibilityDescription; -+ auto frameNode = host_.Upgrade(); -+ FREE_NODE_CHECK(frameNode, SetAccessibilityDescriptionWithEvent); - NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE); - } - -@@ -1106,7 +1113,8 @@ void AccessibilityProperty::SetAccessibilityLevel(const std::string& accessibili - } else { - accessibilityLevel_ = Level::AUTO; - } -- -+ auto frameNode = host_.Upgrade(); -+ FREE_NODE_CHECK(frameNode, SetAccessibilityLevel, backupLevel); - if (backupLevel != accessibilityLevel_.value_or("")) { - NotifyComponentChangeEvent(AccessibilityEventType::ELEMENT_INFO_CHANGE); - } -diff --git a/frameworks/core/components_ng/property/accessibility_property.h b/frameworks/core/components_ng/property/accessibility_property.h -index 02b1c9672ade51acfe84b5377ca588f964d45820..1accf5d997f5c35a1a5dc7d5c5ad38de91c84ea9 100644 ---- a/frameworks/core/components_ng/property/accessibility_property.h -+++ b/frameworks/core/components_ng/property/accessibility_property.h -@@ -697,6 +697,21 @@ private: - - static bool CheckHoverConsumeByComponent(const RefPtr& node, const NG::PointF& point); - -+ // the interface supports multithreading -+ void SetAccessibilityGroupMultiThread(); -+ -+ // the interface supports multithreading -+ void SetAccessibilityTextWithEventMultiThread(); -+ -+ // the interface supports multithreading -+ void SetAccessibilityDescriptionWithEventMultiThread(); -+ -+ // the interface supports multithreading -+ void SetAccessibilityLevelMultiThread(const std::string& backupLevel); -+ -+ // the interface supports multithreading -+ void NotifyComponentChangeEventMultiThread(AccessibilityEventType eventType); -+ - protected: - virtual void SetSpecificSupportAction() {} - std::optional propText_; -diff --git a/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp b/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp -new file mode 100644 -index 0000000000000000000000000000000000000000..7e6c9c336d45c2380425a1a2b0bafcfc7aecd826 ---- /dev/null -+++ b/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp -@@ -0,0 +1,55 @@ -+/* -+ * Copyright (c) 2025 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 "core/components_ng/property/accessibility_property.h" -+ -+#include "core/accessibility/accessibility_constants.h" -+#include "core/components_ng/base/frame_node.h" -+#include "core/pipeline_ng/pipeline_context.h" -+ -+namespace OHOS::Ace::NG { -+void AccessibilityProperty::SetAccessibilityGroupMultiThread() -+{ -+ NotifyComponentChangeEventMultiThread(AccessibilityEventType::ELEMENT_INFO_CHANGE); -+} -+ -+void AccessibilityProperty::SetAccessibilityTextWithEventMultiThread() -+{ -+ NotifyComponentChangeEventMultiThread(AccessibilityEventType::TEXT_CHANGE); -+} -+ -+void AccessibilityProperty::SetAccessibilityDescriptionWithEventMultiThread() -+{ -+ NotifyComponentChangeEventMultiThread(AccessibilityEventType::TEXT_CHANGE); -+} -+ -+void AccessibilityProperty::SetAccessibilityLevelMultiThread(const std::string& backupLevel) -+{ -+ if (backupLevel != accessibilityLevel_.value_or("")) { -+ NotifyComponentChangeEventMultiThread(AccessibilityEventType::ELEMENT_INFO_CHANGE); -+ } -+} -+ -+void AccessibilityProperty::NotifyComponentChangeEventMultiThread(AccessibilityEventType eventType) -+{ -+ auto frameNode = host_.Upgrade(); -+ CHECK_NULL_VOID(frameNode); -+ frameNode->PostAfterAttachMainTreeTask([weak = WeakClaim(this), eventType]() { -+ auto host = weak.Upgrade(); -+ CHECK_NULL_VOID(host); -+ host->NotifyComponentChangeEvent(eventType); -+ }); -+} -+} // namespace OHOS::Ace::NG -diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn -index 11ad0a4c22be018548429f6dbd4a8c7db226ce92..46a91e39888622db1d1beaf3df6a731022fc9b20 100644 ---- a/test/unittest/BUILD.gn -+++ b/test/unittest/BUILD.gn -@@ -394,6 +394,7 @@ ohos_source_set("ace_components_property") { - part_name = ace_engine_part - sources = [ - "$ace_root/frameworks/core/components_ng/property/accessibility_property.cpp", -+ "$ace_root/frameworks/core/components_ng/property/accessibility_property_mutilthread.cpp", - "$ace_root/frameworks/core/components_ng/property/border_property.cpp", - "$ace_root/frameworks/core/components_ng/property/calc_length.cpp", - "$ace_root/frameworks/core/components_ng/property/constraint_flags.cpp", -diff --git a/test/unittest/core/property/accessibility_property_test_three_ng.cpp b/test/unittest/core/property/accessibility_property_test_three_ng.cpp -index e6b2d07740e0580f4b3f1f95e303efe31f35a8c9..ef59d5d4ac4ad2a45b79ceec4e30975e44fe034d 100644 ---- a/test/unittest/core/property/accessibility_property_test_three_ng.cpp -+++ b/test/unittest/core/property/accessibility_property_test_three_ng.cpp -@@ -32,11 +32,16 @@ - #include "core/components_ng/property/accessibility_property.h" - #include "core/components_v2/inspector/inspector_constants.h" - #include "core/components_ng/base/view_abstract_model_ng.h" -+#include "frameworks/base/utils/multi_thread.h" - - using namespace testing; - using namespace testing::ext; - - namespace OHOS::Ace::NG { -+namespace { -+const std::string TEST_TEXT = "test text"; -+} // namespace -+ - class MockPattern : public Pattern { - public: - MockPattern() = default; -@@ -283,4 +288,62 @@ HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree011, Te - ret = accessibilityProperty.HoverTestRecursive(parentPoint, node, path, debugInfo, ancestorGroupFlag); - EXPECT_FALSE(ret); - } -+ -+/** -+ * @tc.name: AccessibilityPropertyTest012 -+ * @tc.desc: Test the method SetAccessibilityGroup. -+ * @tc.type: FUNC -+ */ -+HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree012, TestSize.Level1) -+{ -+ AccessibilityProperty accessibilityProperty; -+ EXPECT_FALSE(accessibilityProperty.accessibilityGroup_); -+ WeakPtr hostBak = accessibilityProperty.host_; -+ bool accessibilityGroup = true; -+ accessibilityProperty.SetAccessibilityGroup(accessibilityGroup); -+ EXPECT_TRUE(accessibilityProperty.accessibilityGroup_); -+} -+ -+/** -+ * @tc.name: AccessibilityPropertyTest013 -+ * @tc.desc: Test the method SetAccessibilityTextWithEvent. -+ * @tc.type: FUNC -+ */ -+HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree013, TestSize.Level1) -+{ -+ AccessibilityProperty accessibilityProperty; -+ EXPECT_FALSE(accessibilityProperty.accessibilityText_.has_value()); -+ WeakPtr hostBak = accessibilityProperty.host_; -+ accessibilityProperty.SetAccessibilityTextWithEvent(TEST_TEXT); -+ EXPECT_EQ(accessibilityProperty.accessibilityText_.value_or(""), TEST_TEXT); -+} -+ -+/** -+ * @tc.name: AccessibilityPropertyTest014 -+ * @tc.desc: Test the method SetAccessibilityDescriptionWithEvent. -+ * @tc.type: FUNC -+ */ -+HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree014, TestSize.Level1) -+{ -+ AccessibilityProperty accessibilityProperty; -+ EXPECT_FALSE(accessibilityProperty.accessibilityDescription_.has_value()); -+ WeakPtr hostBak = accessibilityProperty.host_; -+ accessibilityProperty.SetAccessibilityDescriptionWithEvent(TEST_TEXT); -+ EXPECT_EQ(accessibilityProperty.accessibilityDescription_.value_or(""), TEST_TEXT); -+} -+ -+/** -+ * @tc.name: AccessibilityPropertyTest015 -+ * @tc.desc: Test the method SetAccessibilityLevel. -+ * @tc.type: FUNC -+ */ -+HWTEST_F(AccessibilityPropertyTestThreeNg, AccessibilityPropertyTestThree015, TestSize.Level1) -+{ -+ AccessibilityProperty accessibilityProperty; -+ EXPECT_FALSE(accessibilityProperty.accessibilityLevel_.has_value()); -+ WeakPtr hostBak = accessibilityProperty.host_; -+ std::string accessibilityLevel = "auto"; -+ accessibilityProperty.SetAccessibilityLevel(accessibilityLevel); -+ EXPECT_EQ(accessibilityProperty.accessibilityLevel_.value_or(""), accessibilityLevel); -+} - } // namespace OHOS::Ace::NG -- Gitee From 59a837582a357f284975db6ea4f95ddd02280cc4 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Sat, 2 Aug 2025 17:12:26 +0800 Subject: [PATCH 05/27] modify native_ui_extension.cpp native_ui_extension.h Signed-off-by: hanshu12138 --- .../src/ani/native/ui_extension/native_ui_extension.cpp | 1 + .../src/ani/native/ui_extension/native_ui_extension.h | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp index ea308b3f72f..74f8394bb18 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp @@ -20,6 +20,7 @@ // #include "base/log/log_wrapper.h" // #ifdef WINDOW_SCENE_SUPPORTED // #include "core/components_ng/pattern/ui_extension/ui_extension_component/ui_extension_model_adapter.h" +#include "core/components_ng/pattern/ui_extension/ui_extension_component/ui_extension_model_static.h" // #include "core/interfaces/native/implementation/ui_extension_proxy_peer.h" // #include "frameworks/core/interfaces/native/implementation/ui_extension_proxy_peer_base.h" // #endif //WINDOW_SCENE_SUPPORTED diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h index 027047fa636..4879d79bb5a 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h @@ -25,7 +25,6 @@ class NativeUiExtension { public: static ani_status BindNativeUiExtension(ani_env *env); static ani_status BindNativeUiExtensionComponent(ani_env *env); - static ani_status BindNativeUiExtensionProxy(ani_env *env); private: // UiExtensionModal @@ -50,13 +49,6 @@ private: static ani_status SetOnRelease( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); - // UiExtensionProxy - static ani_status SendData( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); - static ani_object SendDataSync( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); }; } // namespace OHOS::Ace::Ani -- Gitee From e0cfa9bfa1e0526dc538ed7ee12bc3461341434f Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Mon, 4 Aug 2025 14:39:13 +0800 Subject: [PATCH 06/27] add native_ui_extension_common Signed-off-by: hanshu12138 --- .../native_security_ui_extension.cpp | 14 +- .../native_ui_extension_common.cpp | 128 ++++++++++++++++++ .../ui_extension/native_ui_extension_common.h | 40 ++++++ 3 files changed, 175 insertions(+), 7 deletions(-) create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index 5aeb4a0f36a..a458ac7d59d 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -167,7 +167,7 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( } -static ani_status SetSecurityUiExtensionWant( +static ani_status NativeSecurityUiExtension::SetSecurityUiExtensionWant( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj) { @@ -203,7 +203,7 @@ TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, return ANI_OK; } -static ani_status SetSecurityOnError( +static ani_status NativeSecurityUiExtension::SetSecurityOnError( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -268,7 +268,7 @@ static ani_status SetSecurityOnError( return ANI_OK; } -static ani_status SetSecurityOnRecive( +static ani_status NativeSecurityUiExtension::SetSecurityOnRecive( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -325,7 +325,7 @@ static ani_status SetSecurityOnRecive( return ANI_OK; } -static ani_status SetSecurityOnTerminate( +static ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -393,7 +393,7 @@ static ani_status SetSecurityOnTerminate( -static ani_status SetSecurityOnRelease( +static ani_status NativeSecurityUiExtension::SetSecurityOnRelease( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -402,7 +402,7 @@ static ani_status SetSecurityOnRelease( return ANI_OK; } -static ani_status SetSecurityOnDrawReady( +static ani_status NativeSecurityUiExtension::SetSecurityOnDrawReady( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -411,7 +411,7 @@ static ani_status SetSecurityOnDrawReady( return ANI_OK; } -static ani_status SetSecurityOnResult( +static ani_status NativeSecurityUiExtension::SetSecurityOnResult( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp new file mode 100644 index 00000000000..d992bbc23ca --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2025 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_ui_extension_common.h" + +#include "ani_callback_info.h" +#include "ani_common_want.h" +#include "../utils/ani_utils.h" +#include "base/log/log_wrapper.h" +#ifdef WINDOWSCENE_SUPPORTED +#include "core/components_ng/pattern/ui_extension/ui_extension_component/ui_extension_model_static.h" +#include "core/interfaces/native/implementation/frame_node_peer_impl.h" +#include "core/interfaces/native/implementation/ui_extension_proxy_peer.h" +#include "frameworks/core/interfaces/native/implementation/ui_extension_proxy_peer_base.h" +#endif //WINDOWSCENE_SUPPORTED +#include "want.h" + +namespace OHOS::Ace::Ani { + + +ani_status NativeUiExtensionCommon::BindNativeUiExtensionCommon(ani_env *env) +{ + ani_status ret = BindNativeUiExtensionProxy(env); + if (ret != ANI_OK) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "BindNativeUiExtensionCommon failed"); + return ret; + } + + return ANI_OK; +} + +ani_status NativeUiExtensionCommon::BindNativeUiExtensionProxy(ani_env *env) +{ + static const char *className = + "Larkui/ani/arkts/ui_extension/ArkUIAniUiextensionModal/ArkUIAniUiextensionProxyModal;"; + ani_class cls; + if (ANI_OK != env->FindClass(className, &cls)) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "BindNativeUiExtensionProxy FindClass failed, className: %{public}s", className); + return ANI_ERROR; + } + + std::array methods = { + ani_native_function{"_Send_Data", nullptr, reinterpret_cast(SendData)}, + ani_native_function{"_Send_Data_Sync", nullptr, reinterpret_cast(SendDataSync)}, + }; + + if (ANI_OK != env->Class_BindNativeMethods(cls, methods.data(), methods.size())) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "BindNativeUiExtensionProxy Class_BindNativeMethods failed," + " className: %{public}s", className); + return ANI_ERROR; + } + + return ANI_OK; +} + +static ani_status NativeUiExtensionCommon::SendData( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj) +{ + auto uIExtensionProxyPeer = + reinterpret_cast(pointer); + if (uIExtensionProxyPeer == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "uIExtensionProxyPeer is null when SendData"); + return ANI_ERROR; + } + + OHOS::AAFwk::WantParams requestParams; + bool ret = OHOS::AppExecFwk::UnwrapWantParams(env, paramObj, requestParams); + if (!ret) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "UnwrapWantParams failed when SendData"); + return ANI_ERROR; + } + + uIExtensionProxyPeer->SendData(requestParams); + return ANI_OK; +} + +static ani_status NativeUiExtensionCommon::SendDataSync( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj) +{ + ani_object result_obj = {}; + auto uIExtensionProxyPeer = + reinterpret_cast(pointer); + if (uIExtensionProxyPeer == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "uIExtensionProxyPeer is null when SendDataSync"); + return result_obj; + } + + OHOS::AAFwk::WantParams requestParams; + bool ret = OHOS::AppExecFwk::UnwrapWantParams(env, paramObj, requestParams); + if (!ret) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "UnwrapWantParams failed when SendDataSync"); + return result_obj; + } + + OHOS::AAFwk::WantParams replyParams; + uIExtensionProxyPeer->SendDataSync(requestParams, replyParams); + ani_ref wantParamsObj = OHOS::AppExecFwk::WrapWantParams(env, replyParams); + if (wantParamsObj == nullptr) { + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + "WrapWantParams failed when SendDataSync"); + return result_obj; + } + + return static_cast(wantParamsObj); +} + +} // namespace OHOS::Ace::Ani \ No newline at end of file diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h new file mode 100644 index 00000000000..75d1530a165 --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2025 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 KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_UI_EXTENSION_COMMON +#define KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_UI_EXTENSION_COMMON + +#include "ani.h" + +#include + +namespace OHOS::Ace::Ani { +class NativeUiExtensionCommon { +public: + static ani_status BindNativeUiExtensionCommon(ani_env *env); + static ani_status BindNativeUiExtensionProxy(ani_env *env); + +private: + // UiExtensionProxy + static ani_status SendData( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); + static ani_status SendDataSync( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); +}; +} // namespace OHOS::Ace::Ani + +#endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_UI_EXTENSION_COMMON \ No newline at end of file -- Gitee From 309a49061f887f86645c07b4a603b1aa71bd6dcd Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Wed, 6 Aug 2025 09:28:19 +0800 Subject: [PATCH 07/27] add securityUIExtensionComponent.ts Signed-off-by: hanshu12138 --- .../component/securityUIExtensionComponent.ts | 372 ++++++++++++++++++ 1 file changed, 372 insertions(+) create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts new file mode 100644 index 00000000000..a4c4169745c --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2025 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. + */ + + +// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! + +import { TypeChecker, ArkUIGeneratedNativeModule } from 'components' +import { Finalizable, runtimeType, SerializerBase, registerCallback, wrapCallback, toPeerPtr, KLong, KPointer, MaterializedBase, NativeBuffer, nullptr, KInt, KBoolean, KStringPtr, InteropNativeModule } from "@koalaui/interop" +import { unsafeCast, int32, int64, float32 } from "@koalaui/common" +import { Serializer } from "./peers/Serializer" +import { CallbackKind } from "./peers/CallbackKind" +import { Deserializer } from "./peers/Deserializer" +import { CallbackTransformer } from "./peers/CallbackTransformer" +import { ComponentBase } from "./../ComponentBase" +import { PeerNode } from "./../PeerNode" +import { ArkCommonMethodPeer, CommonMethod, ArkCommonMethodComponent, ArkCommonMethodStyle, TerminationInfo } from "./common" +import { AbilityWant, BusinessError, Callback } from '#external' +import { Callback_Number_Void } from "./alphabetIndexer" +import { ErrorCallback } from "./ohos.base" +import { NodeAttach, remember } from "@koalaui/runtime" +import { ComponentContent } from "./../ComponentContent" +import { ArkUIAniSecurityUiextensionModal, ArkUIAniUIExtensionOptions, ArkUIAniModule, ArkUIAniUiextensionProxyModal } from "arkui.ani" + +export interface SecurityUIExtensionProxy { + send(data: Record): void + sendSync(data: Record): Record + onAsyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void + onSyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void + offAsyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void) | undefined): void + offSyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void) | undefined): void + on(type: 'syncReceiverRegister' | 'asyncReceiverRegister', callback_: ((parameter: SecurityUIExtensionProxy)=>void)) : void + off(type: 'syncReceiverRegister' | 'asyncReceiverRegister', callback_: ((parameter: SecurityUIExtensionProxy)=>void)) : void +} +export class SecurityUIExtensionProxyInternal implements MaterializedBase,SecurityUIExtensionProxy { + peer?: Finalizable | undefined = undefined + public getPeer(): Finalizable | undefined { + return this.peer + } + static ctor_uiextensionproxy(): KPointer { + const retval = ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_ctor() + return retval + } + constructor() { + const ctorPtr : KPointer = SecurityUIExtensionProxyInternal.ctor_uiextensionproxy() + this.peer = new Finalizable(ctorPtr, SecurityUIExtensionProxyInternal.getFinalizer()) + } + static getFinalizer(): KPointer { + return ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_getFinalizer() + } + public send(data: Record): void { + const data_casted = data as (Record) + ArkUIAniUiextensionProxyModal._Send_Data(this.peer!.ptr, data); + return + } + public sendSync(data: Record): Record { + const data_casted = data as (Record) + return ArkUIAniUiextensionProxyModal._Send_Data_Sync(this.peer!.ptr, data); + } + public onAsyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void)) + this.onAsyncReceiverRegister_serialize(callback__casted) + return + } + public onSyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void)) + this.onSyncReceiverRegister_serialize(callback__casted) + return + } + public offAsyncReceiverRegister(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { + const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void) | undefined) + this.offAsyncReceiverRegister_serialize(callback__casted) + return + } + public offSyncReceiverRegister(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { + const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void) | undefined) + this.offSyncReceiverRegister_serialize(callback__casted) + return + } + on(type: string, callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + if (type == 'syncReceiverRegister') { + this.onSyncReceiverRegister(callback_) + } else if (type == 'asyncReceiverRegister') { + this.onAsyncReceiverRegister(callback_) + } + } + off(type: string, callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + if (type == 'syncReceiverRegister') { + this.offSyncReceiverRegister(callback_) + } else if (type == 'asyncReceiverRegister') { + this.offAsyncReceiverRegister(callback_) + } + } + + private onAsyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + const thisSerializer : Serializer = Serializer.hold() + thisSerializer.holdAndWriteCallback(callback_) + ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_onAsyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + private onsyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + const thisSerializer : Serializer = Serializer.hold() + thisSerializer.holdAndWriteCallback(callback_) + ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_onSyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + private offAsyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + const thisSerializer : Serializer = Serializer.hold() + let callback__type : int32 = RuntimeType.UNDEFINED + callback__type = runtimeType(callback_) + thisSerializer.writeInt8(callback__type as int32) + if ((RuntimeType.UNDEFINED) != (callback__type)) { + const callback__value = callback_! + thisSerializer.holdAndWriteCallback(callback__value) + } + ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_offAsyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + private offSyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + const thisSerializer : Serializer = Serializer.hold() + let callback__type : int32 = RuntimeType.UNDEFINED + callback__type = runtimeType(callback_) + thisSerializer.writeInt8(callback__type as int32) + if ((RuntimeType.UNDEFINED) != (callback__type)) { + const callback__value = callback_! + thisSerializer.holdAndWriteCallback(callback__value) + } + ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_offSyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + public static fromPtr(ptr: KPointer): SecurityUIExtensionProxyInternal { + const obj : SecurityUIExtensionProxyInternal = new SecurityUIExtensionProxyInternal() + obj.peer = new Finalizable(ptr, SecurityUIExtensionProxyInternal.getFinalizer()) + return obj + } +} +class ArkSecurityUIExtensxionCallbackHelp { + onRemoteReady?: ((parameter: SecurityUIExtensionProxy) => void) + onReceive?: ((param: Record) => void) + onError?: ((e: BusinessError) => void) + onTerminated?: ((parameter: TerminationInfo) => void) + constructor() { + this.onRemoteReady = undefined; + this.onReceive = undefined; + this.onError = undefined; + this.onTerminated = undefined; + } +} + +export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodsPeer { + _callbackHelp?: ArkSecurityUIExtensionCallbackHelp; + protected constructor(peerPtr: KPointer, ind: int32, name: string = "", flags: int32 = 0) { + super(peerPtr, IdleDeadline, name, flags) + this.InitArkSecurityUIExtensionCallbackHelp(); + } + public static create(component: ComponentBase | undefined, flags: int32 = 0): ArkSecurityUIExtensionComponentPeer { + InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] create ArkUIExtensionComponentPeer start"); + const peerId = PeerNode.nextId() + const _peerPtr = ArkUIGeneratedNativeModule._SecurityUIExtensionComponent_construct(peerId, flags) + cosnt _peer = new ArkSecurityUIExtensionComponentPeer(_peerPtr, peerId, "UIExtensionComponent", flags) + component?.setPeer(_peer) + return _peer + } + InitArkSecurityUIExtensionCallbackHelp(): void { + InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] InitArkUIExtensionCallback Help entry"); + this._callbackHelp = new ArkSecurityUIExtensxionCallbackHelp(); + } + setSecurityUIExtensionComponentOptionsAttribute(want: AbilityWant, options?: SecurityUIExtensionOptions): void { + InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] setUIExtensionComponentOptionsAttribute entry"); + if (options != undefined) { + let innerOption : ArkUIAniUIExtensionOptions = new ArkUIAniUIExtensionOptions(); + if (options.isTransferringCaller != undefined) { + innterOptions.isTransferringCaller = (options.isTransferringCaller) as boolean; + } + + if (options.dpiFollowStrategy != undefined) { + innerOption.dpiFollowStrategy = (options.dpiFollowStrategy as SecurityDpiFollowStrategy).valueOf(); + } + ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_Option(this.setSecurityUIExtensionComponentOptionsAttribute.prototype, innerOption); + } + + ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_Want(this.peer.ptr, want); + } + onRemoteReadyAttribute(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + let value_type : int32 = RuntimeType.UNDEFINED + value_type = runtimeType(value) + thisSerializer.writeInt8(value_type as int32) + if ((RuntimeType.UNDEFINED) != (value_type)) { + const value_value = value! + thisSerializer.holdAndWriteCallback(value_value) + } + ArkUIGeneratedNativeModule._SecurityUIExtensionComponentAttribute_onRemoteRead(this.setSecurityUIExtensionComponentOptionsAttribute.prototype, thisSerializer.asBuffer(), thisSerializer.writeLength()) + thisSerializer.release() + } + onReceiveAttribute(value: ((parameter: Record) => void) | undefined): void { + const help = this._callbackHelp; + if (help != undefined && help != null) { + help.onReceive = value; + ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_OnReciveCallback(this.setSecurityUIExtensionComponentOptionsAttribute.prototype, (param: Record) => { + const onReceive = this._callbackHelp?.onReceive; + if (onReceive !== undefined && onReceive !== null) { + const innerParam = param; + onReceive(innerParam); + } + }); + } + } + + onErrorAttribute(value: ((e: BusinessError) => void) | undefined): void { + const help = this._callbackHelp; + if (help != undefined && help != null) { + help.onError = value; + ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnErrorCallback( + this.setSecurityUIExtensionComponentOptionsAttribute.prototype, (code1: number, name1: string, message1: string) => { + const onError = this._callback_Help?.onError; + if (onError !== undefined && onError !== null) { + const param = { + code: 1, + name: name1, + message: message1 + } as BusinessError + onError(param); + } + }); + } + } + onTerminateAttribute(value: ((parameter: TerminationInfo) => void) | undefined): void { + const help = this._callbackHelp; + if (help !== undefined && help !== null) { + help.onTerminated = value; + InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] _SecurityUiextension_Set_OnTerminationCallback entry"); + ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnTerminationCallback( + this.setSecurityUIExtensionComponentOptionsAttribute.prototype, (code1: number, want1 : AbilityWant) => { + const onTerminated = this._callbackHelp?.onTerminated; + if (onTerminated !== undefined && onTerminated !== null) { + const param = { + code: 1, + want: want1 + } as BusinessError + onTerminated(param); + } + }); + } + } +} +export enum SecurityDpiFollowStrategy { + FOLLOW_HOST_DPI = 0, + FOLLOW_UI_EXTENSION_ABILITY_DPI = 1 +} +export enum SecurityWindowModeFollowStrategy { + FOLLOW_HOST_WINDOW_MODE = 0, + FOLLOW_UI_EXTENSION_ABILITY_WINDOW_MODE = 1 +} +export interface SecurityUIExtensionOptions { + isTransferringCaller?: boolean; + dpiFollowStrategy?: SecurityDpiFollowStrategy; + windowModelFollowStrategy?: SecurityWindowModeFollowStrategy; +} +export type Callback_SecurityUIExtensionProxy_Void = (parameter: SecurityUIExtensionProxy) => void; +export type SecurityUIExtensionComponentInterface = (want: AbilityWant, options?: SecurityUIExtensionOptions) => SecurityUIExtensionComponentAttribute; +export interface SecurityUIExtensionComponentAttribute extends CommonMethod { + onRemoteReady(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): this + onReceive(value: ((parameter: Record) => void) | undefined): this + onError(value: ((e:BusinessError) => void) | undefined): this + onTerminated(value: ((parameter: TerminationInfo) => void) | undefined): this +} +export class ArkSecurityUIExtensionComponentStyle extends ArkCommonMethodStyle implements SecurityUIExtensionComponentAttribute { + onRemoteReady_value?: ((parameter: SecurityUIExtensionProxy) => void) | undefined + onReceive_value?: ((parameter: Record) => void) | undefined + onError_value?: ((e: BusinessError) => void) | undefined + onTerminated_value?: ((parameter: TerminationInfo) => void) | undefined + + public onRemoteReady(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): this { + return this + } + public onReceive(value: ((parameter: Record) => void) | undefined): this { + return this + } + public onError(value: ((e: BusinessError) => void) | undefined): this { + return this + } + public onTerminated(value: ((parameter: TerminationInfo) => void) | undefined): this { + return this + } +} +export type Callback_Map_String_Object_Void = (parameter: Record) => void; +export interface Literal_Number_code__want { + code: number; + want?: AbilityWant; +} +export type Callback_Literal_Number_code__want_Void = (parameter: Literal_Number_code__want) => void; +export class ArkSecurityUIExtensionComponentComponent extends ArkCommonMethodComponent implements SecurityUIExtensionComponentAttribute { + getPeer(): ArkSecurityUIExtensionComponentPeer { + return (this.peer as ArkSecurityUIExtensionComponentPeer) + } + public setSecurityUIExtensionComponentOptions(want: AbilityWant, options?: SecurityUIExtensionOptions): this { + if (this.checkPriority("setSecurityUIExtensionComponentOptions")) { + const want_casted = want as (AbilityWant) + const options_casted = options as (SecurityUIExtensionOptions | undefined) + this.getPeer()?.setSecurityUIExtensionComponentOptionsAttribute(want_casted, options_casted) + return this + } + return this + } + public onRemoteReady(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): this { + if (this.checkPriority("onRemoteReady")) { + const value_casted = value as (((parameter: SecurityUIExtensionProxy) => void) | undefined) + this.getPeer()?.onRemoteReadyAttribute(value_casted) + return this + } + return this + } + public onReceive(value: ((parameter: Record) => void) | undefined): this { + if (this.checkPriority("onReceive")) { + const value_casted = value as (((parameter: Record) => void) | undefined) + this.getPeer()?.onReceiveAttribute(value_casted) + return this + } + return this + } + public onError(value: ErrorCallback | undefined): this { + if (this.checkPriority("onError")) { + const value_casted = value as (ErrorCallback | undefined) + this.getPeer()?.onErrorAttribute(value_casted) + return this + } + return this + } + public onTerminated(value: ((parameter: TerminationInfo) => void) | undefined): this { + if (this.checkPriority("onTerminated")) { + const value_casted = value as (((parameter: TerminationInfo) => void) | undefined) + this.getPeer()?.onTerminatedAttribute(value_casted) + return this + } + return this + } + + public applyAttributesFinish(): void { + // we call this function outside of class, so need to make it public + super.applyAttributesFinish() + } +} +/** @memo */ +export function SecurityUIExtensionComponent( + /** @memo */ + style: ((attributes: SecurityUIExtensionComponentAttribute) => void) | undefined, + want: AbilityWant, options?: SecurityUIExtensionOptions, + /** @memo */ + content_?: (() => void) | undefined, +): void { + const receiver = remember(() => { + return new ArkSecurityUIExtensionComponentComponent() + }) + NodeAttach((): ArkSecurityUIExtensionComponentPeer => ArkSecurityUIExtensionComponentPeer.create(receiver), (_: ArkSecurityUIExtensionComponentPeer) => { + receiver.setUIExtensionComponentOptions(want,options) + style?.(receiver) + content_?.() + receiver.applyAttributesFinish() + }) +} \ No newline at end of file -- Gitee From 9080f8dc762cb30386d8aefc7686011dc053144a Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Wed, 6 Aug 2025 10:44:28 +0800 Subject: [PATCH 08/27] add security_ui_extension_model_static Signed-off-by: hanshu12138 --- .../security_ui_extension_model_static.cpp | 110 ++++++++++++++++++ .../security_ui_extension_model_static.h | 52 +++++++++ 2 files changed, 162 insertions(+) create mode 100644 frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp create mode 100644 frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h diff --git a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp new file mode 100644 index 00000000000..749e61c42e2 --- /dev/null +++ b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2023-2025 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 "core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h" + +#include "adapter/ohos/osal/want_wrap_ohos.h" +#include "core/components_ng/base/view_abstract_model_ng.h" +#include "core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_pattern.h" +#include "core/pipeline_ng/pipeline_context.h" + +namespace OHOS::Ace::NG { +RefPtr SecurityUIExtensionStatic::CreateSecurityUIExtensionComponent( + int32_t nodeId, NG::SessionType sessionType) +{ + auto frameNode = FrameNode::GetOrCreateFrameNode(V2::UI_EXTENSION_COMPONENT_ETS_TAG, nodeId, + []() { return AceType::MakeRefPtr(); }); + auto* stack = ViewStackProcessor::GetInstance(); + stack->Push(frameNode); + return frameNode; +} + +void SecurityUIExtensionStatic::UpdateSecurityUecConfig( + FrameNode* frameNode, bool isTransferringCaller, bool densityDpi, bool isWindowModeFollowHost, + const std::map>& placeholderMap) +{ + CHECK_NULL_VOID(frameNode); + CHECK_NULL_VOID(frameNode->GetPattern()); + auto pattern = frameNode->GetPattern(); + CHECK_NULL_VOID(pattern); + if (pattern->GetIsTransferringCaller() != isTransferringCaller) { + pattern->SetIsTransferringCaller(isTransferringCaller); + } + pattern->SetDensityDpi(densityDpi); + pattern->SetIsWindowModeFollowHost(isWindowModeFollowHost); +} + +void SecurityUIExtensionStatic::UpdateSecurityWant(FrameNode* frameNode, const AAFwk::Want& want) +{ + CHECK_NULL_VOID(frameNode); + CHECK_NULL_VOID(frameNode->GetPattern()); + auto pattern = frameNode->GetPattern(); + CHECK_NULL_VOID(pattern); + pattern->SetWantWrap(AceType::MakeRefPtr(want)); +} + +void SecurityUIExtensionStatic::SetSecurityOnError(FrameNode* frameNode, + std::function&& onError) +{ + auto pattern = frameNode->GetPattern(); + CHECK_NULL_VOID(pattern); + pattern->SetOnErrorCallback(std::move(onError)); +} + +void SecurityUIExtensionStatic::SetSecurityOnReceive(FrameNode* frameNode, + std::function&& onReceive) +{ + CHECK_NULL_VOID(frameNode); + auto eventHub = frameNode->GetEventHub(); + CHECK_NULL_VOID(eventHub); + eventHub->SetOnReceiveCallback(std::move(onReceive)); +} + +void SecurityUIExtensionStatic::SetSecurityOnRelease( + FrameNode* frameNode, std::function&& onRelease) +{ + LOGE("UIExtensionStatic SecurityUEC not support OnRelease."); +} + +void SecurityUIExtensionStatic::SetSecurityOnRemoteReady(FrameNode* frameNode, + std::function&)>&& OnRemoteReady) +{ + CHECK_NULL_VOID(frameNode); + auto eventHub = frameNode->GetEventHub(); + CHECK_NULL_VOID(eventHub); + eventHub->SetOnRemoteReadyCallback(std::move(OnRemoteReady)); +} + +void SecurityUIExtensionStatic::SetSecurityOnResult( + FrameNode* frameNode, std::function&& onResult) +{ + LOGE("UIExtensionStatic SecurityUEC not support OnResult."); +} + +void SecurityUIExtensionStatic::SetSecurityOnTerminated(FrameNode* frameNode, + std::function&)>&& onTerminated) +{ + CHECK_NULL_VOID(frameNode); + auto eventHub = frameNode->GetEventHub(); + CHECK_NULL_VOID(eventHub); + eventHub->SetOnTerminatedCallback(std::move(onTerminated)); +} + +void SecurityUIExtensionStatic::SetSecurityOnDrawReady( + FrameNode* frameNode, std::function&& onDrawReady) +{ + LOGE("UIExtensionStatic SecurityUEC not support OnDrawReady."); +} +} // namespace OHOS::Ace::NG \ No newline at end of file diff --git a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h new file mode 100644 index 00000000000..7558f346552 --- /dev/null +++ b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023-2025 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SUEC_SECURITY_UI_EXTENSION_STATIC_H +#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SUEC_SECURITY_UI_EXTENSION_STATIC_H + +#include +#include + +#include "base/utils/macros.h" +#include "base/want/want_wrap.h" +#include "core/components_ng/base/frame_node.h" +#include "core/components_ng/pattern/ui_extension/session_wrapper.h" +#include "core/components_ng/pattern/ui_extension/ui_extension_config.h" + +namespace OHOS::Ace::NG { +class SecurityUIExtensionProxy; + +class ACE_FORCE_EXPORT SecurityUIExtensionStatic : public AceType { + DECLARE_ACE_TYPE(SecurityUIExtensionStatic, AceType); +public: + static RefPtr CreateSecurityUIExtensionComponent(int32_t nodeId, NG::SessionType sessionType); + static void UpdateSecurityUecConfig( + FrameNode* frameNode, bool isTransferringCaller, bool densityDpi, bool isWindowModeFollowHost, + const std::map>& placeholderMap); + static void UpdateSecurityWant(FrameNode* frameNode, const AAFwk::Want& want); + static void SetSecurityOnError(FrameNode* frameNode, + std::function&& onError); + static void SetSecurityOnReceive(FrameNode* frameNode, + std::function&& onReceive); + static void SetSecurityOnRelease(FrameNode* frameNode, std::function&& onRelease); + static void SetSecurityOnRemoteReady(FrameNode* frameNode, + std::function&)>&& OnRemoteReady); + static void SetSecurityOnResult(FrameNode* frameNode, std::function&& onResult); + static void SetSecurityOnTerminated(FrameNode* frameNode, + std::function&)>&& onTerminated); + static void SetSecurityOnDrawReady(FrameNode* frameNode, std::function&& onDrawReady); +}; +} // namespace OHOS::Ace::NG +#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SUEC_SECURITY_UI_EXTENSION_STATIC_H \ No newline at end of file -- Gitee From c4d4fc37ca2167a49e7370ea9a4b34278498e848 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Wed, 6 Aug 2025 17:34:12 +0800 Subject: [PATCH 09/27] add security_ui_extension_proxy_accessor.cpp Signed-off-by: hanshu12138 --- .../security_ui_extension_proxy_accessor.cpp | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp diff --git a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp new file mode 100644 index 00000000000..a0cc0194144 --- /dev/null +++ b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2025 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 "core/components_ng/base/frame_node.h" +#include "core/interfaces/native/utility/callback_helper.h" +#include "core/interfaces/native/utility/converter.h" +#include "arkoala_api_generated.h" + +#include "frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h" + +namespace SecurityUIExtensionProxyAccessor { +const GENERATED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor(); +namespace SecurityUIExtensionProxyAccessor { +void DestroyPeerImpl(Ark_SecurityUIExtensionProxy peer) +{ + if (peer) { + delete peer; + } +} +Ark_SecurityUIExtensionProxy CtorImpl() +{ + return new SecurityUIExtensionProxyPeer(); +} +Ark_NativePointer GetFinalizerImpl() +{ + return reinterpret_cast(&DestroyPeerImpl); +} +void SendImpl(Ark_SecurityUIExtensionProxy peer, const Map_String_Object* data) +{ + LOGE("SecurityUIExtensionProxyAccessor::SendImpl - implement by ANI"); +} +Map_String_Object SendSyncImpl(Ark_VMContxt vmContext, + Ark_SecurityUIExtensionProxy peer, const Map_String_Object* data) +{ + LOGE("SecurityUIExtensionProxyAccessor::SendSyncImpl - implement by ANI"); + return {}; +} +void OnAsyncReceiverRegisterImpl(Ark_SecurityUIExtensionProxy peer, + const Callback_SecurityUIExtensionProxy_Void* callback_) +{ +#ifdef WINDOW_SCENE_SUPPORTED + CHECK_NULL_VOID(peer); + CHECK_NULL_VOID(callback_); + auto func = [arkCallback = CallbackHelper(*callback_)](const RefPtr& proxy) { + auto accessor = GetSecurityUIExtensionProxyAccessor(); + CHECK_NULL_VOID(accessor); + auto peer = accessor->ctor(); + CHECK_NULL_VOID(peer); + auto uiExtensionProxyPeerPtr = reinterpret_cast(peer); + uiExtensionProxyPeerPtr->SetProxy(proxy); + arkCallback.Invoke(peer); + }; + + std::lock_guard lock(peer->callbackListLock_); + peer->AddAsyncCallbackToList(callback_->resource.resourceId, std::move(func)); + auto pattern = peer->GetPattern(); + CHECK_NULL_VOID(pattern); + auto funcList = peer->GetOnAsyncCallbackList(); + pattern->SetAsyncCallbacks(std::move(funcList)); +#endif //WINDOW_SCENE_SUPPORTED +} +void OnSyncReceiverRegisterImpl(Ark_SecurityUIExtensionProxy peer, + const Callback_SecurityUIExtensionProxy_Void* callback_) +{ +#ifdef WINDOW_SCENE_SUPPORTED + CHECK_NULL_VOID(peer); + CHECK_NULL_VOID(callback_); + auto func = [arkCallback = CallbackHelper(*callback_)](const RefPtr& proxy) { + auto accessor = GetSecurityUIExtensionProxyAccessor(); + CHECK_NULL_VOID(accessor); + auto peer = accessor->ctor(); + CHECK_NULL_VOID(peer); + auto uiExtensionProxyPeerPtr = reinterpret_cast(peer); + uiExtensionProxyPeerPtr->SetProxy(proxy); + arkCallback.Invoke(peer); + }; + + std::lock_guard lock(peer->callbackListLock_); + peer->AddSyncCallbackToList(callback_->resource.resourceId, std::move(func)); + auto pattern = peer->GetPattern(); + CHECK_NULL_VOID(pattern); + auto funcList = peer->GetOnSyncCallbackList(); + pattern->SetSyncCallbacks(std::move(funcList)); +#endif //WINDOW_SCENE_SUPPORTED +} +void OffAsyncReceiverRegisterImpl(Ark_SecurityUIExtensionProxy peer, + const Opt_Callback_SecurityUIExtensionProxy_Void* callback_) +{ + #ifdef WINDOW_SCENE_SUPPORTED + CHECK_NULL_VOID(peer); + CHECK_NULL_VOID(callback_); + auto cb = Converter::OptConvert(*callback_); + std::lock_guard lock(peer->callbackListLock_); + if (cb) { + peer->DeleteAsyncCallbackFromList(cb.value().resource.resourceId); + } else { + peer->ClearAsyncCallbackList(); + } + auto pattern = peer->GetPattern(); + CHECK_NULL_VOID(pattern); + auto funcList = peer->GetOnAsyncCallbackList(); + pattern->SetAsyncCallbacks(std::move(funcList)); + #endif //WINDOW_SCENE_SUPPORTED +} +void OffSyncReceiverRegisterImpl(Ark_SecurityUIExtensionProxy peer, + const Opt_Callback_SecurityUIExtensionProxy_Void* callback_) +{ + #ifdef WINDOW_SCENE_SUPPORTED + CHECK_NULL_VOID(peer); + CHECK_NULL_VOID(callback_); + auto cb = Converter::OptConvert(*callback_); + std::lock_guard lock(peer->callbackListLock_); + if (cb) { + peer->DeleteSyncCallbackFromList(cb.value().resource.resourceId); + } else { + peer->ClearSyncCallbackList(); + } + auto pattern = peer->GetPattern(); + CHECK_NULL_VOID(pattern); + auto funcList = peer->GetOnSyncCallbackList(); + pattern->SetSyncCallbacks(std::move(funcList)); + #endif //WINDOW_SCENE_SUPPORTED +} +} // SecurityUIExtensionProxyAccessor +const GENERATED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor() +{ + static const GENERATED_ArkUISecurityUIExtensionProxyAccessor SecurityUIExtensionProxyAccessorImpl { + GetSecurityUIExtensionProxyAccessor::DestroyPeerImpl, + GetSecurityUIExtensionProxyAccessor::CtorImpl, + GetSecurityUIExtensionProxyAccessor::GetFinalizerImpl, + GetSecurityUIExtensionProxyAccessor::SendImpl, + GetSecurityUIExtensionProxyAccessor::SendSyncImpl, + GetSecurityUIExtensionProxyAccessor::OnAsyncReceiverRegisterImpl, + GetSecurityUIExtensionProxyAccessor::OnSyncReceiverRegisterImpl, + GetSecurityUIExtensionProxyAccessor::OffAsyncReceiverRegisterImpl, + GetSecurityUIExtensionProxyAccessor::OffSyncReceiverRegisterImpl, + }; + return &SecurityUIExtensionProxyAccessorImpl; +} + +} \ No newline at end of file -- Gitee From 3f607bc81e1be5d9978865edfaf4656d14521e93 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Wed, 6 Aug 2025 18:53:50 +0800 Subject: [PATCH 10/27] add security_ui_extension_proxy_peer Signed-off-by: hanshu12138 --- .../security_ui_extension_proxy_peer.cpp | 41 ++++++ .../security_ui_extension_proxy_peer.h | 131 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp create mode 100644 frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h diff --git a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp new file mode 100644 index 00000000000..d3d09a2c561 --- /dev/null +++ b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 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 "frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h" + +#ifdef WINDOW_SCENE_SUPPORTED +#include "want.h" +#endif //WINDOW_SCENE_SUPPORTED + +namespace OHOS::Ace::NG::GeneratedModifier { +#ifdef WINDOW_SCENE_SUPPORTED +void SecurityUIExtensionProxyPeerImpl::SendData(const AAFwk::WantParams& wantParams) +{ + if (proxy_ == nullptr) { + return; + } + proxy_->SendData(wantParams); +} + +int32_t SecurityUIExtensionProxyPeerImpl::SendDataSync( + const AAFwk::WantParams& wantParams, AAFwk::WantParams& reWantParams) +{ + if (proxy_ == nullptr) { + return; + } + proxy_->SendDataSync(wantParams, reWantParams); +} +#endif //WINDOW_SCENE_SUPPORTED +} // namespace OHOS::Ace::NG::GeneratedModifier \ No newline at end of file diff --git a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h new file mode 100644 index 00000000000..447f72be835 --- /dev/null +++ b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2025 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 FOUNDATION_ARKUI_ACE_ENGINE_FRAMEWORKS_CORE_INTERFACES_NATIVE_IMPL_SECURITY_UI_EXTENSION_PROXY_PEER_H +#define FOUNDATION_ARKUI_ACE_ENGINE_FRAMEWORKS_CORE_INTERFACES_NATIVE_IMPL_SECURITY_UI_EXTENSION_PROXY_PEER_H + +#include "base/memory/ace_type.h" +#ifdef WINDOW_SCENE_SUPPORTED +#include +#include "core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_proxy.h" +#include "frameworks/core/interfaces/native/implementation/ui_extension_proxy_peer_base.h" +#endif //WINDOW_SCENE_SUPPORTED +namespace OHOS::Ace::NG::GeneratedModifier { +#ifdef WINDOW_SCENE_SUPPORTED +struct SecurityUIExtensionProxyPeerImpl : public UIExtensionProxyPeerBase { +#else +struct SecurityUIExtensionProxyPeerImpl : public AceType { +#endif +#ifdef WINDOW_SCENE_SUPPORTED + using ProxyRefPtr = OHOS::Ace::RefPtr; + using CallbackFunc = std::function; + using CallbackFuncPairList = std::list>; + using PatternRefPtr = OHOS::Ace::RefPtr; +#endif //WINDOW_SCENE_SUPPORTED + SecurityUIExtensionProxyPeerImpl() = default; + ~SecurityUIExtensionProxyPeerImpl() = default; +#ifdef WINDOW_SCENE_SUPPORTED + inline void SetProxy(const ProxyRefPtr& proxy) + { + proxy_ = proxy; + } + + void SendData(const AAFwk::WantParams& wantParams) override; + + int32_t SendDataSync( + const AAFwk::WantParams& wantParams, AAFwk::WantParams& reWantParams) override; + + inline PatternRefPtr GetPattern() + { + CHECK_NULL_RETURN(proxy_, nullptr); + return proxy_->GetPattern(); + } + + inline std::list GetOnSyncCallbackList() + { + std::list reList; + for (const auto& item : onSyncCallbackList_) { + reList.emplace_back(item.second); + } + return reList; + } + + inline std::list GetOnAsyncCallbackList() + { + std::list reList; + for (const auto& item : onAsyncCallbackList_) { + reList.emplace_back(item.second); + } + return reList; + } + + inline void AddAsyncCallbackToList(int32_t id, const CallbackFunc& onFunc) + { + auto iter = FundCallback(id, onAsyncCallbackList_); + if (iter == onAsyncCallbackList_.end()) { + onAsyncCallbackList_.emplace_back(std::make_pair(id, onFunc)); + } + } + + inline void AddSyncCallbackToList(int32_t id, const CallbackFunc& onFunc) + { + auto iter = FundCallback(id, onSyncCallbackList_); + if (iter == onSyncCallbackList_.end()) { + onSyncCallbackList_.emplace_back(std::make_pair(id, onFunc)); + } + } + + inline void DeleteSyncCallbackFromList(int32_t id) + { + auto iter = FundCallback(id, onSyncCallbackList_); + if (iter == onSyncCallbackList_.end()) { + onSyncCallbackList_.erase(iter); + } + } + + inline void ClearSyncCallbackList() + { + onSyncCallbackList_.clear(); + } + + inline void DeleteAsyncCallbackFromList(int32_t id) + { + auto iter = FundCallback(id, onAsyncCallbackList_); + if (iter == onAsyncCallbackList_.end()) { + onAsyncCallbackList_.erase(iter); + } + } + + inline void ClearAsyncCallbackList() + { + onAsyncCallbackList_.clear(); + } + + std::mutex callbackListLock_; +private: + inline CallbackFuncPairList::const_iterator FindCallback(int32_t id, CallbackFuncPairList& callbackList) + { + return std::find_if(callbackList.begin(), callbackList.end(), [id](const auto& item) -> bool { + return (item.first == id); + }); + } + ProxyRefPtr proxy_; + CallbackFuncPairList onSyncCallbackList_; + CallbackFuncPairList onAsyncCallbackList_; +#endif //WINDOW_SCENE_SUPPORTED +}; +} // namespace OHOS::Ace::NG::GeneratedModifier + +struct SecurityUIExtensionProxyPeer : public OHOS::Ace::NG::GeneratedModifier::SecurityUIExtensionProxyPeerImpl {}; +#endif //FOUNDATION_ARKUI_ACE_ENGINE_FRAMEWORKS_CORE_INTERFACES_NATIVE_IMPL_SECURITY_UI_EXTENSION_PROXY_PEER_H -- Gitee From 88b3811b14edffb9dcc4132d5144aec6545c323c Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Wed, 6 Aug 2025 18:59:16 +0800 Subject: [PATCH 11/27] revert Signed-off-by: hanshu12138 --- build/libace.map | 2 -- .../ui_extension/ArkUIAniUiextensionModal.ts | 15 --------------- .../src/ani/native/ui_extension/BUILD.gn | 3 --- 3 files changed, 20 deletions(-) diff --git a/build/libace.map b/build/libace.map index e6bf52c1bde..eeddefc89ea 100644 --- a/build/libace.map +++ b/build/libace.map @@ -329,8 +329,6 @@ OHOS::Ace::NG::ServiceCollaborationAceCallback::*; OHOS::Ace::DumpLog::*; OHOS::Ace::NG::UIExtensionAdapter::*; - OHOS::Ace::NG::UIExtensionStatic::*; - OHOS::Ace::NG::SecurityUIExtensionStatic::*; virtual?thunk?to?OHOS::Ace::Animator::~Animator??; virtual?thunk?to?OHOS::Ace::Frontend::MaybeRelease*; diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts index a5d4724ce63..ee877599c28 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts @@ -54,19 +54,4 @@ export class ArkUIAniUiextensionModal { native static _Uiextension_Set_OnReciveCallback(nodePointer: KLong, value: ReciveCallback) : void; native static _Uiextension_Set_OnTerminationCallback(nodePointer: KLong, value: TerminationCallback) : void; native static _Uiextension_Set_OnReleaseCallback(nodePointer: KLong, value: ReleaseCallback) : void; -} - -export class ArkUIAniSecurityUiextensionModal { - static { - ArkUIAniUiextensionLoadLibraryHelp.LoadLibrary(); - } - - native static _SecurityUiextension_Set_Option(nodePointer: KLong, option: ArkUIAniUIExtensionOptions): void - native static _SecurityUiextension_Set_Want(nodePointer: KLong, want: Want): void - native static _SecurityUiextension_Set_OnResultCallback(nodePointer: KLong, value: ResultCallback): void - native static _SecurityUiextension_Set_OnErrorCallback(nodePointer: KLong, value: ErrorCallback) : void; - native static _SecurityUiextension_Set_OnReciveCallback(nodePointer: KLong, value: ReciveCallback) : void; - native static _SecurityUiextension_Set_OnTerminationCallback(nodePointer: KLong, value: TerminationCallback) : void; - native static _SecurityUiextension_Set_OnReleaseCallback(nodePointer: KLong, value: ReleaseCallback) : void; - native static _SecurityUiextension_Set_OnDrawReadyCallback(nodePointer: KLong, value: DrawReadyCallback) : void; } \ No newline at end of file diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn index 3c3ecb4b866..913b563ea69 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/BUILD.gn @@ -26,9 +26,6 @@ ohos_shared_library("arkuiuiextension_ani") { include_dirs = [ "//foundation/arkui/ace_engine/frameworks" ] sources = [ "../ani_utils.cpp", - "ani_uiextension_module.cpp", - "native_security_ui_extension.cpp", - "native_ui_extension_common.cpp", "native_ui_extension.cpp", ] external_deps = [ -- Gitee From 2bacd7421240391edbd196656146d9924d2d8ce7 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Wed, 6 Aug 2025 19:07:45 +0800 Subject: [PATCH 12/27] revert Signed-off-by: hanshu12138 --- .../ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts | 2 +- .../src/ani/native/ui_extension/native_ui_extension.cpp | 1 - .../src/ani/native/ui_extension/native_ui_extension.h | 8 ++++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts index ee877599c28..0b7d0ec984b 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ui_extension/ArkUIAniUiextensionModal.ts @@ -54,4 +54,4 @@ export class ArkUIAniUiextensionModal { native static _Uiextension_Set_OnReciveCallback(nodePointer: KLong, value: ReciveCallback) : void; native static _Uiextension_Set_OnTerminationCallback(nodePointer: KLong, value: TerminationCallback) : void; native static _Uiextension_Set_OnReleaseCallback(nodePointer: KLong, value: ReleaseCallback) : void; -} \ No newline at end of file +} diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp index 74f8394bb18..ea308b3f72f 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.cpp @@ -20,7 +20,6 @@ // #include "base/log/log_wrapper.h" // #ifdef WINDOW_SCENE_SUPPORTED // #include "core/components_ng/pattern/ui_extension/ui_extension_component/ui_extension_model_adapter.h" -#include "core/components_ng/pattern/ui_extension/ui_extension_component/ui_extension_model_static.h" // #include "core/interfaces/native/implementation/ui_extension_proxy_peer.h" // #include "frameworks/core/interfaces/native/implementation/ui_extension_proxy_peer_base.h" // #endif //WINDOW_SCENE_SUPPORTED diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h index 4879d79bb5a..027047fa636 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension.h @@ -25,6 +25,7 @@ class NativeUiExtension { public: static ani_status BindNativeUiExtension(ani_env *env); static ani_status BindNativeUiExtensionComponent(ani_env *env); + static ani_status BindNativeUiExtensionProxy(ani_env *env); private: // UiExtensionModal @@ -49,6 +50,13 @@ private: static ani_status SetOnRelease( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); + // UiExtensionProxy + static ani_status SendData( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); + static ani_object SendDataSync( + [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); }; } // namespace OHOS::Ace::Ani -- Gitee From 38b6c16d92ece91475cd3b9956ef1cea0fbd7978 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Wed, 6 Aug 2025 19:51:02 +0800 Subject: [PATCH 13/27] add security_uiextension_component_modifier.cpp Signed-off-by: hanshu12138 --- ...ecurity_uiextension_component_modifier.cpp | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp diff --git a/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp new file mode 100644 index 00000000000..e52064995c7 --- /dev/null +++ b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2025 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. + */ + +#ifdef WINDOW_SCENE_SUPORTED +#include "core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h" +#include "core/interfaces/native/implementation/security_ui_extension_proxy_peer.h" +#endif +#include "core/components_ng/base/frame_node.h" +#include "arkoala_api_generated.h" +#include "core/interfaces/native/utility/converter.h" +#include "core/interfaces/native/utility/callback_helper.h" +#include "core/interfaces/native/utility/reverse_converter.h" + +namespace OHOS::Ace::NG::GeneratedModifier { +#ifdef WINDOW_SCENE_SUPPORTED +cosnt GENERAGED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor(); +#endif //WINDOW_SCENE_SUPPORTED +} + +namespace OHOS::Ace::NG::GeneratedModifier { +namespace SecurityUIExtensionComponentModifier { +Ark_NativePointer ConstructImpl(Ark_Int32 id, + Ark_Int32 flags) +{ +#ifdef WINDOW_SCENE_SUPPORTED + LOGI("[SecurityUIExtensionComponentModifier] ConstructImpl."); + auto frameNode = NG::SecurityUIExtensionStatic::CreateSecurityUIExtensionComponent( + id, NG::SessionType::SECURITY_UI_EXTENSION_ABILITY); + frameNode->IncRefCount(); + return AceType::RawPtr(frameNode); +#else + return {}; +#endif //WINDOW_SCENE_SUPPORTED +} +} // SecurityUIExtensionComponentModifier + +namespace SecurityUIExtensionComponentAttributeModifier { +void OnRemoteReadyImpl(Ark_NativePointer node, + const Opt_Callback_SecurityUIExtensionProxy_Void* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); +#ifdef WINDOW_SCENE_SUPPORTED + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + auto onRemoteReady = + [arkCallback = CallbackHelper(*optValue)](const Refptr& proxy) { + auto accessor = GetSecurityUIExtensionProxyAccessor(); + CHECK_NULL_VOID(accessor); + auto peer = accessor->ctor(); + CHECK_NULL_VOID(peer); + auto uiExtensionProxyPeerPtr = reinterpret_cast(peer); + uiExtensionProxyPeerPtr->SetProxy(proxy); + arkCallback.Invoke(peer); + }; + NG::SecurityUIExtensionstatic::SetSecurityOnRemoterReady(frameNode, std::move(onRemoteReady)); +#endif //WINDOW_SCENE_SUPPORTED +} +} // SecurityUIExtensionComponentAttributeModifier +const GENERATED_ArkUISecurityUIExtensionComponentModifier* GetSecurityUIExtensionComponentModifier() +{ + static const GENERATED_ArkUISecurityUIExtensionComponentModifier ArkUISecurityUIExtensionComponentModifierImpl { + SecurityUIExtensionComponentModifier::ConstructImpl, + SecurityUIExtensionComponentModifier::OnRemoteReadyImpl, + }; + return &ArkUISecurityUIExtensionComponentModifierImpl; +} +} \ No newline at end of file -- Gitee From 7ce906afa300519a032b94cf1a56fb50fff480f1 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 11:58:15 +0800 Subject: [PATCH 14/27] modify Signed-off-by: hanshu12138 --- .../native_security_ui_extension.cpp | 42 +++++++++---------- .../native_security_ui_extension.h | 12 +++--- .../native_ui_extension_common.cpp | 12 +++--- .../ui_extension/native_ui_extension_common.h | 8 ++-- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index a458ac7d59d..6d7c3411330 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -27,7 +27,7 @@ #endif //WINDOW_SCENE_SUPPORTED #include "want.h" -namesapce OHOS::Ace::Ani { +namespace OHOS::Ace::Ani { namespace { constexpr int32_t FOLLOW_HOST_DPI = 0; const char UI_EXTENSION_PLACEHOLDER_TYPE_INITIAL[] = "initPlaceholder"; @@ -76,7 +76,7 @@ ani_status NativeSecurityUiExtension::BindNativeSecurityUiExtensionComponent(ani "_SecurityUiextension_Set_OnReciveCallback", nullptr, reinterpret_cast(SetSecurityOnRecive)}, ani_native_function { - "_SecurityUiextension_Set_OnTermitationCallback", + "_SecurityUiextension_Set_OnTerminationCallback", nullptr, reinterpret_cast(SetSecurityOnTermitate)}, ani_native_function { "_SecurityUiextension_Set_OnReleaseCallback", @@ -91,7 +91,7 @@ ani_status NativeSecurityUiExtension::BindNativeSecurityUiExtensionComponent(ani "BindNativeSecurityUiExtensionComponent Class_BindNativeMethods failed," " className: %{public}s", className); return ANI_ERROR; - } + }; return ANI_OK; } @@ -118,7 +118,7 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( } bool isTransferringCaller = AniUtils::GetBoolOrUndefined(env, obj, "isTransferringCaller"); - bool isWindowModelFollowHost = AniUtils::GetBoolOrUndefined(env, obj, "isWindowModelFollowHost"); + bool isWindowModeFollowHost = AniUtils::GetBoolOrUndefined(env, obj, "isWindowModelFollowHost"); int32_t dpiFollowStrategy = -1; if (!AniUtils::GetIntByName(env, obj, "dpiFollowStrategy", dpiFollowStrategy)) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, @@ -155,11 +155,11 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "SetSecurityUiextensionOption isTransferringCaller: %{public}d, dpiFollowStrategy: %{public}d," "isWindowModeFollowHost: %{public}d, placeholderMap size: %{public}d", - isTransferringCaller, dpiFollowStrategy, isWindowModelFollowHost, static_cast(placeholderMap.size())); + isTransferringCaller, dpiFollowStrategy, isWindowModeFollowHost, static_cast(placeholderMap.size())); #ifdef WINDOW_SCENE_SUPPORTED bool densityDpi = (dpiFollowStrategy == FOLLOW_HOST_DPI) ? true : false; NG::SecurityUIExtensionStatic::UpdateSecurityUecConfig( - frameNode, isTransferringCaller, densityDpi, isWindowModelFollowHost, placeholderMap); + frameNode, isTransferringCaller, densityDpi, isWindowModeFollowHost, placeholderMap); #endif TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityUiextensionOption end"); @@ -167,7 +167,7 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( } -static ani_status NativeSecurityUiExtension::SetSecurityUiExtensionWant( +ani_status NativeSecurityUiExtension::SetSecurityUiExtensionWant( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj) { @@ -203,7 +203,7 @@ TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, return ANI_OK; } -static ani_status NativeSecurityUiExtension::SetSecurityOnError( +ani_status NativeSecurityUiExtension::SetSecurityOnError( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -268,7 +268,7 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnError( return ANI_OK; } -static ani_status NativeSecurityUiExtension::SetSecurityOnRecive( +ani_status NativeSecurityUiExtension::SetSecurityOnRecive( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -282,8 +282,8 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnRecive( } ani_ref onReciveRef = reinterpret_cast(callbackObj); - ani_ref onReciveGolbalRef; - env->GlobalReference_Create(onReciveRef, &onReciveGolbalRef); + ani_ref onReciveGlobalRef; + env->GlobalReference_Create(onReciveRef, &onReciveGlobalRef); ani_vm* vm = nullptr; env->GetVM(&vm); auto onReciveAniReadyCallbackInfo = std::make_shared(vm, onReciveGlobalRef); @@ -317,15 +317,15 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnRecive( env->FunctionalObject_Call(fnObj, tmp.size(), tmp.data(), &result); }; -#ifdef WINDOW_SCENE_SUPPRTED +#ifdef WINDOW_SCENE_SUPPORTED NG::SecurityUIExtensionStatic::SetSecurityOnReceive(frameNode, std::move(onReciveCallback)); -#endif //WINDOW_SCENE_SUPPRTED +#endif //WINDOW_SCENE_SUPPORTED TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityOnRecive end"); return ANI_OK; } -static ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( +ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -339,11 +339,11 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( } ani_ref onTerminateRef = reinterpret_cast(callbackObj); - ani_ref onTerminateGolbalRef; - env->GlobalReference_Create(onTerminateRef, &onTerminateGolbalRef); + ani_ref onTerminateGlobalRef; + env->GlobalReference_Create(onTerminateRef, &onTerminateGlobalRef); ani_vm* vm = nullptr; env->GetVM(&vm); - auto onTerminateAniReadyCallbackInfo = std::make_shared(vm, onTerminateGolbalRef); + auto onTerminateAniReadyCallbackInfo = std::make_shared(vm, onTerminateGlobalRef); auto onTerminateCallback = [env, onTerminateAniReadyCallbackInfo] (int32_t code, const RefPtr& wantWrap) { if (onTerminateAniReadyCallbackInfo == nullptr) { @@ -360,7 +360,7 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( return; } - AAAFwk::Want want; + AAFwk::Want want; if (wantWrap) { want = wantWrap->GetWant(); } @@ -393,7 +393,7 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( -static ani_status NativeSecurityUiExtension::SetSecurityOnRelease( +ani_status NativeSecurityUiExtension::SetSecurityOnRelease( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -402,7 +402,7 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnRelease( return ANI_OK; } -static ani_status NativeSecurityUiExtension::SetSecurityOnDrawReady( +ani_status NativeSecurityUiExtension::SetSecurityOnDrawReady( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { @@ -411,7 +411,7 @@ static ani_status NativeSecurityUiExtension::SetSecurityOnDrawReady( return ANI_OK; } -static ani_status NativeSecurityUiExtension::SetSecurityOnResult( +ani_status NativeSecurityUiExtension::SetSecurityOnResult( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h index cad9b2c0f06..b50ca449fc0 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_SECURITY_UI_EXTENSION -#define KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_SECURITY_UI_EXTENSION +#ifndef KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTESNION_NATIVE_SECURITY_UI_EXTESNION +#define KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTESNION_NATIVE_SECURITY_UI_EXTESNION #include "ani.h" @@ -40,7 +40,7 @@ private: static ani_status SetSecurityOnError( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); - static ani_status SetSecurityOnReceive( + static ani_status SetSecurityOnRecive( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); static ani_status SetSecurityOnTerminate( @@ -52,7 +52,7 @@ private: static ani_status SetSecurityOnDrawReady( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj); -} -} +}; +} // namespace OHOS::Ace::Ani -#endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_SECURITY_UI_EXTENSION \ No newline at end of file +#endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTESNION_NATIVE_SECURITY_UI_EXTESNION \ No newline at end of file diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp index d992bbc23ca..d304390b859 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp @@ -19,12 +19,12 @@ #include "ani_common_want.h" #include "../utils/ani_utils.h" #include "base/log/log_wrapper.h" -#ifdef WINDOWSCENE_SUPPORTED +#ifdef WINDOW_SCENE_SUPPORTED #include "core/components_ng/pattern/ui_extension/ui_extension_component/ui_extension_model_static.h" #include "core/interfaces/native/implementation/frame_node_peer_impl.h" #include "core/interfaces/native/implementation/ui_extension_proxy_peer.h" #include "frameworks/core/interfaces/native/implementation/ui_extension_proxy_peer_base.h" -#endif //WINDOWSCENE_SUPPORTED +#endif //WINDOW_SCENE_SUPPORTED #include "want.h" namespace OHOS::Ace::Ani { @@ -35,7 +35,7 @@ ani_status NativeUiExtensionCommon::BindNativeUiExtensionCommon(ani_env *env) ani_status ret = BindNativeUiExtensionProxy(env); if (ret != ANI_OK) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, - "BindNativeUiExtensionCommon failed"); + "BindNativeUiExtensionProxy failed"); return ret; } @@ -63,12 +63,12 @@ ani_status NativeUiExtensionCommon::BindNativeUiExtensionProxy(ani_env *env) "BindNativeUiExtensionProxy Class_BindNativeMethods failed," " className: %{public}s", className); return ANI_ERROR; - } + }; return ANI_OK; } -static ani_status NativeUiExtensionCommon::SendData( +ani_status NativeUiExtensionCommon::SendData( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj) { @@ -92,7 +92,7 @@ static ani_status NativeUiExtensionCommon::SendData( return ANI_OK; } -static ani_status NativeUiExtensionCommon::SendDataSync( +ani_object NativeUiExtensionCommon::SendDataSync( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj) { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h index 75d1530a165..9eadaec9147 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_UI_EXTENSION_COMMON -#define KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_UI_EXTENSION_COMMON +#ifndef KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTESNION_NATIVE_UI_EXTESNION_COMMON +#define KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTESNION_NATIVE_UI_EXTESNION_COMMON #include "ani.h" @@ -31,10 +31,10 @@ private: static ani_status SendData( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); - static ani_status SendDataSync( + static ani_object SendDataSync( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj); }; } // namespace OHOS::Ace::Ani -#endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTENSION_NATIVE_UI_EXTENSION_COMMON \ No newline at end of file +#endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_UI_EXTESNION_NATIVE_UI_EXTESNION_COMMON \ No newline at end of file -- Gitee From d15381a79999e896230c8c32db76149a781988b6 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 14:34:48 +0800 Subject: [PATCH 15/27] modify Signed-off-by: hanshu12138 --- .../component/securityUIExtensionComponent.ts | 42 +++++----- .../security_ui_extension_model_static.cpp | 4 +- .../security_ui_extension_model_static.h | 6 +- .../security_ui_extension_proxy_accessor.cpp | 82 +++++++++---------- 4 files changed, 67 insertions(+), 67 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts index a4c4169745c..a920ecdd345 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts @@ -16,8 +16,8 @@ // WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! -import { TypeChecker, ArkUIGeneratedNativeModule } from 'components' -import { Finalizable, runtimeType, SerializerBase, registerCallback, wrapCallback, toPeerPtr, KLong, KPointer, MaterializedBase, NativeBuffer, nullptr, KInt, KBoolean, KStringPtr, InteropNativeModule } from "@koalaui/interop" +import { TypeChecker, ArkUIGeneratedNativeModule } from "#components" +import { Finalizable, RuntimeType, SerializerBase, registerCallback, wrapCallback, toPeerPtr, KLong, KPointer, MaterializedBase, NativeBuffer, nullptr, KInt, KBoolean, KStringPtr, InteropNativeModule } from "@koalaui/interop" import { unsafeCast, int32, int64, float32 } from "@koalaui/common" import { Serializer } from "./peers/Serializer" import { CallbackKind } from "./peers/CallbackKind" @@ -115,7 +115,7 @@ export class SecurityUIExtensionProxyInternal implements MaterializedBase,Securi ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_onSyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) thisSerializer.release() } - private offAsyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + private offAsyncReceiverRegister_serialize(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { const thisSerializer : Serializer = Serializer.hold() let callback__type : int32 = RuntimeType.UNDEFINED callback__type = runtimeType(callback_) @@ -127,7 +127,7 @@ export class SecurityUIExtensionProxyInternal implements MaterializedBase,Securi ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_offAsyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) thisSerializer.release() } - private offSyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + private offSyncReceiverRegister_serialize(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { const thisSerializer : Serializer = Serializer.hold() let callback__type : int32 = RuntimeType.UNDEFINED callback__type = runtimeType(callback_) @@ -145,7 +145,7 @@ export class SecurityUIExtensionProxyInternal implements MaterializedBase,Securi return obj } } -class ArkSecurityUIExtensxionCallbackHelp { +class ArkSecurityUIExtensionCallbackHelp { onRemoteReady?: ((parameter: SecurityUIExtensionProxy) => void) onReceive?: ((param: Record) => void) onError?: ((e: BusinessError) => void) @@ -158,36 +158,36 @@ class ArkSecurityUIExtensxionCallbackHelp { } } -export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodsPeer { +export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodPeer { _callbackHelp?: ArkSecurityUIExtensionCallbackHelp; - protected constructor(peerPtr: KPointer, ind: int32, name: string = "", flags: int32 = 0) { - super(peerPtr, IdleDeadline, name, flags) + protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { + super(peerPtr, id, name, flags) this.InitArkSecurityUIExtensionCallbackHelp(); } public static create(component: ComponentBase | undefined, flags: int32 = 0): ArkSecurityUIExtensionComponentPeer { InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] create ArkUIExtensionComponentPeer start"); const peerId = PeerNode.nextId() const _peerPtr = ArkUIGeneratedNativeModule._SecurityUIExtensionComponent_construct(peerId, flags) - cosnt _peer = new ArkSecurityUIExtensionComponentPeer(_peerPtr, peerId, "UIExtensionComponent", flags) + const _peer = new ArkSecurityUIExtensionComponentPeer(_peerPtr, peerId, "UIExtensionComponent", flags) component?.setPeer(_peer) return _peer } InitArkSecurityUIExtensionCallbackHelp(): void { InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] InitArkUIExtensionCallback Help entry"); - this._callbackHelp = new ArkSecurityUIExtensxionCallbackHelp(); + this._callbackHelp = new ArkSecurityUIExtensionCallbackHelp(); } setSecurityUIExtensionComponentOptionsAttribute(want: AbilityWant, options?: SecurityUIExtensionOptions): void { InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] setUIExtensionComponentOptionsAttribute entry"); if (options != undefined) { let innerOption : ArkUIAniUIExtensionOptions = new ArkUIAniUIExtensionOptions(); if (options.isTransferringCaller != undefined) { - innterOptions.isTransferringCaller = (options.isTransferringCaller) as boolean; + innerOption.isTransferringCaller = (options.isTransferringCaller) as boolean; } if (options.dpiFollowStrategy != undefined) { innerOption.dpiFollowStrategy = (options.dpiFollowStrategy as SecurityDpiFollowStrategy).valueOf(); } - ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_Option(this.setSecurityUIExtensionComponentOptionsAttribute.prototype, innerOption); + ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_Option(this.peer.ptr, innerOption); } ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_Want(this.peer.ptr, want); @@ -201,14 +201,14 @@ export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodsPeer { const value_value = value! thisSerializer.holdAndWriteCallback(value_value) } - ArkUIGeneratedNativeModule._SecurityUIExtensionComponentAttribute_onRemoteRead(this.setSecurityUIExtensionComponentOptionsAttribute.prototype, thisSerializer.asBuffer(), thisSerializer.writeLength()) + ArkUIGeneratedNativeModule._SecurityUIExtensionComponentAttribute_onRemoteReady(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) thisSerializer.release() } onReceiveAttribute(value: ((parameter: Record) => void) | undefined): void { const help = this._callbackHelp; if (help != undefined && help != null) { help.onReceive = value; - ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_OnReciveCallback(this.setSecurityUIExtensionComponentOptionsAttribute.prototype, (param: Record) => { + ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_OnReciveCallback(this.peer.ptr, (param: Record) => { const onReceive = this._callbackHelp?.onReceive; if (onReceive !== undefined && onReceive !== null) { const innerParam = param; @@ -223,14 +223,14 @@ export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodsPeer { if (help != undefined && help != null) { help.onError = value; ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnErrorCallback( - this.setSecurityUIExtensionComponentOptionsAttribute.prototype, (code1: number, name1: string, message1: string) => { + this.peer.ptr, (code1: number, name1: string, message1: string) => { const onError = this._callback_Help?.onError; if (onError !== undefined && onError !== null) { const param = { - code: 1, + code: code1, name: name1, message: message1 - } as BusinessError + } as TerminationInfo onError(param); } }); @@ -266,7 +266,7 @@ export enum SecurityWindowModeFollowStrategy { export interface SecurityUIExtensionOptions { isTransferringCaller?: boolean; dpiFollowStrategy?: SecurityDpiFollowStrategy; - windowModelFollowStrategy?: SecurityWindowModeFollowStrategy; + windowModeFollowStrategy?: SecurityWindowModeFollowStrategy; } export type Callback_SecurityUIExtensionProxy_Void = (parameter: SecurityUIExtensionProxy) => void; export type SecurityUIExtensionComponentInterface = (want: AbilityWant, options?: SecurityUIExtensionOptions) => SecurityUIExtensionComponentAttribute; @@ -330,9 +330,9 @@ export class ArkSecurityUIExtensionComponentComponent extends ArkCommonMethodCom } return this } - public onError(value: ErrorCallback | undefined): this { + public onError(value: ((e: BusinessError) => void) | undefined): this { if (this.checkPriority("onError")) { - const value_casted = value as (ErrorCallback | undefined) + const value_casted = value as (((e: BusinessError) => void) | undefined) this.getPeer()?.onErrorAttribute(value_casted) return this } @@ -364,7 +364,7 @@ export function SecurityUIExtensionComponent( return new ArkSecurityUIExtensionComponentComponent() }) NodeAttach((): ArkSecurityUIExtensionComponentPeer => ArkSecurityUIExtensionComponentPeer.create(receiver), (_: ArkSecurityUIExtensionComponentPeer) => { - receiver.setUIExtensionComponentOptions(want,options) + receiver.setSecurityUIExtensionComponentOptions(want,options) style?.(receiver) content_?.() receiver.applyAttributesFinish() diff --git a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp index 749e61c42e2..0ffab9a4054 100644 --- a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp +++ b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.cpp @@ -79,12 +79,12 @@ void SecurityUIExtensionStatic::SetSecurityOnRelease( } void SecurityUIExtensionStatic::SetSecurityOnRemoteReady(FrameNode* frameNode, - std::function&)>&& OnRemoteReady) + std::function&)>&& onRemoteReady) { CHECK_NULL_VOID(frameNode); auto eventHub = frameNode->GetEventHub(); CHECK_NULL_VOID(eventHub); - eventHub->SetOnRemoteReadyCallback(std::move(OnRemoteReady)); + eventHub->SetOnRemoteReadyCallback(std::move(onRemoteReady)); } void SecurityUIExtensionStatic::SetSecurityOnResult( diff --git a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h index 7558f346552..610ee31c162 100644 --- a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h +++ b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SUEC_SECURITY_UI_EXTENSION_STATIC_H -#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SUEC_SECURITY_UI_EXTENSION_STATIC_H +#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SECURITY_SECURITY_UI_EXTENSION_STATIC_H +#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SECURITY_SECURITY_UI_EXTENSION_STATIC_H #include #include @@ -49,4 +49,4 @@ public: static void SetSecurityOnDrawReady(FrameNode* frameNode, std::function&& onDrawReady); }; } // namespace OHOS::Ace::NG -#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SUEC_SECURITY_UI_EXTENSION_STATIC_H \ No newline at end of file +#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SECURITY_SECURITY_UI_EXTENSION_STATIC_H \ No newline at end of file diff --git a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp index a0cc0194144..6ee35ebb941 100644 --- a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp +++ b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_accessor.cpp @@ -20,7 +20,7 @@ #include "frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h" -namespace SecurityUIExtensionProxyAccessor { +namespace OHOS::Ace::NG::GeneratedModifier { const GENERATED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor(); namespace SecurityUIExtensionProxyAccessor { void DestroyPeerImpl(Ark_SecurityUIExtensionProxy peer) @@ -41,7 +41,7 @@ void SendImpl(Ark_SecurityUIExtensionProxy peer, const Map_String_Object* data) { LOGE("SecurityUIExtensionProxyAccessor::SendImpl - implement by ANI"); } -Map_String_Object SendSyncImpl(Ark_VMContxt vmContext, +Map_String_Object SendSyncImpl(Ark_VMContext vmContext, Ark_SecurityUIExtensionProxy peer, const Map_String_Object* data) { LOGE("SecurityUIExtensionProxyAccessor::SendSyncImpl - implement by ANI"); @@ -98,54 +98,54 @@ void OnSyncReceiverRegisterImpl(Ark_SecurityUIExtensionProxy peer, void OffAsyncReceiverRegisterImpl(Ark_SecurityUIExtensionProxy peer, const Opt_Callback_SecurityUIExtensionProxy_Void* callback_) { - #ifdef WINDOW_SCENE_SUPPORTED - CHECK_NULL_VOID(peer); - CHECK_NULL_VOID(callback_); - auto cb = Converter::OptConvert(*callback_); - std::lock_guard lock(peer->callbackListLock_); - if (cb) { - peer->DeleteAsyncCallbackFromList(cb.value().resource.resourceId); - } else { - peer->ClearAsyncCallbackList(); - } - auto pattern = peer->GetPattern(); - CHECK_NULL_VOID(pattern); - auto funcList = peer->GetOnAsyncCallbackList(); - pattern->SetAsyncCallbacks(std::move(funcList)); - #endif //WINDOW_SCENE_SUPPORTED +#ifdef WINDOW_SCENE_SUPPORTED + CHECK_NULL_VOID(peer); + CHECK_NULL_VOID(callback_); + auto cb = Converter::OptConvert(*callback_); + std::lock_guard lock(peer->callbackListLock_); + if (cb) { + peer->DeleteAsyncCallbackFromList(cb.value().resource.resourceId); + } else { + peer->ClearAsyncCallbackList(); + } + auto pattern = peer->GetPattern(); + CHECK_NULL_VOID(pattern); + auto funcList = peer->GetOnAsyncCallbackList(); + pattern->SetAsyncCallbacks(std::move(funcList)); +#endif //WINDOW_SCENE_SUPPORTED } void OffSyncReceiverRegisterImpl(Ark_SecurityUIExtensionProxy peer, const Opt_Callback_SecurityUIExtensionProxy_Void* callback_) { - #ifdef WINDOW_SCENE_SUPPORTED - CHECK_NULL_VOID(peer); - CHECK_NULL_VOID(callback_); - auto cb = Converter::OptConvert(*callback_); - std::lock_guard lock(peer->callbackListLock_); - if (cb) { - peer->DeleteSyncCallbackFromList(cb.value().resource.resourceId); - } else { - peer->ClearSyncCallbackList(); - } - auto pattern = peer->GetPattern(); - CHECK_NULL_VOID(pattern); - auto funcList = peer->GetOnSyncCallbackList(); - pattern->SetSyncCallbacks(std::move(funcList)); - #endif //WINDOW_SCENE_SUPPORTED +#ifdef WINDOW_SCENE_SUPPORTED + CHECK_NULL_VOID(peer); + CHECK_NULL_VOID(callback_); + auto cb = Converter::OptConvert(*callback_); + std::lock_guard lock(peer->callbackListLock_); + if (cb) { + peer->DeleteSyncCallbackFromList(cb.value().resource.resourceId); + } else { + peer->ClearSyncCallbackList(); + } + auto pattern = peer->GetPattern(); + CHECK_NULL_VOID(pattern); + auto funcList = peer->GetOnSyncCallbackList(); + pattern->SetSyncCallbacks(std::move(funcList)); +#endif //WINDOW_SCENE_SUPPORTED } } // SecurityUIExtensionProxyAccessor const GENERATED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor() { static const GENERATED_ArkUISecurityUIExtensionProxyAccessor SecurityUIExtensionProxyAccessorImpl { - GetSecurityUIExtensionProxyAccessor::DestroyPeerImpl, - GetSecurityUIExtensionProxyAccessor::CtorImpl, - GetSecurityUIExtensionProxyAccessor::GetFinalizerImpl, - GetSecurityUIExtensionProxyAccessor::SendImpl, - GetSecurityUIExtensionProxyAccessor::SendSyncImpl, - GetSecurityUIExtensionProxyAccessor::OnAsyncReceiverRegisterImpl, - GetSecurityUIExtensionProxyAccessor::OnSyncReceiverRegisterImpl, - GetSecurityUIExtensionProxyAccessor::OffAsyncReceiverRegisterImpl, - GetSecurityUIExtensionProxyAccessor::OffSyncReceiverRegisterImpl, + SecurityUIExtensionProxyAccessor::DestroyPeerImpl, + SecurityUIExtensionProxyAccessor::CtorImpl, + SecurityUIExtensionProxyAccessor::GetFinalizerImpl, + SecurityUIExtensionProxyAccessor::SendImpl, + SecurityUIExtensionProxyAccessor::SendSyncImpl, + SecurityUIExtensionProxyAccessor::OnAsyncReceiverRegisterImpl, + SecurityUIExtensionProxyAccessor::OnSyncReceiverRegisterImpl, + SecurityUIExtensionProxyAccessor::OffAsyncReceiverRegisterImpl, + SecurityUIExtensionProxyAccessor::OffSyncReceiverRegisterImpl, }; return &SecurityUIExtensionProxyAccessorImpl; } -- Gitee From 538943e577c8cc2b3c88d06534bce705930e1484 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 14:39:57 +0800 Subject: [PATCH 16/27] modify Signed-off-by: hanshu12138 --- .../security_ui_extension_proxy_peer.cpp | 4 ++-- .../security_ui_extension_proxy_peer.h | 14 +++++++------- .../security_uiextension_component_modifier.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp index d3d09a2c561..c3d33635384 100644 --- a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp +++ b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.cpp @@ -33,9 +33,9 @@ int32_t SecurityUIExtensionProxyPeerImpl::SendDataSync( const AAFwk::WantParams& wantParams, AAFwk::WantParams& reWantParams) { if (proxy_ == nullptr) { - return; + return 0; } - proxy_->SendDataSync(wantParams, reWantParams); + return proxy_->SendDataSync(wantParams, reWantParams); } #endif //WINDOW_SCENE_SUPPORTED } // namespace OHOS::Ace::NG::GeneratedModifier \ No newline at end of file diff --git a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h index 447f72be835..1922aaa1846 100644 --- a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h +++ b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h @@ -29,7 +29,7 @@ struct SecurityUIExtensionProxyPeerImpl : public AceType { #endif #ifdef WINDOW_SCENE_SUPPORTED using ProxyRefPtr = OHOS::Ace::RefPtr; - using CallbackFunc = std::function; + using CallbackFunc = std::function; using CallbackFuncPairList = std::list>; using PatternRefPtr = OHOS::Ace::RefPtr; #endif //WINDOW_SCENE_SUPPORTED @@ -72,7 +72,7 @@ struct SecurityUIExtensionProxyPeerImpl : public AceType { inline void AddAsyncCallbackToList(int32_t id, const CallbackFunc& onFunc) { - auto iter = FundCallback(id, onAsyncCallbackList_); + auto iter = FindCallback(id, onAsyncCallbackList_); if (iter == onAsyncCallbackList_.end()) { onAsyncCallbackList_.emplace_back(std::make_pair(id, onFunc)); } @@ -80,7 +80,7 @@ struct SecurityUIExtensionProxyPeerImpl : public AceType { inline void AddSyncCallbackToList(int32_t id, const CallbackFunc& onFunc) { - auto iter = FundCallback(id, onSyncCallbackList_); + auto iter = FindCallback(id, onSyncCallbackList_); if (iter == onSyncCallbackList_.end()) { onSyncCallbackList_.emplace_back(std::make_pair(id, onFunc)); } @@ -88,8 +88,8 @@ struct SecurityUIExtensionProxyPeerImpl : public AceType { inline void DeleteSyncCallbackFromList(int32_t id) { - auto iter = FundCallback(id, onSyncCallbackList_); - if (iter == onSyncCallbackList_.end()) { + auto iter = FindCallback(id, onSyncCallbackList_); + if (iter != onSyncCallbackList_.end()) { onSyncCallbackList_.erase(iter); } } @@ -101,8 +101,8 @@ struct SecurityUIExtensionProxyPeerImpl : public AceType { inline void DeleteAsyncCallbackFromList(int32_t id) { - auto iter = FundCallback(id, onAsyncCallbackList_); - if (iter == onAsyncCallbackList_.end()) { + auto iter = FindCallback(id, onAsyncCallbackList_); + if (iter != onAsyncCallbackList_.end()) { onAsyncCallbackList_.erase(iter); } } diff --git a/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp index e52064995c7..5fe03e48d64 100644 --- a/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp +++ b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#ifdef WINDOW_SCENE_SUPORTED +#ifdef WINDOW_SCENE_SUPPORTED #include "core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h" #include "core/interfaces/native/implementation/security_ui_extension_proxy_peer.h" #endif @@ -25,7 +25,7 @@ namespace OHOS::Ace::NG::GeneratedModifier { #ifdef WINDOW_SCENE_SUPPORTED -cosnt GENERAGED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor(); +const GENERATED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor(); #endif //WINDOW_SCENE_SUPPORTED } @@ -68,7 +68,7 @@ void OnRemoteReadyImpl(Ark_NativePointer node, uiExtensionProxyPeerPtr->SetProxy(proxy); arkCallback.Invoke(peer); }; - NG::SecurityUIExtensionstatic::SetSecurityOnRemoterReady(frameNode, std::move(onRemoteReady)); + NG::SecurityUIExtensionStatic::SetSecurityOnRemoteReady(frameNode, std::move(onRemoteReady)); #endif //WINDOW_SCENE_SUPPORTED } } // SecurityUIExtensionComponentAttributeModifier @@ -76,7 +76,7 @@ const GENERATED_ArkUISecurityUIExtensionComponentModifier* GetSecurityUIExtensio { static const GENERATED_ArkUISecurityUIExtensionComponentModifier ArkUISecurityUIExtensionComponentModifierImpl { SecurityUIExtensionComponentModifier::ConstructImpl, - SecurityUIExtensionComponentModifier::OnRemoteReadyImpl, + SecurityUIExtensionComponentAttributeModifier::OnRemoteReadyImpl, }; return &ArkUISecurityUIExtensionComponentModifierImpl; } -- Gitee From 6de98808c3d7ac7cdea9836941ca7602df1d6347 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 16:56:31 +0800 Subject: [PATCH 17/27] modify Signed-off-by: hanshu12138 --- .../ui_extension/ani_uiextension_module.cpp | 10 +++---- .../native_security_ui_extension.cpp | 4 +-- .../native_security_ui_extension.h | 4 +-- .../component/securityUIExtensionComponent.ts | 26 +++++++++---------- .../security_ui_extension_model_static.h | 8 +++--- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp index cf8e75e21dd..9c4b3c6d110 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/ani_uiextension_module.cpp @@ -38,24 +38,24 @@ ANI_EXPORT ani_status ANI_Constructor(ani_vm* vm, uint32_t* result) return ani_status; } - ani_status = OHOS::Ace::Ani::NativeUiExtension::BindNativeSecurityUiExtension(env); + ani_status = OHOS::Ace::Ani::NativeSecurityUiExtension::BindNativeSecurityUiExtension(env); if (ani_status != ANI_OK) { - TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "BindNativeSecurityUiExtension failed when ANI_Constructor"); return ani_status; } ani_status = OHOS::Ace::Ani::NativeDynamicModule::BindNativeDynamicModule(env); if (ani_status != ANI_OK) { - TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_DYNAMIC_COMPONENT, "BindNativeDynamicModule failed when ANI_Constructor"); return ani_status; } - ani_status = OHOS::Ace::Ani::NativeUiExtension::BindNativeUiExtensionCommon(env); + ani_status = OHOS::Ace::Ani::NativeUiExtensionCommon::BindNativeUiExtensionCommon(env); if (ani_status != ANI_OK) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, - "BindNativeUiExtensionCommon failed when ANI_Constructor"); + "BindNativeUiExtensionCommon failed"); return ani_status; } diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index 6d7c3411330..ad6d77332a0 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -77,7 +77,7 @@ ani_status NativeSecurityUiExtension::BindNativeSecurityUiExtensionComponent(ani nullptr, reinterpret_cast(SetSecurityOnRecive)}, ani_native_function { "_SecurityUiextension_Set_OnTerminationCallback", - nullptr, reinterpret_cast(SetSecurityOnTermitate)}, + nullptr, reinterpret_cast(SetSecurityOnTerminate)}, ani_native_function { "_SecurityUiextension_Set_OnReleaseCallback", nullptr, reinterpret_cast(SetSecurityOnRelease)}, @@ -118,7 +118,7 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( } bool isTransferringCaller = AniUtils::GetBoolOrUndefined(env, obj, "isTransferringCaller"); - bool isWindowModeFollowHost = AniUtils::GetBoolOrUndefined(env, obj, "isWindowModelFollowHost"); + bool isWindowModeFollowHost = AniUtils::GetBoolOrUndefined(env, obj, "isWindowModeFollowHost"); int32_t dpiFollowStrategy = -1; if (!AniUtils::GetIntByName(env, obj, "dpiFollowStrategy", dpiFollowStrategy)) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h index b50ca449fc0..bd93ebc383d 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.h @@ -28,10 +28,10 @@ public: private: // SecurityUiExtensionModal - static ani_status SetSecurityUiExtensionOption( + static ani_status SetSecurityUiextensionOption( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj); - static ani_status SetSecurityUiExtensionWant( + static ani_status SetSecurityUiextensionWant( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj); static ani_status SetSecurityOnResult( diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts index a920ecdd345..24f52399b50 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts @@ -17,7 +17,7 @@ // WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! import { TypeChecker, ArkUIGeneratedNativeModule } from "#components" -import { Finalizable, RuntimeType, SerializerBase, registerCallback, wrapCallback, toPeerPtr, KLong, KPointer, MaterializedBase, NativeBuffer, nullptr, KInt, KBoolean, KStringPtr, InteropNativeModule } from "@koalaui/interop" +import { Finalizable, runtimeType, RuntimeType, SerializerBase, registerCallback, wrapCallback, toPeerPtr, KLong, KPointer, MaterializedBase, NativeBuffer, nullptr, KInt, KBoolean, KStringPtr, InteropNativeModule } from "@koalaui/interop" import { unsafeCast, int32, int64, float32 } from "@koalaui/common" import { Serializer } from "./peers/Serializer" import { CallbackKind } from "./peers/CallbackKind" @@ -109,7 +109,7 @@ export class SecurityUIExtensionProxyInternal implements MaterializedBase,Securi ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_onAsyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) thisSerializer.release() } - private onsyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { + private onSyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { const thisSerializer : Serializer = Serializer.hold() thisSerializer.holdAndWriteCallback(callback_) ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_onSyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) @@ -173,7 +173,7 @@ export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodPeer { return _peer } InitArkSecurityUIExtensionCallbackHelp(): void { - InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] InitArkUIExtensionCallback Help entry"); + InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] InitArkUIExtensionCallbackHelp entry"); this._callbackHelp = new ArkSecurityUIExtensionCallbackHelp(); } setSecurityUIExtensionComponentOptionsAttribute(want: AbilityWant, options?: SecurityUIExtensionOptions): void { @@ -187,7 +187,7 @@ export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodPeer { if (options.dpiFollowStrategy != undefined) { innerOption.dpiFollowStrategy = (options.dpiFollowStrategy as SecurityDpiFollowStrategy).valueOf(); } - ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_Option(this.peer.ptr, innerOption); + ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_Option(this.peer.ptr, innerOption); } ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_Want(this.peer.ptr, want); @@ -208,7 +208,7 @@ export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodPeer { const help = this._callbackHelp; if (help != undefined && help != null) { help.onReceive = value; - ArkUIAniSecurityUiextensionModal._SecurityUIextension_Set_OnReciveCallback(this.peer.ptr, (param: Record) => { + ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnReciveCallback(this.peer.ptr, (param: Record) => { const onReceive = this._callbackHelp?.onReceive; if (onReceive !== undefined && onReceive !== null) { const innerParam = param; @@ -224,31 +224,31 @@ export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodPeer { help.onError = value; ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnErrorCallback( this.peer.ptr, (code1: number, name1: string, message1: string) => { - const onError = this._callback_Help?.onError; + const onError = this._callbackHelp?.onError; if (onError !== undefined && onError !== null) { const param = { - code: code1, + code: 1, name: name1, message: message1 - } as TerminationInfo + } as BusinessError onError(param); } }); } } - onTerminateAttribute(value: ((parameter: TerminationInfo) => void) | undefined): void { + onTerminatedAttribute(value: ((parameter: TerminationInfo) => void) | undefined): void { const help = this._callbackHelp; if (help !== undefined && help !== null) { help.onTerminated = value; InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] _SecurityUiextension_Set_OnTerminationCallback entry"); ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnTerminationCallback( - this.setSecurityUIExtensionComponentOptionsAttribute.prototype, (code1: number, want1 : AbilityWant) => { + this.peer.ptr, (code1: number, want1 : AbilityWant) => { const onTerminated = this._callbackHelp?.onTerminated; if (onTerminated !== undefined && onTerminated !== null) { const param = { - code: 1, + code: code1, want: want1 - } as BusinessError + } as TerminationInfo onTerminated(param); } }); @@ -273,7 +273,7 @@ export type SecurityUIExtensionComponentInterface = (want: AbilityWant, options? export interface SecurityUIExtensionComponentAttribute extends CommonMethod { onRemoteReady(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): this onReceive(value: ((parameter: Record) => void) | undefined): this - onError(value: ((e:BusinessError) => void) | undefined): this + onError(value: ((e: BusinessError) => void) | undefined): this onTerminated(value: ((parameter: TerminationInfo) => void) | undefined): this } export class ArkSecurityUIExtensionComponentStyle extends ArkCommonMethodStyle implements SecurityUIExtensionComponentAttribute { diff --git a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h index 610ee31c162..6ed932eb0f3 100644 --- a/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h +++ b/frameworks/core/components_ng/pattern/ui_extension/security_ui_extension_component/security_ui_extension_model_static.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SECURITY_SECURITY_UI_EXTENSION_STATIC_H -#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SECURITY_SECURITY_UI_EXTENSION_STATIC_H +#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_SECURITY_UI_EXTENSION_SECURITY_UI_EXTENSION_STATIC_H +#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_SECURITY_UI_EXTENSION_SECURITY_UI_EXTENSION_STATIC_H #include #include @@ -42,11 +42,11 @@ public: std::function&& onReceive); static void SetSecurityOnRelease(FrameNode* frameNode, std::function&& onRelease); static void SetSecurityOnRemoteReady(FrameNode* frameNode, - std::function&)>&& OnRemoteReady); + std::function&)>&& onRemoteReady); static void SetSecurityOnResult(FrameNode* frameNode, std::function&& onResult); static void SetSecurityOnTerminated(FrameNode* frameNode, std::function&)>&& onTerminated); static void SetSecurityOnDrawReady(FrameNode* frameNode, std::function&& onDrawReady); }; } // namespace OHOS::Ace::NG -#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_UI_EXTENSION_SECURITY_SECURITY_UI_EXTENSION_STATIC_H \ No newline at end of file +#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_SECURITY_UI_EXTENSION_SECURITY_UI_EXTENSION_STATIC_H \ No newline at end of file -- Gitee From f9fa29acffab363e8eb7f4fece64e69830048ef6 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 16:58:35 +0800 Subject: [PATCH 18/27] modify Signed-off-by: hanshu12138 --- .../security_uiextension_component_modifier.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp index 5fe03e48d64..b48a04daa0f 100644 --- a/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp +++ b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp @@ -26,7 +26,7 @@ namespace OHOS::Ace::NG::GeneratedModifier { #ifdef WINDOW_SCENE_SUPPORTED const GENERATED_ArkUISecurityUIExtensionProxyAccessor* GetSecurityUIExtensionProxyAccessor(); -#endif //WINDOW_SCENE_SUPPORTED +#endif // WINDOW_SCENE_SUPPORTED } namespace OHOS::Ace::NG::GeneratedModifier { @@ -59,7 +59,7 @@ void OnRemoteReadyImpl(Ark_NativePointer node, return; } auto onRemoteReady = - [arkCallback = CallbackHelper(*optValue)](const Refptr& proxy) { + [arkCallback = CallbackHelper(*optValue)](const RefPtr& proxy) { auto accessor = GetSecurityUIExtensionProxyAccessor(); CHECK_NULL_VOID(accessor); auto peer = accessor->ctor(); -- Gitee From 36e9b83ee46f09764671ac22a50b160c1cf58ae1 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 17:36:35 +0800 Subject: [PATCH 19/27] modify Signed-off-by: hanshu12138 --- .../ui_extension/native_security_ui_extension.cpp | 14 +++++++------- .../ui_extension/native_ui_extension_common.cpp | 2 +- .../security_ui_extension_proxy_peer.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index ad6d77332a0..4647785655d 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -141,13 +141,13 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( } auto* frameNodePeerRaw = reinterpret_cast(placeholder); if (frameNodePeerRaw == nullptr) { - TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "Get frameNodePeer failed."); + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "Get FrameNodePeer failed."); continue; } auto nodeWeak = frameNodePeerRaw->weakNode; auto upgradePtr = nodeWeak.Upgrade(); if (!upgradePtr) { - TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "Get frameNode RefPtr failed."); + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "Get FrameNode RefPtr failed."); continue; } placeholderMap.insert({type, upgradePtr}); @@ -167,7 +167,7 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( } -ani_status NativeSecurityUiExtension::SetSecurityUiExtensionWant( +ani_status NativeSecurityUiExtension::SetSecurityUiextensionWant( [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj) { @@ -176,7 +176,7 @@ ani_status NativeSecurityUiExtension::SetSecurityUiExtensionWant( auto frameNode = reinterpret_cast(pointer); if (frameNode == nullptr) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, - "frameNode is null when SetSecurityUiExtensionWant"); + "frameNode is null when SetSecurityUiextensionWant"); return ANI_ERROR; } @@ -198,8 +198,8 @@ ani_status NativeSecurityUiExtension::SetSecurityUiExtensionWant( #ifdef WINDOW_SCENE_SUPPORTED NG::SecurityUIExtensionStatic::UpdateSecurityWant(frameNode, want); #endif //WINDOW_SCENE_SUPPORTED -TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, - "NativeUiExtension SetSecurityUiextensionWant end"); + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, + "NativeUiExtension SetSecurityUiextensionWant end"); return ANI_OK; } @@ -217,7 +217,7 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( } ani_ref onErrorRef = reinterpret_cast(callbackObj); - ani_ref onErrorGlobalref; + ani_ref onErrorGlobalRef; env->GlobalReference_Create(onErrorRef, &onErrorGlobalref); ani_vm* vm = nullptr; env->GetVM(&vm); diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp index d304390b859..b293c5e121d 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp @@ -98,7 +98,7 @@ ani_object NativeUiExtensionCommon::SendDataSync( { ani_object result_obj = {}; auto uIExtensionProxyPeer = - reinterpret_cast(pointer); + reinterpret_cast(pointer); if (uIExtensionProxyPeer == nullptr) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_UIEXTENSIONCOMPONENT, "uIExtensionProxyPeer is null when SendDataSync"); diff --git a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h index 1922aaa1846..fda34dd5e07 100644 --- a/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h +++ b/frameworks/core/interfaces/native/implementation/security_ui_extension_proxy_peer.h @@ -128,4 +128,4 @@ private: } // namespace OHOS::Ace::NG::GeneratedModifier struct SecurityUIExtensionProxyPeer : public OHOS::Ace::NG::GeneratedModifier::SecurityUIExtensionProxyPeerImpl {}; -#endif //FOUNDATION_ARKUI_ACE_ENGINE_FRAMEWORKS_CORE_INTERFACES_NATIVE_IMPL_SECURITY_UI_EXTENSION_PROXY_PEER_H +#endif // FOUNDATION_ARKUI_ACE_ENGINE_FRAMEWORKS_CORE_INTERFACES_NATIVE_IMPL_SECURITY_UI_EXTENSION_PROXY_PEER_H -- Gitee From 9ac7ebc8ddf3afd787c7cffc916b67229e67dad5 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 20:25:25 +0800 Subject: [PATCH 20/27] modify Signed-off-by: hanshu12138 --- .../ani/native/ui_extension/native_security_ui_extension.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index 4647785655d..d918d73e7be 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -218,7 +218,7 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( ani_ref onErrorRef = reinterpret_cast(callbackObj); ani_ref onErrorGlobalRef; - env->GlobalReference_Create(onErrorRef, &onErrorGlobalref); + env->GlobalReference_Create(onErrorRef, &onErrorGlobalRef); ani_vm* vm = nullptr; env->GetVM(&vm); auto onErrorAniReadyCallbackInfo = std::make_shared(vm, onErrorGlobalRef); -- Gitee From c2e21ef5975f0d6217c62f1b491cd17d8c129523 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 20:49:29 +0800 Subject: [PATCH 21/27] modify codecheck Signed-off-by: hanshu12138 --- .../native_security_ui_extension.cpp | 50 ++++++++++++------- ...ecurity_uiextension_component_modifier.cpp | 1 - 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index d918d73e7be..6f856dad7c1 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -96,8 +96,10 @@ ani_status NativeSecurityUiExtension::BindNativeSecurityUiExtensionComponent(ani } ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object obj) { TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityUiextensionOption start"); @@ -204,8 +206,10 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionWant( } ani_status NativeSecurityUiExtension::SetSecurityOnError( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object callbackObj) { TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityOnError start"); @@ -239,7 +243,7 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( } auto fnObj = reinterpret_cast(onErrorGlobalRef); - auto codeArgs = AniUtils::CreateDouble(env, code); // TODO : Change to CreateInt + auto codeArgs = AniUtils::CreateDouble(env, code); if (codeArgs == nullptr) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "CreateDouble failed when onErrorCallback"); @@ -269,8 +273,10 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( } ani_status NativeSecurityUiExtension::SetSecurityOnRecive( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object callbackObj) { TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityOnRecive start"); @@ -326,8 +332,10 @@ ani_status NativeSecurityUiExtension::SetSecurityOnRecive( } ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object callbackObj) { TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityOnTerminate start"); @@ -379,8 +387,9 @@ ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( } ani_ref result; - std::vector tmp = - { reinterpret_cast(codeArgs), reinterpret_cast(wantArgs)}; + std::vector tmp = { + reinterpret_cast(codeArgs), reinterpret_cast(wantArgs) + }; env->FunctionalObject_Call(fnObj, tmp.size(), tmp.data(), &result); }; #ifdef WINDOW_SCENE_SUPPORTED @@ -392,10 +401,11 @@ ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( } - ani_status NativeSecurityUiExtension::SetSecurityOnRelease( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object callbackObj) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityOnRelease not supported now."); @@ -403,8 +413,10 @@ ani_status NativeSecurityUiExtension::SetSecurityOnRelease( } ani_status NativeSecurityUiExtension::SetSecurityOnDrawReady( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object callbackObj) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityOnDrawReady not supported now."); @@ -412,8 +424,10 @@ ani_status NativeSecurityUiExtension::SetSecurityOnDrawReady( } ani_status NativeSecurityUiExtension::SetSecurityOnResult( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object callbackObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object callbackObj) { TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurity OnResult not supported now."); diff --git a/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp index b48a04daa0f..ecb641ce276 100644 --- a/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp +++ b/frameworks/core/interfaces/native/implementation/security_uiextension_component_modifier.cpp @@ -55,7 +55,6 @@ void OnRemoteReadyImpl(Ark_NativePointer node, #ifdef WINDOW_SCENE_SUPPORTED auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // TODO: Reset value return; } auto onRemoteReady = -- Gitee From 8248b2a7894ad559b3dd3d8d4e3a99a9d8efe688 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Thu, 7 Aug 2025 21:40:31 +0800 Subject: [PATCH 22/27] modify codecheck Signed-off-by: hanshu12138 --- .../ui_extension/native_ui_extension_common.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp index b293c5e121d..653c35dae98 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_ui_extension_common.cpp @@ -69,8 +69,10 @@ ani_status NativeUiExtensionCommon::BindNativeUiExtensionProxy(ani_env *env) } ani_status NativeUiExtensionCommon::SendData( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object paramObj) { auto uIExtensionProxyPeer = reinterpret_cast(pointer); @@ -93,8 +95,10 @@ ani_status NativeUiExtensionCommon::SendData( } ani_object NativeUiExtensionCommon::SendDataSync( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object paramObj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object paramObj) { ani_object result_obj = {}; auto uIExtensionProxyPeer = -- Gitee From 4ffbd43c9d1eb0b0dd8d7468a1bbc1349e1fa250 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Fri, 8 Aug 2025 09:46:05 +0800 Subject: [PATCH 23/27] modify codecheck Signed-off-by: hanshu12138 --- .../native/ui_extension/native_security_ui_extension.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index 6f856dad7c1..c1328432994 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -170,8 +170,10 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( ani_status NativeSecurityUiExtension::SetSecurityUiextensionWant( - [[maybe_unused]] ani_env* env, [[maybe_unused]] ani_object object, - [[maybe_unused]] ani_long pointer, [[maybe_unused]] ani_object obj) + [[maybe_unused]] ani_env* env, + [[maybe_unused]] ani_object object, + [[maybe_unused]] ani_long pointer, + [[maybe_unused]] ani_object obj) { TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityUiextensionWant start"); -- Gitee From e7d1d0ffdb927062b6626ff5cd490722f2d997fe Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Sat, 9 Aug 2025 14:22:33 +0800 Subject: [PATCH 24/27] modify codecheck Signed-off-by: hanshu12138 --- .../native_security_ui_extension.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp index c1328432994..68287a99656 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/ui_extension/native_security_ui_extension.cpp @@ -105,11 +105,9 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( "NativeUiExtension SetSecurityUiextensionOption start"); auto frameNode = reinterpret_cast(pointer); if (frameNode == nullptr) { - TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, - "frameNode is null when SetSecurityUiextensionOption"); + TAG_LOGE(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "frameNode is null when SetSecurityUiextensionOption"); return ANI_ERROR; } - std::string optionClassName = "Larkui/ani/arkts/ui_extension/ArkUIAniUiextensionModal/ArkUIAniUIExtensionOptions;"; if (!AniUtils::CheckType(env, obj, optionClassName)) { @@ -118,7 +116,6 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( optionClassName.c_str()); return ANI_ERROR; } - bool isTransferringCaller = AniUtils::GetBoolOrUndefined(env, obj, "isTransferringCaller"); bool isWindowModeFollowHost = AniUtils::GetBoolOrUndefined(env, obj, "isWindowModeFollowHost"); int32_t dpiFollowStrategy = -1; @@ -128,7 +125,6 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( return ANI_ERROR; } std::map> placeholderMap; - static const std::map placeholderTypeTable = { { UI_EXTENSION_PLACEHOLDER_TYPE_INITIAL, NG::PlaceholderType::INITIAL }, { UI_EXTENSION_PLACEHOLDER_TYPE_UNDEFINED, NG::PlaceholderType::UNDEFINED }, @@ -163,8 +159,7 @@ ani_status NativeSecurityUiExtension::SetSecurityUiextensionOption( NG::SecurityUIExtensionStatic::UpdateSecurityUecConfig( frameNode, isTransferringCaller, densityDpi, isWindowModeFollowHost, placeholderMap); #endif - TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, - "NativeUiExtension SetSecurityUiextensionOption end"); + TAG_LOGI(OHOS::Ace::AceLogTag::ACE_SECURITYUIEXTENSION, "NativeUiExtension SetSecurityUiextensionOption end"); return ANI_OK; } @@ -235,7 +230,6 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( "onErrorAniReadyCallbackInfo is nullptr"); return; } - ani_ref onErrorGlobalRef = onErrorAniReadyCallbackInfo->GetOnGlobalRef(); ani_env* env = onErrorAniReadyCallbackInfo->GetEnvRef(); if (onErrorGlobalRef == nullptr || env == nullptr) { @@ -243,7 +237,6 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( "onErrorGlobalRef or env is nullptr"); return; } - auto fnObj = reinterpret_cast(onErrorGlobalRef); auto codeArgs = AniUtils::CreateDouble(env, code); if (codeArgs == nullptr) { @@ -251,12 +244,10 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( "CreateDouble failed when onErrorCallback"); return; } - ani_string nameArgs; env->String_NewUTF8(name.c_str(), name.size(), &nameArgs); ani_string messageArgs; env->String_NewUTF8(message.c_str(), message.size(), &messageArgs); - ani_ref result; std::vector tmp = { reinterpret_cast(codeArgs), @@ -265,7 +256,6 @@ ani_status NativeSecurityUiExtension::SetSecurityOnError( }; env->FunctionalObject_Call(fnObj, tmp.size(), tmp.data(), &result); }; - #ifdef WINDOW_SCENE_SUPPORTED NG::SecurityUIExtensionStatic::SetSecurityOnError(frameNode, std::move(onErrorCallback)); #endif //WINDOW_SCENE_SUPPORTED @@ -347,7 +337,6 @@ ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( "frameNode is null when SetSecurityOnTerminate"); return ANI_ERROR; } - ani_ref onTerminateRef = reinterpret_cast(callbackObj); ani_ref onTerminateGlobalRef; env->GlobalReference_Create(onTerminateRef, &onTerminateGlobalRef); @@ -361,7 +350,6 @@ ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( "onTerminateAniReadyCallbackInfo is nullptr"); return; } - ani_ref onTerminateGlobalRef = onTerminateAniReadyCallbackInfo->GetOnGlobalRef(); ani_env* env = onTerminateAniReadyCallbackInfo->GetEnvRef(); if (onTerminateGlobalRef == nullptr || env == nullptr) { @@ -369,7 +357,6 @@ ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( "onTerminateGlobalRef or env is nullptr"); return; } - AAFwk::Want want; if (wantWrap) { want = wantWrap->GetWant(); @@ -387,7 +374,6 @@ ani_status NativeSecurityUiExtension::SetSecurityOnTerminate( "WrapWant failed when onTerminateCallback"); return; } - ani_ref result; std::vector tmp = { reinterpret_cast(codeArgs), reinterpret_cast(wantArgs) -- Gitee From 3af330bfef5ba1106001ab5475e9a7a9be1de8b6 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Mon, 11 Aug 2025 15:09:43 +0800 Subject: [PATCH 25/27] modify tdd Signed-off-by: hanshu12138 --- .../ui_extension_component/ui_extension_component_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp b/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp index 5eba16edeb3..b3a68f5ba32 100644 --- a/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp +++ b/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp @@ -219,6 +219,7 @@ void UIExtensionComponentTestNg::FireCallbacks(RefPtr patter RefPtr wantWrapPtr = AceType::MakeRefPtr("123", "123"); AAFwk::WantParams wantParams; OHOS::AAFwk::Want want; + pattern->FireOnRemoteReadyCallback(); pattern->FireModalOnDestroy(); pattern->FireOnReleaseCallback(1); -- Gitee From 13dffe777403249204d3eb068ff6fe2b80e75e8f Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Mon, 11 Aug 2025 15:14:24 +0800 Subject: [PATCH 26/27] modify tdd Signed-off-by: hanshu12138 --- .../ui_extension_component/ui_extension_component_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp b/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp index b3a68f5ba32..60bcb8bb906 100644 --- a/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp +++ b/test/unittest/core/pattern/ui_extension/ui_extension_component/ui_extension_component_test.cpp @@ -219,7 +219,6 @@ void UIExtensionComponentTestNg::FireCallbacks(RefPtr patter RefPtr wantWrapPtr = AceType::MakeRefPtr("123", "123"); AAFwk::WantParams wantParams; OHOS::AAFwk::Want want; - pattern->FireOnRemoteReadyCallback(); pattern->FireModalOnDestroy(); pattern->FireOnReleaseCallback(1); @@ -503,7 +502,8 @@ HWTEST_F(UIExtensionComponentTestNg, UIExtensionUsageTest, TestSize.Level1) #ifdef OHOS_STANDARD_SYSTEM auto uiExtensionNodeId = ElementRegister::GetInstance()->MakeUniqueId(); auto uiExtensionNode = FrameNode::GetOrCreateFrameNode( - UI_EXTENSION_COMPONENT_ETS_TAG, uiExtensionNodeId, []() { return AceType::MakeRefPtr(); }); + UI_EXTENSION_COMPONENT_ETS_TAG, uiExtensionNodeId, + []() { return AceType::MakeRefPtr(); }); ASSERT_NE(uiExtensionNode, nullptr); EXPECT_EQ(uiExtensionNode->GetTag(), V2::UI_EXTENSION_COMPONENT_ETS_TAG); -- Gitee From b06102bf33d52238a2788b6913ddf6aaf4f6af56 Mon Sep 17 00:00:00 2001 From: hanshu12138 Date: Mon, 11 Aug 2025 21:48:21 +0800 Subject: [PATCH 27/27] rm ts Signed-off-by: hanshu12138 --- .../component/securityUIExtensionComponent.ts | 372 ------------------ 1 file changed, 372 deletions(-) delete mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts deleted file mode 100644 index 24f52399b50..00000000000 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/securityUIExtensionComponent.ts +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2025 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. - */ - - -// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! - -import { TypeChecker, ArkUIGeneratedNativeModule } from "#components" -import { Finalizable, runtimeType, RuntimeType, SerializerBase, registerCallback, wrapCallback, toPeerPtr, KLong, KPointer, MaterializedBase, NativeBuffer, nullptr, KInt, KBoolean, KStringPtr, InteropNativeModule } from "@koalaui/interop" -import { unsafeCast, int32, int64, float32 } from "@koalaui/common" -import { Serializer } from "./peers/Serializer" -import { CallbackKind } from "./peers/CallbackKind" -import { Deserializer } from "./peers/Deserializer" -import { CallbackTransformer } from "./peers/CallbackTransformer" -import { ComponentBase } from "./../ComponentBase" -import { PeerNode } from "./../PeerNode" -import { ArkCommonMethodPeer, CommonMethod, ArkCommonMethodComponent, ArkCommonMethodStyle, TerminationInfo } from "./common" -import { AbilityWant, BusinessError, Callback } from '#external' -import { Callback_Number_Void } from "./alphabetIndexer" -import { ErrorCallback } from "./ohos.base" -import { NodeAttach, remember } from "@koalaui/runtime" -import { ComponentContent } from "./../ComponentContent" -import { ArkUIAniSecurityUiextensionModal, ArkUIAniUIExtensionOptions, ArkUIAniModule, ArkUIAniUiextensionProxyModal } from "arkui.ani" - -export interface SecurityUIExtensionProxy { - send(data: Record): void - sendSync(data: Record): Record - onAsyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void - onSyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void - offAsyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void) | undefined): void - offSyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void) | undefined): void - on(type: 'syncReceiverRegister' | 'asyncReceiverRegister', callback_: ((parameter: SecurityUIExtensionProxy)=>void)) : void - off(type: 'syncReceiverRegister' | 'asyncReceiverRegister', callback_: ((parameter: SecurityUIExtensionProxy)=>void)) : void -} -export class SecurityUIExtensionProxyInternal implements MaterializedBase,SecurityUIExtensionProxy { - peer?: Finalizable | undefined = undefined - public getPeer(): Finalizable | undefined { - return this.peer - } - static ctor_uiextensionproxy(): KPointer { - const retval = ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_ctor() - return retval - } - constructor() { - const ctorPtr : KPointer = SecurityUIExtensionProxyInternal.ctor_uiextensionproxy() - this.peer = new Finalizable(ctorPtr, SecurityUIExtensionProxyInternal.getFinalizer()) - } - static getFinalizer(): KPointer { - return ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_getFinalizer() - } - public send(data: Record): void { - const data_casted = data as (Record) - ArkUIAniUiextensionProxyModal._Send_Data(this.peer!.ptr, data); - return - } - public sendSync(data: Record): Record { - const data_casted = data as (Record) - return ArkUIAniUiextensionProxyModal._Send_Data_Sync(this.peer!.ptr, data); - } - public onAsyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { - const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void)) - this.onAsyncReceiverRegister_serialize(callback__casted) - return - } - public onSyncReceiverRegister(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { - const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void)) - this.onSyncReceiverRegister_serialize(callback__casted) - return - } - public offAsyncReceiverRegister(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { - const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void) | undefined) - this.offAsyncReceiverRegister_serialize(callback__casted) - return - } - public offSyncReceiverRegister(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { - const callback__casted = callback_ as (((parameter: SecurityUIExtensionProxy) => void) | undefined) - this.offSyncReceiverRegister_serialize(callback__casted) - return - } - on(type: string, callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { - if (type == 'syncReceiverRegister') { - this.onSyncReceiverRegister(callback_) - } else if (type == 'asyncReceiverRegister') { - this.onAsyncReceiverRegister(callback_) - } - } - off(type: string, callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { - if (type == 'syncReceiverRegister') { - this.offSyncReceiverRegister(callback_) - } else if (type == 'asyncReceiverRegister') { - this.offAsyncReceiverRegister(callback_) - } - } - - private onAsyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { - const thisSerializer : Serializer = Serializer.hold() - thisSerializer.holdAndWriteCallback(callback_) - ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_onAsyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) - thisSerializer.release() - } - private onSyncReceiverRegister_serialize(callback_: ((parameter: SecurityUIExtensionProxy) => void)): void { - const thisSerializer : Serializer = Serializer.hold() - thisSerializer.holdAndWriteCallback(callback_) - ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_onSyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) - thisSerializer.release() - } - private offAsyncReceiverRegister_serialize(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { - const thisSerializer : Serializer = Serializer.hold() - let callback__type : int32 = RuntimeType.UNDEFINED - callback__type = runtimeType(callback_) - thisSerializer.writeInt8(callback__type as int32) - if ((RuntimeType.UNDEFINED) != (callback__type)) { - const callback__value = callback_! - thisSerializer.holdAndWriteCallback(callback__value) - } - ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_offAsyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) - thisSerializer.release() - } - private offSyncReceiverRegister_serialize(callback_?: ((parameter: SecurityUIExtensionProxy) => void)): void { - const thisSerializer : Serializer = Serializer.hold() - let callback__type : int32 = RuntimeType.UNDEFINED - callback__type = runtimeType(callback_) - thisSerializer.writeInt8(callback__type as int32) - if ((RuntimeType.UNDEFINED) != (callback__type)) { - const callback__value = callback_! - thisSerializer.holdAndWriteCallback(callback__value) - } - ArkUIGeneratedNativeModule._SecurityUIExtensionProxy_offSyncReceiverRegister(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) - thisSerializer.release() - } - public static fromPtr(ptr: KPointer): SecurityUIExtensionProxyInternal { - const obj : SecurityUIExtensionProxyInternal = new SecurityUIExtensionProxyInternal() - obj.peer = new Finalizable(ptr, SecurityUIExtensionProxyInternal.getFinalizer()) - return obj - } -} -class ArkSecurityUIExtensionCallbackHelp { - onRemoteReady?: ((parameter: SecurityUIExtensionProxy) => void) - onReceive?: ((param: Record) => void) - onError?: ((e: BusinessError) => void) - onTerminated?: ((parameter: TerminationInfo) => void) - constructor() { - this.onRemoteReady = undefined; - this.onReceive = undefined; - this.onError = undefined; - this.onTerminated = undefined; - } -} - -export class ArkSecurityUIExtensionComponentPeer extends ArkCommonMethodPeer { - _callbackHelp?: ArkSecurityUIExtensionCallbackHelp; - protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { - super(peerPtr, id, name, flags) - this.InitArkSecurityUIExtensionCallbackHelp(); - } - public static create(component: ComponentBase | undefined, flags: int32 = 0): ArkSecurityUIExtensionComponentPeer { - InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] create ArkUIExtensionComponentPeer start"); - const peerId = PeerNode.nextId() - const _peerPtr = ArkUIGeneratedNativeModule._SecurityUIExtensionComponent_construct(peerId, flags) - const _peer = new ArkSecurityUIExtensionComponentPeer(_peerPtr, peerId, "UIExtensionComponent", flags) - component?.setPeer(_peer) - return _peer - } - InitArkSecurityUIExtensionCallbackHelp(): void { - InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] InitArkUIExtensionCallbackHelp entry"); - this._callbackHelp = new ArkSecurityUIExtensionCallbackHelp(); - } - setSecurityUIExtensionComponentOptionsAttribute(want: AbilityWant, options?: SecurityUIExtensionOptions): void { - InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] setUIExtensionComponentOptionsAttribute entry"); - if (options != undefined) { - let innerOption : ArkUIAniUIExtensionOptions = new ArkUIAniUIExtensionOptions(); - if (options.isTransferringCaller != undefined) { - innerOption.isTransferringCaller = (options.isTransferringCaller) as boolean; - } - - if (options.dpiFollowStrategy != undefined) { - innerOption.dpiFollowStrategy = (options.dpiFollowStrategy as SecurityDpiFollowStrategy).valueOf(); - } - ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_Option(this.peer.ptr, innerOption); - } - - ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_Want(this.peer.ptr, want); - } - onRemoteReadyAttribute(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): void { - const thisSerializer : Serializer = Serializer.hold() - let value_type : int32 = RuntimeType.UNDEFINED - value_type = runtimeType(value) - thisSerializer.writeInt8(value_type as int32) - if ((RuntimeType.UNDEFINED) != (value_type)) { - const value_value = value! - thisSerializer.holdAndWriteCallback(value_value) - } - ArkUIGeneratedNativeModule._SecurityUIExtensionComponentAttribute_onRemoteReady(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) - thisSerializer.release() - } - onReceiveAttribute(value: ((parameter: Record) => void) | undefined): void { - const help = this._callbackHelp; - if (help != undefined && help != null) { - help.onReceive = value; - ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnReciveCallback(this.peer.ptr, (param: Record) => { - const onReceive = this._callbackHelp?.onReceive; - if (onReceive !== undefined && onReceive !== null) { - const innerParam = param; - onReceive(innerParam); - } - }); - } - } - - onErrorAttribute(value: ((e: BusinessError) => void) | undefined): void { - const help = this._callbackHelp; - if (help != undefined && help != null) { - help.onError = value; - ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnErrorCallback( - this.peer.ptr, (code1: number, name1: string, message1: string) => { - const onError = this._callbackHelp?.onError; - if (onError !== undefined && onError !== null) { - const param = { - code: 1, - name: name1, - message: message1 - } as BusinessError - onError(param); - } - }); - } - } - onTerminatedAttribute(value: ((parameter: TerminationInfo) => void) | undefined): void { - const help = this._callbackHelp; - if (help !== undefined && help !== null) { - help.onTerminated = value; - InteropNativeModule._NativeLog("[AceSecurityUiExtensionComponent] _SecurityUiextension_Set_OnTerminationCallback entry"); - ArkUIAniSecurityUiextensionModal._SecurityUiextension_Set_OnTerminationCallback( - this.peer.ptr, (code1: number, want1 : AbilityWant) => { - const onTerminated = this._callbackHelp?.onTerminated; - if (onTerminated !== undefined && onTerminated !== null) { - const param = { - code: code1, - want: want1 - } as TerminationInfo - onTerminated(param); - } - }); - } - } -} -export enum SecurityDpiFollowStrategy { - FOLLOW_HOST_DPI = 0, - FOLLOW_UI_EXTENSION_ABILITY_DPI = 1 -} -export enum SecurityWindowModeFollowStrategy { - FOLLOW_HOST_WINDOW_MODE = 0, - FOLLOW_UI_EXTENSION_ABILITY_WINDOW_MODE = 1 -} -export interface SecurityUIExtensionOptions { - isTransferringCaller?: boolean; - dpiFollowStrategy?: SecurityDpiFollowStrategy; - windowModeFollowStrategy?: SecurityWindowModeFollowStrategy; -} -export type Callback_SecurityUIExtensionProxy_Void = (parameter: SecurityUIExtensionProxy) => void; -export type SecurityUIExtensionComponentInterface = (want: AbilityWant, options?: SecurityUIExtensionOptions) => SecurityUIExtensionComponentAttribute; -export interface SecurityUIExtensionComponentAttribute extends CommonMethod { - onRemoteReady(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): this - onReceive(value: ((parameter: Record) => void) | undefined): this - onError(value: ((e: BusinessError) => void) | undefined): this - onTerminated(value: ((parameter: TerminationInfo) => void) | undefined): this -} -export class ArkSecurityUIExtensionComponentStyle extends ArkCommonMethodStyle implements SecurityUIExtensionComponentAttribute { - onRemoteReady_value?: ((parameter: SecurityUIExtensionProxy) => void) | undefined - onReceive_value?: ((parameter: Record) => void) | undefined - onError_value?: ((e: BusinessError) => void) | undefined - onTerminated_value?: ((parameter: TerminationInfo) => void) | undefined - - public onRemoteReady(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): this { - return this - } - public onReceive(value: ((parameter: Record) => void) | undefined): this { - return this - } - public onError(value: ((e: BusinessError) => void) | undefined): this { - return this - } - public onTerminated(value: ((parameter: TerminationInfo) => void) | undefined): this { - return this - } -} -export type Callback_Map_String_Object_Void = (parameter: Record) => void; -export interface Literal_Number_code__want { - code: number; - want?: AbilityWant; -} -export type Callback_Literal_Number_code__want_Void = (parameter: Literal_Number_code__want) => void; -export class ArkSecurityUIExtensionComponentComponent extends ArkCommonMethodComponent implements SecurityUIExtensionComponentAttribute { - getPeer(): ArkSecurityUIExtensionComponentPeer { - return (this.peer as ArkSecurityUIExtensionComponentPeer) - } - public setSecurityUIExtensionComponentOptions(want: AbilityWant, options?: SecurityUIExtensionOptions): this { - if (this.checkPriority("setSecurityUIExtensionComponentOptions")) { - const want_casted = want as (AbilityWant) - const options_casted = options as (SecurityUIExtensionOptions | undefined) - this.getPeer()?.setSecurityUIExtensionComponentOptionsAttribute(want_casted, options_casted) - return this - } - return this - } - public onRemoteReady(value: ((parameter: SecurityUIExtensionProxy) => void) | undefined): this { - if (this.checkPriority("onRemoteReady")) { - const value_casted = value as (((parameter: SecurityUIExtensionProxy) => void) | undefined) - this.getPeer()?.onRemoteReadyAttribute(value_casted) - return this - } - return this - } - public onReceive(value: ((parameter: Record) => void) | undefined): this { - if (this.checkPriority("onReceive")) { - const value_casted = value as (((parameter: Record) => void) | undefined) - this.getPeer()?.onReceiveAttribute(value_casted) - return this - } - return this - } - public onError(value: ((e: BusinessError) => void) | undefined): this { - if (this.checkPriority("onError")) { - const value_casted = value as (((e: BusinessError) => void) | undefined) - this.getPeer()?.onErrorAttribute(value_casted) - return this - } - return this - } - public onTerminated(value: ((parameter: TerminationInfo) => void) | undefined): this { - if (this.checkPriority("onTerminated")) { - const value_casted = value as (((parameter: TerminationInfo) => void) | undefined) - this.getPeer()?.onTerminatedAttribute(value_casted) - return this - } - return this - } - - public applyAttributesFinish(): void { - // we call this function outside of class, so need to make it public - super.applyAttributesFinish() - } -} -/** @memo */ -export function SecurityUIExtensionComponent( - /** @memo */ - style: ((attributes: SecurityUIExtensionComponentAttribute) => void) | undefined, - want: AbilityWant, options?: SecurityUIExtensionOptions, - /** @memo */ - content_?: (() => void) | undefined, -): void { - const receiver = remember(() => { - return new ArkSecurityUIExtensionComponentComponent() - }) - NodeAttach((): ArkSecurityUIExtensionComponentPeer => ArkSecurityUIExtensionComponentPeer.create(receiver), (_: ArkSecurityUIExtensionComponentPeer) => { - receiver.setSecurityUIExtensionComponentOptions(want,options) - style?.(receiver) - content_?.() - receiver.applyAttributesFinish() - }) -} \ No newline at end of file -- Gitee