From d8b8fbe4d2e55ccb0bed5df3cfa20f62b4a9d1e4 Mon Sep 17 00:00:00 2001
From: Esben Haabendal <esben@geanix.com>
Date: Tue, 11 Apr 2023 14:58:14 +0200
Subject: [PATCH] Revert "openharmony-standard: Drop patch disabling graphics
 rendering"

This reverts commit 312c51f4838cc7ce15542261f448b09d7fe56689.

We are seeing multiple different race conditions causing random failures in
ACTS, many of them (maybe all) goes away when we stub out the mostly stub out
JSView::CreateComponent()

As before, this should be dropped again later on when the problems have been
solved.  And is required in order to get graphics support to work.

Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 .../ace_engine-disable-create-component.patch | 29 +++++++++++++++++++
 .../openharmony/openharmony-standard_3.0.bb   |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 recipes-openharmony/openharmony/openharmony-standard-3.0/ace_engine-disable-create-component.patch

diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.0/ace_engine-disable-create-component.patch b/recipes-openharmony/openharmony/openharmony-standard-3.0/ace_engine-disable-create-component.patch
new file mode 100644
index 00000000..1197b214
--- /dev/null
+++ b/recipes-openharmony/openharmony/openharmony-standard-3.0/ace_engine-disable-create-component.patch
@@ -0,0 +1,29 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+foundation/ace/ace_engine: disable graphics
+
+The graphics rendering is slowing the system making some ACTS test suites to timeout.
+Since we are aiming for certification for headless system, graphics stack 
+should not be required.
+Disabling graphics by skipping JSView::CreateComponent() execution.
+In the future we will remove this patch when we the graphical part will be needed.
+
+Apply to foundation/ace/ace_engine
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Francesco Pham <francesco.pham@huawei.com>
+diff --git a/frameworks/bridge/declarative_frontend/jsview/js_view.cpp b/frameworks/bridge/declarative_frontend/jsview/js_view.cpp
+index e455cb00..d58d5c79 100644
+--- a/frameworks/bridge/declarative_frontend/jsview/js_view.cpp
++++ b/frameworks/bridge/declarative_frontend/jsview/js_view.cpp
+@@ -254,6 +254,7 @@ RefPtr<OHOS::Ace::Component> JSView::CreateComponent()
+ 
+     std::string key = ViewStackProcessor::GetInstance()->ProcessViewId(viewId_);
+     auto composedComponent = AceType::MakeRefPtr<ComposedComponent>(key, "view");
++    return composedComponent;
+ 
+     // add callback for element creation to component, and get pointer reference
+     // to the element on creation. When state of this view changes, mark the
diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
index d391328d..003bcc2a 100644
--- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
+++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
@@ -97,6 +97,7 @@ SRC_URI += "file://foundation_distributedschedule_safwk-slash-system-symlink.pat
 SRC_URI += "file://test-xts-acts-fix-Defpermission-typo.patch;patchdir=${S}/test/xts/acts"
 SRC_URI += "file://test-xts-acts-fix-faultloggertest.patch;patchdir=${S}/test/xts/acts"
 SRC_URI += "file://test-xts-acts-fix-hicolliecpptest.patch;patchdir=${S}/test/xts/acts"
+SRC_URI += "file://ace_engine-disable-create-component.patch;patchdir=${S}/foundation/ace/ace_engine"
 SRC_URI += "file://test-xts-acts-increase-testsuite-timeouts.patch;patchdir=${S}/test/xts/acts"
 SRC_URI += "file://foundation_ace_engine-race-condition-workaround.patch;patchdir=${S}/foundation/ace/ace_engine"
 
-- 
GitLab