Signed-off-by: f00619036 <fengzhao@huawei.com>
Change-Id: I3b1751b99529106e9b3e614d72afb13cfe6fe31d
This commit is contained in:
f00619036 2024-04-10 14:35:18 +08:00
parent 4f30b2cb53
commit 3ac0437b37
14 changed files with 250 additions and 0 deletions

View File

@ -36,6 +36,7 @@ template("ace_capability_ohos_source_set") {
external_deps = [
"ability_base:want",
"common_event_service:cesfwk_innerkits",
"hicollie:libhicollie",
"hilog:libhilog",
"ipc:ipc_core",
"preferences:native_preferences",
@ -45,6 +46,8 @@ template("ace_capability_ohos_source_set") {
external_deps += [ "pasteboard:pasteboard_client" ]
defines += [ "SYSTEM_CLIPBOARD_SUPPORTED" ]
}
sources += [ "xcollie/xcollieInterface_impl.cpp" ]
if (defined(config.enable_drag_framework) && config.enable_drag_framework) {
if (defined(global_parts_info.distributeddatamgr_udmf)) {
external_deps += [ "udmf:udmf_client" ]

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "xcollieInterface_impl.h"
#include <cstdint>
#include "xcollie/xcollie.h"
namespace OHOS::Ace {
XcollieInterface& XcollieInterface::GetInstance()
{
static XcollieInterfaceImpl instance;
return instance;
}
int32_t XcollieInterfaceImpl::SetTimerCount(const std::string& name, uint32_t timeLimit, int32_t countLimit)
{
return HiviewDFX::XCollie::GetInstance().SetTimerCount(name, timeLimit, countLimit);
}
void XcollieInterfaceImpl::TriggerTimerCount(const std::string& name, bool bTrigger, const std::string& message)
{
HiviewDFX::XCollie::GetInstance().TriggerTimerCount(name, bTrigger, message);
}
} //namespace OHOS::Ace

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_IMPL_H
#define FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_IMPL_H
#include "base/memory/ace_type.h"
#include "base/utils/utils.h"
#include "core/common/xcollie/xcollieInterface.h"
namespace OHOS::Ace {
class XcollieInterfaceImpl : public XcollieInterface {
DECLARE_ACE_TYPE(XcollieInterfaceImpl, XcollieInterface);
public:
int32_t SetTimerCount(const std::string& name, uint32_t timeLimit, int countLimit) override;
void TriggerTimerCount(const std::string& name, bool bTrigger, const std::string& message) override;
};
} // namespace OHOS::Ace
#endif // FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_IMPL_H

View File

@ -75,6 +75,7 @@
#include "core/common/modal_ui_extension.h"
#include "core/common/recorder/event_recorder.h"
#include "core/common/resource/resource_manager.h"
#include "core/common/xcollie/xcollieInterface.h"
#include "core/components/theme/shadow_theme.h"
#include "core/components_ng/base/inspector.h"
#include "core/components_ng/base/view_abstract.h"
@ -134,6 +135,8 @@ const char ENABLE_TRACE_INPUTEVENT_KEY[] = "persist.ace.trace.inputEvent.enabled
const char ENABLE_SECURITY_DEVELOPERMODE_KEY[] = "const.security.developermode.state";
const char ENABLE_DEBUG_STATEMGR_KEY[] = "persist.ace.debug.statemgr.enabled";
const int32_t REQUEST_CODE = -1;
constexpr uint32_t TIMEOUT_LIMIT = 60;
constexpr int32_t COUNT_LIMIT = 3;
using ContentFinishCallback = std::function<void()>;
using ContentStartAbilityCallback = std::function<void(const std::string& address)>;
@ -1193,6 +1196,7 @@ UIContentErrorCode UIContentImpl::CommonInitialize(
CapabilityRegistry::Register();
ImageFileCache::GetInstance().SetImageCacheFilePath(context->GetCacheDir());
ImageFileCache::GetInstance().SetCacheFileInfo();
XcollieInterface::GetInstance().SetTimerCount("HIT_EMPTY_WARNING", TIMEOUT_LIMIT, COUNT_LIMIT);
});
AceNewPipeJudgement::InitAceNewPipeConfig();
auto apiCompatibleVersion = context->GetApplicationInfo()->apiCompatibleVersion;

View File

@ -56,6 +56,7 @@ ohos_source_set("preview_entrance_source") {
"subwindow_preview.cpp",
"udmf/udmf_impl.cpp",
"ui_content_impl.cpp",
"xcollie/xcollieInterface_impl.cpp",
]
deps = [

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "xcollieInterface_impl.h"
namespace OHOS::Ace {
XcollieInterface& XcollieInterface::GetInstance()
{
static XcollieInterfaceImpl instance;
return instance;
}
} //namespace OHOS::Ace

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_IMPL_H
#define FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_IMPL_H
#include "base/memory/ace_type.h"
#include "base/utils/utils.h"
#include "core/common/xcollie/xcollieInterface.h"
namespace OHOS::Ace {
class XcollieInterfaceImpl : public XcollieInterface {
DECLARE_ACE_TYPE(XcollieInterfaceImpl, XcollieInterface);
public:
};
} // namespace OHOS::Ace
#endif // FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_IMPL_H

View File

@ -16,12 +16,14 @@
#include "core/common/event_manager.h"
#include "base/geometry/ng/point_t.h"
#include "base/json/json_util.h"
#include "base/log/ace_trace.h"
#include "base/log/dump_log.h"
#include "base/memory/ace_type.h"
#include "base/thread/frame_trace_adapter.h"
#include "base/utils/utils.h"
#include "core/common/container.h"
#include "core/common/xcollie/xcollieInterface.h"
#include "core/components_ng/base/frame_node.h"
#include "core/components_ng/event/touch_event.h"
#include "core/components_ng/gestures/recognizers/recognizer_group.h"
@ -176,10 +178,34 @@ void EventManager::TouchTest(const TouchEvent& touchPoint, const RefPtr<NG::Fram
}
TAG_LOGI(AceLogTag::ACE_INPUTTRACKING, "EventTreeDumpInfo: %{public}s", item.second.c_str());
}
RecordHitEmptyMessage(touchPoint, resultInfo);
}
LogTouchTestResultRecognizers(touchTestResults_[touchPoint.id]);
}
void EventManager::RecordHitEmptyMessage(const TouchEvent& touchPoint, const std::string& resultInfo)
{
auto hitEmptyMessage = JsonUtil::Create(true);
auto container = Container::Current();
CHECK_NULL_VOID(container);
auto windowId = container->GetWindowId();
hitEmptyMessage->Put("windowId", static_cast<int32_t>(windowId));
auto window = container->GetPipelineContext()->GetWindow();
if (window) {
hitEmptyMessage->Put("windowName", window->GetWindowName().c_str());
}
hitEmptyMessage->Put("resultInfo", resultInfo.c_str());
hitEmptyMessage->Put("x", touchPoint.x);
hitEmptyMessage->Put("y", touchPoint.y);
hitEmptyMessage->Put("currentTime", static_cast<int64_t>(touchPoint.time.time_since_epoch().count()));
hitEmptyMessage->Put("bundleName", container->GetBundleName().c_str());
auto frontEnd = container->GetFrontend();
if (frontEnd) {
hitEmptyMessage->Put("pageInfo", frontEnd->GetCurrentPageUrl().c_str());
}
XcollieInterface::GetInstance().TriggerTimerCount("HIT_EMPTY_WARNING", true, hitEmptyMessage->ToString());
}
void EventManager::LogTouchTestResultRecognizers(const TouchTestResult& result)
{
std::map<std::string, std::list<NG::TouchTestResultInfo>> hittedRecognizerInfo;

View File

@ -244,6 +244,8 @@ public:
}
}
void RecordHitEmptyMessage(const TouchEvent& touchPoint, const std::string& resultInfo);
private:
void SetHittedFrameNode(const std::list<RefPtr<NG::NGGestureRecognizer>>& touchTestResults);
void CleanGestureEventHub();

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_H
#define FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_H
#include "base/memory/ace_type.h"
#include "base/utils/utils.h"
namespace OHOS::Ace {
class XcollieInterface : public AceType {
DECLARE_ACE_TYPE(XcollieInterface, AceType);
public:
static XcollieInterface& GetInstance();
virtual int32_t SetTimerCount(const std::string& name, uint32_t timeLimit, int32_t countLimit)
{
return -1;
}
virtual void TriggerTimerCount(const std::string& name, bool bTrigger, const std::string& message) {};
};
} // namespace OHOS::Ace
#endif // FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_XCOLLIEINTERFACE_H

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "test/mock/core/common/mock_xcollieInterface.h"
namespace OHOS::Ace {
XcollieInterface& XcollieInterface::GetInstance()
{
static XcollieInterfaceImpl instance;
return instance;
}
} //namespace OHOS::Ace

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_MOCK_XCOLLIEINTERFACE_H
#define FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_MOCK_XCOLLIEINTERFACE_H
#include "gmock/gmock-function-mocker.h"
#include "gmock/gmock.h"
#include "base/memory/ace_type.h"
#include "base/utils/utils.h"
#include "core/common/xcollie/xcollieInterface.h"
namespace OHOS::Ace {
class XcollieInterfaceImpl : public XcollieInterface {
DECLARE_ACE_TYPE(XcollieInterfaceImpl, XcollieInterface);
public:
};
} // namespace OHOS::Ace
#endif // FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CAPABILITY_MOCK_XCOLLIEINTERFACE_H

View File

@ -475,6 +475,7 @@ ohos_source_set("ace_components_mock") {
"$ace_root/test/mock/core/common/mock_theme_constants.cpp",
"$ace_root/test/mock/core/common/mock_theme_utils.cpp",
"$ace_root/test/mock/core/common/mock_udmf.cpp",
"$ace_root/test/mock/core/common/mock_xcollieInterface.cpp",
"$ace_root/test/mock/core/event/mock_time_event_proxy.cpp",
"$ace_root/test/mock/core/event/mock_touch_event.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_cache.cpp",

View File

@ -72,6 +72,7 @@ ace_unittest("pipeline_context_test_ng") {
"$ace_root/test/mock/core/common/mock_theme_constants.cpp",
"$ace_root/test/mock/core/common/mock_udmf.cpp",
"$ace_root/test/mock/core/common/mock_window.cpp",
"$ace_root/test/mock/core/common/mock_xcollieInterface.cpp",
"$ace_root/test/mock/core/event/mock_touch_event.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_cache.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_file_cache.cpp",