From ff554dca1e9e3e37af52c6304b765e6bac32ee57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=95=AC=E6=9D=BE?= <18328528985@163.com> Date: Tue, 12 Aug 2025 21:44:16 +0800 Subject: [PATCH] =?UTF-8?q?5s=E5=86=85=E6=8B=89=E8=B5=B7=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 周敬松 <18328528985@163.com> --- .../session/host/include/scene_session.h | 2 -- window_scene/session/host/src/system_session.cpp | 16 ---------------- .../test/unittest/system_session_test.cpp | 6 +----- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/window_scene/session/host/include/scene_session.h b/window_scene/session/host/include/scene_session.h index ca78210ea2..e46589f6f5 100644 --- a/window_scene/session/host/include/scene_session.h +++ b/window_scene/session/host/include/scene_session.h @@ -987,8 +987,6 @@ protected: virtual void NotifyUpdateFloatingBall(const FloatingBallTemplateInfo& fbTemplateInfo) {}; virtual void NotifyStopFloatingBall() {}; virtual void NotifyRestoreFloatingBallMainWindow(const std::shared_ptr& want) {}; - uint64_t fbClickTime_ = 0; - std::mutex fbClickMutex_; FloatingBallTemplateInfo fbTemplateInfo_ = {}; /* diff --git a/window_scene/session/host/src/system_session.cpp b/window_scene/session/host/src/system_session.cpp index 8ec537e494..a822abbc9f 100644 --- a/window_scene/session/host/src/system_session.cpp +++ b/window_scene/session/host/src/system_session.cpp @@ -28,8 +28,6 @@ constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "System constexpr uint32_t MIN_SYSTEM_WINDOW_WIDTH = 5; constexpr uint32_t MIN_SYSTEM_WINDOW_HEIGHT = 5; -constexpr uint64_t FLOATING_BALL_CLICK_INTERVAL = 5000; -const std::string FB_CLICK_EVENT = "click"; SystemSession::SystemSession(const SessionInfo& info, const sptr& specificCallback) : SceneSession(info, specificCallback) @@ -501,16 +499,6 @@ WMError SystemSession::RestoreFbMainWindow(const std::shared_ptr& w session->GetSessionInfo().bundleName_.c_str(), want->GetBundle().c_str()); return WMError::WM_ERROR_FB_RESTORE_MAIN_WINDOW_FAILED; } - uint64_t nowTime = static_cast(std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count()); - { - std::lock_guard lock(session->fbClickMutex_); - if (nowTime - session->fbClickTime_ >= FLOATING_BALL_CLICK_INTERVAL) { - TLOGNW(WmsLogTag::WMS_SYSTEM, "%{public}s Start time is too long from click, deny", where); - return WMError::WM_ERROR_FB_RESTORE_MAIN_WINDOW_FAILED; - } - session->fbClickTime_ = 0; - } TLOGNI(WmsLogTag::WMS_SYSTEM, "%{public}s restore window, bundle %{public}s, ability %{public}s, session bundle %{public}s", where, want->GetBundle().c_str(), want->GetElement().GetAbilityName().c_str(), @@ -579,10 +567,6 @@ WSError SystemSession::SendFbActionEvent(const std::string& action) if (!sessionStage_) { return WSError::WS_ERROR_NULLPTR; } - if (action == FB_CLICK_EVENT) { - fbClickTime_ = static_cast(std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count()); - } return sessionStage_->SendFbActionEvent(action); } diff --git a/window_scene/test/unittest/system_session_test.cpp b/window_scene/test/unittest/system_session_test.cpp index f7eab8d5ba..c1702a0d94 100644 --- a/window_scene/test/unittest/system_session_test.cpp +++ b/window_scene/test/unittest/system_session_test.cpp @@ -965,15 +965,11 @@ HWTEST_F(SystemSessionTest, RestoreFbMainWindow, Function | SmallTest | Level2) EXPECT_EQ(systemSession->RestoreFbMainWindow(want), WMError::WM_ERROR_INVALID_CALLING); LOCK_GUARD_EXPR(SCENE_GUARD, systemSession->SetCallingPid(IPCSkeleton::GetCallingPid())); - EXPECT_EQ(systemSession->RestoreFbMainWindow(want), WMError::WM_ERROR_FB_RESTORE_MAIN_WINDOW_FAILED); - std::string bundle = "testBundle"; want->SetBundle(bundle); EXPECT_EQ(systemSession->RestoreFbMainWindow(want), WMError::WM_ERROR_FB_RESTORE_MAIN_WINDOW_FAILED); + systemSession->EditSessionInfo().bundleName_ = bundle; - uint64_t nowTime = static_cast(std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count()); - systemSession->fbClickTime_ = nowTime - 1000; EXPECT_EQ(systemSession->RestoreFbMainWindow(want), WMError::WM_OK); } -- Gitee