diff --git a/frameworks/core/components_ng/pattern/form/form_pattern.cpp b/frameworks/core/components_ng/pattern/form/form_pattern.cpp index c1933dc460c..05439add734 100644 --- a/frameworks/core/components_ng/pattern/form/form_pattern.cpp +++ b/frameworks/core/components_ng/pattern/form/form_pattern.cpp @@ -588,6 +588,7 @@ void FormPattern::OnModifyDone() layoutProperty->UpdateRequestFormInfo(info); UpdateBackgroundColorWhenUnTrustForm(); info.obscuredMode = isFormObscured_; + info.obscuredMode |= CheckFormBundleForbidden(info.bundleName); HandleFormComponent(info); } @@ -615,6 +616,7 @@ bool FormPattern::OnDirtyLayoutWrapperSwap(const RefPtr& dirty, c UpdateBackgroundColorWhenUnTrustForm(); info.obscuredMode = isFormObscured_; + info.obscuredMode |= CheckFormBundleForbidden(info.bundleName); HandleFormComponent(info); return false; } @@ -680,7 +682,7 @@ void FormPattern::AddFormComponent(const RequestFormInfo& info) #else formManagerBridge_->AddForm(host->GetContextRefPtr(), info); #endif - if (formManagerBridge_->CheckFormBundleForbidden(info.bundleName)) { + if (CheckFormBundleForbidden(info.bundleName)) { LoadDisableFormStyle(info); } } @@ -1893,4 +1895,10 @@ void FormPattern::UnregisterAccessibility() CHECK_NULL_VOID(formNode); formNode->ClearAccessibilityChildTreeRegisterFlag(); } + +bool FormPattern::CheckFormBundleForbidden(const std::string &bundleName) +{ + CHECK_NULL_RETURN(formManagerBridge_, false); + return formManagerBridge_->CheckFormBundleForbidden(bundleName); +} } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/pattern/form/form_pattern.h b/frameworks/core/components_ng/pattern/form/form_pattern.h index de0be13241d..b287a071fbf 100644 --- a/frameworks/core/components_ng/pattern/form/form_pattern.h +++ b/frameworks/core/components_ng/pattern/form/form_pattern.h @@ -208,6 +208,7 @@ private: bool IsMaskEnableForm(const RequestFormInfo &info); void UpdateChildNodeOpacity(FormChildNodeType formChildNodeType, double opacity); void SnapshotSurfaceNode(); + bool CheckFormBundleForbidden(const std::string &bundleName); // used by ArkTS Card, for RSSurfaceNode from FRS, RefPtr externalRenderContext_; diff --git a/test/unittest/core/pattern/form/form_test_ng.cpp b/test/unittest/core/pattern/form/form_test_ng.cpp index d52cad7b7f0..0f4f131e8bd 100644 --- a/test/unittest/core/pattern/form/form_test_ng.cpp +++ b/test/unittest/core/pattern/form/form_test_ng.cpp @@ -1526,4 +1526,18 @@ HWTEST_F(FormTestNg, SnapshotSurfaceNode, TestSize.Level1) pattern->SnapshotSurfaceNode(); ASSERT_NE(host, nullptr); } + +/** + * @tc.name: CheckFormBundleForbidden + * @tc.desc: Test CheckFormBundleForbidden in Form Pattern. + * @tc.type: FUNC + */ +HWTEST_F(FormTestNg, CheckFormBundleForbidden, TestSize.Level1) +{ + RefPtr frameNode = CreateFromNode(); + auto pattern = frameNode->GetPattern(); + ASSERT_NE(pattern, nullptr); + bool isForbidden = pattern->CheckFormBundleForbidden("MyBundleName"); + ASSERT_EQ(isForbidden, false); +} } // namespace OHOS::Ace::NG