Signed-off-by: yang123 <yangyanling13@huawei.com>
This commit is contained in:
yang123 2024-11-09 08:50:39 +00:00
parent b7ed244001
commit c07f438c4e
4 changed files with 17 additions and 1 deletions

View File

@ -63,7 +63,8 @@
"memmgr",
"os_account",
"libxml2",
"wifi"
"wifi",
"power_manager"
],
"third_party": [
"libuv",

View File

@ -79,6 +79,7 @@ ohos_shared_library("intention_cooperate") {
"image_framework:image_native",
"input:libmmi-client",
"ipc:ipc_single",
"power_manager:powermgr_client",
"samgr:samgr_proxy",
"wifi:wifi_sdk",
"window_manager:libdm",

View File

@ -46,6 +46,7 @@ private:
void TurnOffChannelScan();
void TurnOnChannelScan();
int32_t SetWifiScene(unsigned int scene);
void RefreshActivity();
IContext *env_ { nullptr };
int32_t interceptorId_ { -1 };

View File

@ -18,6 +18,7 @@
#include "cooperate_context.h"
#include "devicestatus_define.h"
#include "display_manager.h"
#include "power_mgr_client.h"
#include "input_event_transmission/input_event_serialization.h"
#include "utility.h"
#include "kits/c/wifi_hid2d.h"
@ -100,6 +101,7 @@ void InputEventInterceptor::OnPointerEvent(std::shared_ptr<MMI::PointerEvent> po
if (scanState_) {
TurnOffChannelScan();
}
RefreshActivity();
if ((pointerEventTimer_ > 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
env_->GetTimerManager().RemoveTimer(pointerEventTimer_);
pointerEventTimer_ = -1;
@ -151,6 +153,7 @@ void InputEventInterceptor::OnNotifyCrossDrag(std::shared_ptr<MMI::PointerEvent>
void InputEventInterceptor::OnKeyEvent(std::shared_ptr<MMI::KeyEvent> keyEvent)
{
CHKPV(keyEvent);
RefreshActivity();
if (filterKeys_.find(keyEvent->GetKeyCode()) != filterKeys_.end()) {
keyEvent->AddFlag(MMI::AxisEvent::EVENT_FLAG_NO_INTERCEPT);
env_->GetInput().SimulateInputEvent(keyEvent);
@ -223,6 +226,16 @@ void InputEventInterceptor::ReportPointerEvent(std::shared_ptr<MMI::PointerEvent
FI_HILOGE("Failed to send event via channel, error:%{public}d", ret);
}
}
void InputEventInterceptor::RefreshActivity()
{
bool ret = PowerMgrClient::GetInstance().RefreshActivity(
OHOS::powerMgr::UserActivityType::USER_ACTIVITY_TYPE_TOUCH);
if (ret != true) {
FI_HILOGE("RefreshActivity Failed");
}
return;
}
} // namespace Cooperate
} // namespace DeviceStatus
} // namespace Msdp