From b754fd45290cd9ced20dd02b485ccbdf5c8177fa Mon Sep 17 00:00:00 2001 From: pengyanggit Date: Wed, 19 Jun 2024 15:00:11 +0800 Subject: [PATCH 1/2] Signed-off-by: pengyanggit Change-Id: I5fb8a0755d8fb7fb533798c3f6229e1debbdf2ed --- .../interaction/src/interaction_manager.cpp | 4 -- frameworks/native/src/client.cpp | 18 -------- frameworks/native/src/stationary_manager.cpp | 14 ------ .../cooperate/test/include/test_context.h | 7 --- intention/cooperate/test/src/test_context.cpp | 4 -- intention/prototype/include/i_context.h | 4 -- intention/prototype/include/i_drag_manager.h | 10 ---- intention/services/test/unittest/BUILD.gn | 1 + .../test/unittest/src/device_manager_test.cpp | 14 ------ .../interaction/drag/include/drag_manager.h | 13 ------ .../drag/include/state_change_notify.h | 12 ----- .../interaction/drag/src/drag_manager.cpp | 46 +------------------ .../drag/src/state_change_notify.cpp | 4 -- .../native/include/devicestatus_service.h | 8 ---- services/native/src/devicestatus_service.cpp | 44 ------------------ .../src/devicestatus_module_test.cpp | 16 ------- .../src/devicestatus_service_test.cpp | 32 ------------- .../src/devicestatus_client_test.cpp | 4 -- test/unittest/intention/scheduler/BUILD.gn | 2 + .../scheduler/include/timer_manager_test.h | 6 --- .../scheduler/src/timer_manager_test.cpp | 7 --- .../services/include/intention_service_test.h | 6 --- .../services/src/intention_service_test.cpp | 4 -- .../include/cooperate_plugin_test.h | 4 -- .../intentiontest/include/cooperate_test.h | 4 -- .../intentiontest/include/drag_server_test.h | 2 - .../include/input_event_builder_test.h | 5 -- .../include/input_event_interceptor_test.h | 7 --- .../src/cooperate_plugin_test.cpp | 2 - .../intentiontest/src/cooperate_test.cpp | 2 - .../intentiontest/src/drag_server_test.cpp | 2 - .../src/input_event_builder_test.cpp | 2 - .../src/input_event_interceptor_test.cpp | 2 - 33 files changed, 4 insertions(+), 308 deletions(-) diff --git a/frameworks/native/interaction/src/interaction_manager.cpp b/frameworks/native/interaction/src/interaction_manager.cpp index 3d3d64b15..8e73753bd 100644 --- a/frameworks/native/interaction/src/interaction_manager.cpp +++ b/frameworks/native/interaction/src/interaction_manager.cpp @@ -17,11 +17,7 @@ #include "devicestatus_define.h" #include "drag_data.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_manager.h" -#else -#include "interaction_manager_impl.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { diff --git a/frameworks/native/src/client.cpp b/frameworks/native/src/client.cpp index 7d613cf84..05d5d1e82 100644 --- a/frameworks/native/src/client.cpp +++ b/frameworks/native/src/client.cpp @@ -257,29 +257,11 @@ void Client::OnConnected() } } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t Client::Socket() { CALL_DEBUG_ENTER; return -1; } -#else -int32_t Client::Socket() -{ - CALL_DEBUG_ENTER; - int32_t ret = DeviceStatusClient::GetInstance().AllocSocketPair(CONNECT_MODULE_TYPE_FI_CLIENT); - if (ret != RET_OK) { - FI_HILOGE("Call AllocSocketPair return %{public}d", ret); - return RET_ERR; - } - fd_ = DeviceStatusClient::GetInstance().GetClientSocketFdOfAllocedSocketPair(); - if (fd_ == -1) { - FI_HILOGE("Call GetClientSocketFdOfAllocedSocketPair return invalid fd"); - } - FI_HILOGD("Call GetClientSocketFdOfAllocedSocketPair return fd:%{public}d", fd_); - return fd_; -} -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void Client::Stop() { diff --git a/frameworks/native/src/stationary_manager.cpp b/frameworks/native/src/stationary_manager.cpp index a1725f44d..b7e8d161d 100644 --- a/frameworks/native/src/stationary_manager.cpp +++ b/frameworks/native/src/stationary_manager.cpp @@ -20,9 +20,7 @@ #include "devicestatus_client.h" #include "devicestatus_common.h" #include "devicestatus_define.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -38,29 +36,17 @@ StationaryManager *StationaryManager::GetInstance() int32_t StationaryManager::SubscribeCallback(Type type, ActivityEvent event, ReportLatencyNs latency, sptr callback) { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK return INTER_MGR_IMPL.SubscribeCallback(type, event, latency, callback); -#else - return DeviceStatusClient::GetInstance().SubscribeCallback(type, event, latency, callback); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } int32_t StationaryManager::UnsubscribeCallback(Type type, ActivityEvent event, sptr callback) { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK return INTER_MGR_IMPL.UnsubscribeCallback(type, event, callback); -#else - return DeviceStatusClient::GetInstance().UnsubscribeCallback(type, event, callback); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } Data StationaryManager::GetDeviceStatusData(Type type) { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK return INTER_MGR_IMPL.GetDeviceStatusData(type); -#else - return DeviceStatusClient::GetInstance().GetDeviceStatusData(type); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } } // namespace DeviceStatus } // namespace Msdp diff --git a/intention/cooperate/test/include/test_context.h b/intention/cooperate/test/include/test_context.h index 6f043308f..7aa96eb54 100644 --- a/intention/cooperate/test/include/test_context.h +++ b/intention/cooperate/test/include/test_context.h @@ -21,9 +21,7 @@ #include "i_context.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -69,26 +67,21 @@ public: IDeviceManager& GetDeviceManager() override; ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - private: MockDelegateTasks delegateTasks_; DeviceManager devMgr_; TimerManager timerMgr_; DragManager dragMgr_; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK SocketSessionManager socketSessionMgr_; std::unique_ptr input_ { nullptr }; std::unique_ptr pluginMgr_ { nullptr }; std::unique_ptr dsoftbus_ { nullptr }; std::unique_ptr ddp_ { nullptr }; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; } // namespace DeviceStatus } // namespace Msdp diff --git a/intention/cooperate/test/src/test_context.cpp b/intention/cooperate/test/src/test_context.cpp index bae020a5d..37c84bb1b 100644 --- a/intention/cooperate/test/src/test_context.cpp +++ b/intention/cooperate/test/src/test_context.cpp @@ -110,12 +110,10 @@ int32_t MockInputAdapter::RemoveVirtualInputDevice(int32_t deviceId) TestContext::TestContext() { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK input_ = std::make_unique(); pluginMgr_ = std::make_unique(this); dsoftbus_ = std::make_unique(); ddp_ = std::make_unique(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } IDelegateTasks& TestContext::GetDelegateTasks() @@ -138,7 +136,6 @@ IDragManager& TestContext::GetDragManager() return dragMgr_; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& TestContext::GetSocketSessionManager() { return socketSessionMgr_; @@ -163,7 +160,6 @@ IDDPAdapter& TestContext::GetDP() { return *ddp_; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } // namespace DeviceStatus } // namespace Msdp } // namespace OHOS diff --git a/intention/prototype/include/i_context.h b/intention/prototype/include/i_context.h index 47316caaa..8460914c2 100644 --- a/intention/prototype/include/i_context.h +++ b/intention/prototype/include/i_context.h @@ -19,13 +19,11 @@ #include "i_delegate_tasks.h" #include "i_device_manager.h" #include "i_drag_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "i_ddp_adapter.h" #include "i_dsoftbus_adapter.h" #include "i_input_adapter.h" #include "i_socket_session_manager.h" #include "i_plugin_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "i_timer_manager.h" namespace OHOS { @@ -46,13 +44,11 @@ public: virtual ITimerManager& GetTimerManager() = 0; virtual IDragManager& GetDragManager() = 0; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK virtual ISocketSessionManager& GetSocketSessionManager() = 0; virtual IPluginManager& GetPluginManager() = 0; virtual IInputAdapter& GetInput() = 0; virtual IDSoftbusAdapter& GetDSoftbus() = 0; virtual IDDPAdapter& GetDP() = 0; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; } // namespace DeviceStatus } // namespace Msdp diff --git a/intention/prototype/include/i_drag_manager.h b/intention/prototype/include/i_drag_manager.h index acb2279bb..560834271 100644 --- a/intention/prototype/include/i_drag_manager.h +++ b/intention/prototype/include/i_drag_manager.h @@ -24,9 +24,7 @@ #include "transaction/rs_transaction.h" #include "drag_data.h" -#ifndef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "stream_session.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -38,19 +36,11 @@ public: virtual void Dump(int32_t fd) const = 0; virtual void RegisterStateChange(std::function callback) = 0; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK virtual int32_t AddListener(int32_t pid) = 0; virtual int32_t RemoveListener(int32_t pid) = 0; virtual int32_t AddSubscriptListener(int32_t pid) = 0; virtual int32_t RemoveSubscriptListener(int32_t pid) = 0; virtual int32_t StartDrag(const DragData &dragData, int32_t pid) = 0; -#else - virtual int32_t AddListener(SessionPtr session) = 0; - virtual int32_t RemoveListener(SessionPtr session) = 0; - virtual int32_t AddSubscriptListener(SessionPtr session) = 0; - virtual int32_t RemoveSubscriptListener(SessionPtr session) = 0; - virtual int32_t StartDrag(const DragData &dragData, SessionPtr sess) = 0; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK virtual int32_t StopDrag(const DragDropResult &dropResult, const std::string &packageName = "") = 0; virtual int32_t GetDragData(DragData &dragData) = 0; virtual int32_t GetDragTargetPid() const = 0; diff --git a/intention/services/test/unittest/BUILD.gn b/intention/services/test/unittest/BUILD.gn index ab9bda7f1..3ff89b410 100644 --- a/intention/services/test/unittest/BUILD.gn +++ b/intention/services/test/unittest/BUILD.gn @@ -175,6 +175,7 @@ ohos_unittest("IntentionDeviceManagerTest") { ] external_deps = [ + "ability_runtime:app_manager", "access_token:libaccesstoken_sdk", "cJSON:cjson", "c_utils:utils", diff --git a/intention/services/test/unittest/src/device_manager_test.cpp b/intention/services/test/unittest/src/device_manager_test.cpp index bd3dadbc3..b92886cfe 100644 --- a/intention/services/test/unittest/src/device_manager_test.cpp +++ b/intention/services/test/unittest/src/device_manager_test.cpp @@ -28,10 +28,8 @@ #include "i_context.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #undef LOG_TAG #define LOG_TAG "IntentionDeviceManagerTest" @@ -49,14 +47,11 @@ public: IDeviceManager& GetDeviceManager() override; ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; - -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK private: void OnStart(); bool Init(); @@ -68,13 +63,11 @@ private: TimerManager timerMgr_; DeviceManager devMgr_; DragManager dragMgr_; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK SocketSessionManager socketSessionMgr_; std::unique_ptr input_; std::unique_ptr pluginMgr_; std::unique_ptr dsoftbusAda_; std::unique_ptr ddp_; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; class IntentionDeviceManagerTest : public testing::Test { public: @@ -92,13 +85,8 @@ constexpr int32_t TIME_WAIT_FOR_OP_MS { 100 }; ContextService::ContextService() { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK FI_HILOGI("OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK is on"); OnStart(); -#else - FI_HILOGI("OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK is off"); - OnStart(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } IDelegateTasks& ContextService::GetDelegateTasks() @@ -131,7 +119,6 @@ __attribute__((no_sanitize("cfi"))) ContextService* ContextService::GetInstance( }); return g_instance; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return socketSessionMgr_; @@ -156,7 +143,6 @@ IDDPAdapter& ContextService::GetDP() { return *ddp_; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK bool ContextService::Init() { diff --git a/services/interaction/drag/include/drag_manager.h b/services/interaction/drag/include/drag_manager.h index aba645f4c..0054aaf17 100644 --- a/services/interaction/drag/include/drag_manager.h +++ b/services/interaction/drag/include/drag_manager.h @@ -42,21 +42,12 @@ public: ~DragManager(); int32_t Init(IContext* context); -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void OnSessionLost(SocketSessionPtr session); int32_t AddListener(int32_t pid) override; int32_t RemoveListener(int32_t pid) override; int32_t AddSubscriptListener(int32_t pid) override; int32_t RemoveSubscriptListener(int32_t pid) override; int32_t StartDrag(const DragData &dragData, int32_t pid) override; -#else - void OnSessionLost(SessionPtr session); - int32_t AddListener(SessionPtr session) override; - int32_t RemoveListener(SessionPtr session) override; - int32_t AddSubscriptListener(SessionPtr session) override; - int32_t RemoveSubscriptListener(SessionPtr session) override; - int32_t StartDrag(const DragData &dragData, SessionPtr sess) override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t StopDrag(const DragDropResult &dropResult, const std::string &packageName = "") override; int32_t GetDragTargetPid() const override; int32_t GetUdKey(std::string &udKey) const override; @@ -156,11 +147,7 @@ private: #ifdef OHOS_DRAG_ENABLE_MONITOR int32_t pointerEventMonitorId_ { -1 }; #endif //OHOS_DRAG_ENABLE_MONITOR -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK SocketSessionPtr dragOutSession_ { nullptr }; -#else - SessionPtr dragOutSession_ { nullptr }; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK DragDrawing dragDrawing_; IContext* context_ { nullptr }; std::function stateChangedCallback_ { nullptr }; diff --git a/services/interaction/drag/include/state_change_notify.h b/services/interaction/drag/include/state_change_notify.h index 0b68a6b18..b994fdb70 100644 --- a/services/interaction/drag/include/state_change_notify.h +++ b/services/interaction/drag/include/state_change_notify.h @@ -21,11 +21,7 @@ #include #include "drag_data.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "i_socket_session.h" -#else -#include "stream_session.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -42,11 +38,7 @@ public: struct MessageInfo { MessageType msgType { MessageType::NOTIFY_NONE }; MessageId msgId { MessageId::INVALID }; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK SocketSessionPtr session { nullptr }; -#else - SessionPtr session { nullptr }; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK DragState state { DragState::ERROR }; DragCursorStyle style { DragCursorStyle::DEFAULT }; bool operator==(std::shared_ptr info) @@ -64,11 +56,7 @@ public: private: template -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void OnDragInfoNotify(SocketSessionPtr session, MessageId msgId, T t); -#else - void OnDragInfoNotify(SessionPtr session, MessageId msgId, T t); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK private: std::list> msgStateInfos_; diff --git a/services/interaction/drag/src/drag_manager.cpp b/services/interaction/drag/src/drag_manager.cpp index 47775ede6..4b040d3db 100644 --- a/services/interaction/drag/src/drag_manager.cpp +++ b/services/interaction/drag/src/drag_manager.cpp @@ -98,34 +98,17 @@ int32_t DragManager::Init(IContext* context) return RET_OK; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void DragManager::OnSessionLost(SocketSessionPtr session) { CHKPV(session); RemoveListener(session->GetPid()); } -#else -void DragManager::OnSessionLost(SessionPtr session) -{ - FI_HILOGI("enter"); - if (RemoveListener(session) != RET_OK) { - FI_HILOGE("Failed to clear client listener"); - } - FI_HILOGI("leave"); -} -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t DragManager::AddListener(int32_t pid) { FI_HILOGI("enter"); CHKPR(context_, RET_ERR); auto session = context_->GetSocketSessionManager().FindSessionByPid(pid); -#else -int32_t DragManager::AddListener(SessionPtr session) -{ - FI_HILOGI("enter"); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK CHKPR(session, RET_ERR); auto info = std::make_shared(); info->session = session; @@ -138,17 +121,11 @@ int32_t DragManager::AddListener(SessionPtr session) return RET_OK; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t DragManager::RemoveListener(int32_t pid) { FI_HILOGI("Remove listener, pid:%{public}d", pid); CHKPR(context_, RET_ERR); auto session = context_->GetSocketSessionManager().FindSessionByPid(pid); -#else -int32_t DragManager::RemoveListener(SessionPtr session) -{ - FI_HILOGI("enter"); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK CHKPR(session, RET_ERR); auto info = std::make_shared(); info->session = session; @@ -158,17 +135,11 @@ int32_t DragManager::RemoveListener(SessionPtr session) return RET_OK; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t DragManager::AddSubscriptListener(int32_t pid) { FI_HILOGI("enter"); CHKPR(context_, RET_ERR); auto session = context_->GetSocketSessionManager().FindSessionByPid(pid); -#else -int32_t DragManager::AddSubscriptListener(SessionPtr session) -{ - FI_HILOGI("enter"); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK CHKPR(session, RET_ERR); auto info = std::make_shared(); info->session = session; @@ -179,17 +150,11 @@ int32_t DragManager::AddSubscriptListener(SessionPtr session) return RET_OK; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t DragManager::RemoveSubscriptListener(int32_t pid) { FI_HILOGI("enter"); CHKPR(context_, RET_ERR); auto session = context_->GetSocketSessionManager().FindSessionByPid(pid); -#else -int32_t DragManager::RemoveSubscriptListener(SessionPtr session) -{ - FI_HILOGI("enter"); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK CHKPR(session, RET_ERR); auto info = std::make_shared(); info->msgType = MessageType::NOTIFY_STYLE; @@ -224,11 +189,7 @@ void DragManager::PrintDragData(const DragData &dragData, const std::string &pac dragData.hasCoordinateCorrected, summarys.c_str(), packageName.c_str()); } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t DragManager::StartDrag(const DragData &dragData, int32_t pid) -#else -int32_t DragManager::StartDrag(const DragData &dragData, SessionPtr sess) -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK { FI_HILOGI("enter"); if (dragState_ == DragState::START) { @@ -236,7 +197,6 @@ int32_t DragManager::StartDrag(const DragData &dragData, SessionPtr sess) return RET_ERR; } std::string packageName = std::string(); -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK CHKPR(context_, RET_ERR); dragOutSession_ = context_->GetSocketSessionManager().FindSessionByPid(pid); if (dragOutSession_ != nullptr) { @@ -244,9 +204,6 @@ int32_t DragManager::StartDrag(const DragData &dragData, SessionPtr sess) std::bind(&DragManager::OnSessionLost, this, std::placeholders::_1)); } packageName = (pid == -1) ? "Cross-device drag" : dragOutSession_->GetProgramName(); -#else - dragOutSession_ = sess; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK PrintDragData(dragData, packageName); if (InitDataManager(dragData) != RET_OK) { FI_HILOGE("Failed to init data manager"); @@ -271,7 +228,6 @@ int32_t DragManager::StartDrag(const DragData &dragData, SessionPtr sess) int32_t DragManager::StopDrag(const DragDropResult &dropResult, const std::string &packageName) { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK std::string dragOutPkgName = (dragOutSession_ == nullptr) ? "Cross-device drag" : dragOutSession_->GetProgramName(); FI_HILOGI("mainWindow:%{public}d, dragResult:%{public}d, drop packageName:%{public}s," @@ -280,7 +236,6 @@ int32_t DragManager::StopDrag(const DragDropResult &dropResult, const std::strin #ifdef OHOS_DRAG_ENABLE_ANIMATION dragDrawing_.NotifyDragInfo(dragOutPkgName, packageName); #endif // OHOS_DRAG_ENABLE_ANIMATION -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK if (dragState_ == DragState::STOP) { FI_HILOGE("No drag instance running, can not stop drag"); return RET_ERR; @@ -304,6 +259,7 @@ int32_t DragManager::StopDrag(const DragDropResult &dropResult, const std::strin stateNotify_.StateChangedNotify(DragState::STOP); DragBehavior dragBehavior = dropResult.dragBehavior; GetDragBehavior(dropResult, dragBehavior); + if (NotifyDragResult(dropResult.result, dragBehavior) != RET_OK) { FI_HILOGE("Notify drag result failed"); } diff --git a/services/interaction/drag/src/state_change_notify.cpp b/services/interaction/drag/src/state_change_notify.cpp index 73c404993..cc0d6c1d5 100644 --- a/services/interaction/drag/src/state_change_notify.cpp +++ b/services/interaction/drag/src/state_change_notify.cpp @@ -85,11 +85,7 @@ int32_t StateChangeNotify::StateChangedNotify(DragState state) } template -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void StateChangeNotify::OnDragInfoNotify(SocketSessionPtr session, MessageId msgId, T t) -#else -void StateChangeNotify::OnDragInfoNotify(SessionPtr session, MessageId msgId, T t) -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK { CALL_DEBUG_ENTER; CHKPV(session); diff --git a/services/native/include/devicestatus_service.h b/services/native/include/devicestatus_service.h index b07723f2e..ba250ebe9 100644 --- a/services/native/include/devicestatus_service.h +++ b/services/native/include/devicestatus_service.h @@ -30,10 +30,8 @@ #include "drag_data.h" #include "drag_manager.h" #include "i_context.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "stationary_callback.h" #include "stationary_data.h" #include "stream_server.h" @@ -60,13 +58,11 @@ public: ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void OnAddSystemAbility(int32_t saId, const std::string &deviceId) override; void Subscribe(Type type, ActivityEvent event, ReportLatencyNs latency, @@ -130,9 +126,7 @@ private: void OnDeviceMgr(const epoll_event &ev); int32_t EnableDevMgr(int32_t nRetries); void DisableDevMgr(); -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void EnableDSoftbus(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #ifdef OHOS_BUILD_ENABLE_COORDINATION #ifndef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK @@ -162,14 +156,12 @@ private: #ifdef OHOS_BUILD_ENABLE_MOTION_DRAG std::unique_ptr motionDrag_ { nullptr }; #endif // OHOS_BUILD_ENABLE_MOTION_DRAG -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK SocketSessionManager socketSessionMgr_; std::unique_ptr input_; std::unique_ptr pluginMgr_; std::unique_ptr dsoftbus_; std::unique_ptr ddp_; sptr intention_; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; } // namespace DeviceStatus } // namespace Msdp diff --git a/services/native/src/devicestatus_service.cpp b/services/native/src/devicestatus_service.cpp index 29a80ba5c..63d5a1594 100644 --- a/services/native/src/devicestatus_service.cpp +++ b/services/native/src/devicestatus_service.cpp @@ -32,12 +32,10 @@ #include "devicestatus_common.h" #include "devicestatus_hisysevent.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "ddp_adapter.h" #include "dsoftbus_adapter.h" #include "input_adapter.h" #include "plugin_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #ifdef OHOS_BUILD_ENABLE_MOTION_DRAG #include "motion_drag.h" #endif // OHOS_BUILD_ENABLE_MOTION_DRAG @@ -65,12 +63,10 @@ const bool REGISTER_RESULT = DeviceStatusService::DeviceStatusService() : SystemAbility(MSDP_DEVICESTATUS_SERVICE_ID, true) { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK input_ = std::make_unique(); pluginMgr_ = std::make_unique(this); dsoftbus_ = std::make_unique(); ddp_ = std::make_unique(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } DeviceStatusService::~DeviceStatusService() @@ -108,13 +104,9 @@ void DeviceStatusService::OnStart() #ifdef MEMMGR_ENABLE AddSystemAbilityListener(MEMORY_MANAGER_SA_ID); #endif -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK EnableDSoftbus(); intention_ = sptr::MakeSptr(this); if (!Publish(intention_)) { -#else - if (!Publish(this)) { -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK FI_HILOGE("On start register to system ability manager failed"); return; } @@ -165,7 +157,6 @@ IDragManager& DeviceStatusService::GetDragManager() return dragMgr_; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& DeviceStatusService::GetSocketSessionManager() { return socketSessionMgr_; @@ -206,7 +197,6 @@ void DeviceStatusService::EnableDSoftbus() FI_HILOGI("Enable dsoftbus successfully"); } } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t DeviceStatusService::Dump(int32_t fd, const std::vector &args) { @@ -768,13 +758,7 @@ int32_t DeviceStatusService::GetCoordinationState(const std::string &udId, bool int32_t DeviceStatusService::AddDraglistener() { CALL_DEBUG_ENTER; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t session = GetCallingPid(); -#else - int32_t pid = GetCallingPid(); - SessionPtr session = GetSession(GetClientFd(pid)); - CHKPR(session, RET_ERR); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t ret = delegateTasks_.PostSyncTask( std::bind(&DragManager::AddListener, &dragMgr_, session)); if (ret != RET_OK) { @@ -786,16 +770,7 @@ int32_t DeviceStatusService::AddDraglistener() int32_t DeviceStatusService::RemoveDraglistener() { CALL_DEBUG_ENTER; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t session = GetCallingPid(); -#else - int32_t pid = GetCallingPid(); - SessionPtr session = GetSession(GetClientFd(pid)); - if (session == nullptr) { - FI_HILOGW("Session is nullptr"); - return RET_OK; - } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t ret = delegateTasks_.PostSyncTask( std::bind(&DragManager::RemoveListener, &dragMgr_, session)); if (ret != RET_OK) { @@ -807,13 +782,7 @@ int32_t DeviceStatusService::RemoveDraglistener() int32_t DeviceStatusService::AddSubscriptListener() { CALL_DEBUG_ENTER; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t session = GetCallingPid(); -#else - int32_t pid = GetCallingPid(); - SessionPtr session = GetSession(GetClientFd(pid)); - CHKPR(session, RET_ERR); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t ret = delegateTasks_.PostSyncTask( std::bind(&DragManager::AddSubscriptListener, &dragMgr_, session)); if (ret != RET_OK) { @@ -825,13 +794,7 @@ int32_t DeviceStatusService::AddSubscriptListener() int32_t DeviceStatusService::RemoveSubscriptListener() { CALL_DEBUG_ENTER; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t session = GetCallingPid(); -#else - int32_t pid = GetCallingPid(); - SessionPtr session = GetSession(GetClientFd(pid)); - CHKPR(session, RET_ERR); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t ret = delegateTasks_.PostSyncTask( std::bind(&DragManager::RemoveSubscriptListener, &dragMgr_, session)); if (ret != RET_OK) { @@ -843,14 +806,7 @@ int32_t DeviceStatusService::RemoveSubscriptListener() int32_t DeviceStatusService::StartDrag(const DragData &dragData) { CALL_DEBUG_ENTER; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t session = GetCallingPid(); -#else - int32_t pid = GetCallingPid(); - AddSessionDeletedCallback(pid, std::bind(&DragManager::OnSessionLost, &dragMgr_, std::placeholders::_1)); - SessionPtr session = GetSession(GetClientFd(pid)); - CHKPR(session, RET_ERR); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK int32_t ret = delegateTasks_.PostSyncTask( std::bind(&DragManager::StartDrag, &dragMgr_, std::cref(dragData), session)); if (ret != RET_OK) { diff --git a/services/native/test/moduletest/src/devicestatus_module_test.cpp b/services/native/test/moduletest/src/devicestatus_module_test.cpp index 1d2bc0d96..c4a3e5209 100644 --- a/services/native/test/moduletest/src/devicestatus_module_test.cpp +++ b/services/native/test/moduletest/src/devicestatus_module_test.cpp @@ -80,13 +80,9 @@ HWTEST_F(DeviceStatusModuleTest, GetDeviceStatusDataTest001, TestSize.Level0) Data data = stationaryManager->GetDeviceStatusData(type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_EQ(true, data.type == g_moduleTest && data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT) << "GetDeviceStatusData failed"; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } /** @@ -103,13 +99,9 @@ HWTEST_F(DeviceStatusModuleTest, GetDeviceStatusDataTest002, TestSize.Level0) Data data = stationaryManager->GetDeviceStatusData(type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_EQ(true, data.type == g_moduleTest && data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT) << "GetDeviceStatusData failed"; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } /** @@ -126,13 +118,9 @@ HWTEST_F(DeviceStatusModuleTest, GetDeviceStatusDataTest003, TestSize.Level0) Data data = stationaryManager->GetDeviceStatusData(type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_EQ(true, data.type == g_moduleTest && data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT) << "GetDeviceStatusData failed"; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } /** @@ -148,13 +136,9 @@ HWTEST_F(DeviceStatusModuleTest, GetDeviceStatusDataTest004, TestSize.Level0) Data data = StationaryManager::GetInstance()->GetDeviceStatusData(type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_EQ(true, data.type == g_moduleTest && data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT) << "GetDeviceStatusData failed"; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } } // namespace } // namespace DeviceStatus diff --git a/services/native/test/unittest/src/devicestatus_service_test.cpp b/services/native/test/unittest/src/devicestatus_service_test.cpp index 049a3b4d1..d0291debc 100644 --- a/services/native/test/unittest/src/devicestatus_service_test.cpp +++ b/services/native/test/unittest/src/devicestatus_service_test.cpp @@ -87,12 +87,8 @@ HWTEST_F(DeviceStatusServiceTest, GetDeviceStatusDataTest002, TestSize.Level0) Data data = g_client->GetDeviceStatusData(g_type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data.type == Type::TYPE_ABSOLUTE_STILL && (data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT)); -#endif // OHOS_BUILD_ENABLE_COORDINATION GTEST_LOG_(INFO) << "GetDeviceStatusData failed"; } @@ -137,12 +133,8 @@ HWTEST_F(DeviceStatusServiceTest, GetDeviceStatusDataTest005, TestSize.Level0) Data data = g_client->GetDeviceStatusData(g_type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data.type == Type::TYPE_CAR_BLUETOOTH && (data.value <= OnChangedValue::VALUE_EXIT && data.value >= OnChangedValue::VALUE_INVALID)); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK GTEST_LOG_(INFO) << "GetDeviceStatusData failed"; } @@ -187,12 +179,8 @@ HWTEST_F(DeviceStatusServiceTest, GetDeviceStatusDataTest008, TestSize.Level0) Data data = g_client->GetDeviceStatusData(g_type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data.type == Type::TYPE_HORIZONTAL_POSITION && (data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT)); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK GTEST_LOG_(INFO) << "GetDeviceStatusData failed"; } @@ -237,12 +225,8 @@ HWTEST_F(DeviceStatusServiceTest, GetDeviceStatusDataTest011, TestSize.Level0) Data data = g_client->GetDeviceStatusData(g_type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data.type == Type::TYPE_RELATIVE_STILL && (data.value <= OnChangedValue::VALUE_EXIT && data.value >= OnChangedValue::VALUE_INVALID)); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK GTEST_LOG_(INFO) << "GetDeviceStatusData failed"; } @@ -287,12 +271,8 @@ HWTEST_F(DeviceStatusServiceTest, GetDeviceStatusDataTest014, TestSize.Level0) Data data = g_client->GetDeviceStatusData(g_type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data.type == Type::TYPE_STILL && (data.value <= OnChangedValue::VALUE_EXIT && data.value >= OnChangedValue::VALUE_INVALID)); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK GTEST_LOG_(INFO) << "GetDeviceStatusData failed"; } @@ -337,12 +317,8 @@ HWTEST_F(DeviceStatusServiceTest, GetDeviceStatusDataTest017, TestSize.Level0) Data data = g_client->GetDeviceStatusData(g_type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data.type == Type::TYPE_VERTICAL_POSITION && (data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT)); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK GTEST_LOG_(INFO) << "GetDeviceStatusData failed"; } @@ -372,23 +348,15 @@ HWTEST_F(DeviceStatusServiceTest, GetDeviceStatusDataTest019, TestSize.Level0) Data data = g_client->GetDeviceStatusData(g_type); GTEST_LOG_(INFO) << "type: " << data.type; GTEST_LOG_(INFO) << "value: " << data.value; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data.type == Type::TYPE_VERTICAL_POSITION && (data.value >= OnChangedValue::VALUE_INVALID && data.value <= OnChangedValue::VALUE_EXIT)); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK GTEST_LOG_(INFO) << "GetDeviceStatusData failed"; Data invalidData; invalidData.type = Type::TYPE_INVALID; invalidData.value = OnChangedValue::VALUE_INVALID; invalidData.status = Status::STATUS_INVALID; invalidData.movement = 0.0f; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED " << data.value; -#else EXPECT_TRUE(data != invalidData); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } } // namespace } // namespace DeviceStatus diff --git a/test/systemtest/src/devicestatus_client_test.cpp b/test/systemtest/src/devicestatus_client_test.cpp index f2f8ae6d1..18814191a 100644 --- a/test/systemtest/src/devicestatus_client_test.cpp +++ b/test/systemtest/src/devicestatus_client_test.cpp @@ -99,9 +99,6 @@ HWTEST_F(DeviceStatusClientTest, DeviceStatusCallbackTest001, TestSize.Level0) HWTEST_F(DeviceStatusClientTest, GetDeviceStatusDataTest001, TestSize.Level0) { CALL_TEST_DEBUG; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK - GTEST_LOG_(INFO) << "INTENTION_FRAMEWORK, UNSUPPORTED "; -#else auto stationaryMgr = StationaryManager::GetInstance(); OnChangedValue invalidValue = OnChangedValue::VALUE_INVALID; OnChangedValue exitValue = OnChangedValue::VALUE_EXIT; @@ -129,7 +126,6 @@ HWTEST_F(DeviceStatusClientTest, GetDeviceStatusDataTest001, TestSize.Level0) type = static_cast(10); data = stationaryMgr->GetDeviceStatusData(type); EXPECT_TRUE(data.type == type && data.value >= invalidValue && data.value <= exitValue); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } } // namespace DeviceStatus } // namespace Msdp diff --git a/test/unittest/intention/scheduler/BUILD.gn b/test/unittest/intention/scheduler/BUILD.gn index 92b4e57dc..56a5420dc 100644 --- a/test/unittest/intention/scheduler/BUILD.gn +++ b/test/unittest/intention/scheduler/BUILD.gn @@ -68,6 +68,8 @@ ohos_unittest("TimerManagerTest") { ] external_deps = [ + "ability_runtime:app_manager", + "access_token:libaccesstoken_sdk", "cJSON:cjson", "c_utils:utils", "device_info_manager:distributed_device_profile_client", diff --git a/test/unittest/intention/scheduler/include/timer_manager_test.h b/test/unittest/intention/scheduler/include/timer_manager_test.h index aa4f53b59..3fc0faab1 100644 --- a/test/unittest/intention/scheduler/include/timer_manager_test.h +++ b/test/unittest/intention/scheduler/include/timer_manager_test.h @@ -32,10 +32,8 @@ #include "i_context.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -66,13 +64,11 @@ public: ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK private: void OnStart(); void OnStop(); @@ -98,13 +94,11 @@ private: std::atomic ready_ { false }; DragManager dragMgr_; int32_t epollFd_ { -1 }; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK SocketSessionManager socketSessionMgr_; std::unique_ptr input_; std::unique_ptr pluginMgr_; std::unique_ptr dsoftbusAda_; std::unique_ptr ddp_; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; class TimerManagerTest : public testing::Test { diff --git a/test/unittest/intention/scheduler/src/timer_manager_test.cpp b/test/unittest/intention/scheduler/src/timer_manager_test.cpp index bfb40f3a7..a9ea2bc4b 100644 --- a/test/unittest/intention/scheduler/src/timer_manager_test.cpp +++ b/test/unittest/intention/scheduler/src/timer_manager_test.cpp @@ -46,13 +46,8 @@ constexpr int32_t ERROR_INTERVAL_MS { 1000000 }; ContextService::ContextService() { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK FI_HILOGI("OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK is on"); OnStart(); -#else - FI_HILOGI("OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK is off"); - OnStart(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } ContextService::~ContextService() @@ -91,7 +86,6 @@ __attribute__((no_sanitize("cfi"))) ContextService* ContextService::GetInstance( return g_instance; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return socketSessionMgr_; @@ -116,7 +110,6 @@ IDDPAdapter& ContextService::GetDP() { return *ddp_; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK bool ContextService::Init() { diff --git a/test/unittest/intention/services/include/intention_service_test.h b/test/unittest/intention/services/include/intention_service_test.h index 8437b7e5a..ce4a70d2c 100644 --- a/test/unittest/intention/services/include/intention_service_test.h +++ b/test/unittest/intention/services/include/intention_service_test.h @@ -27,10 +27,8 @@ #include "i_context.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -51,27 +49,23 @@ public: IDeviceManager& GetDeviceManager() override; ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK static ContextService* GetInstance(); private: MockDelegateTasks delegateTasks_; DeviceManager devMgr_; TimerManager timerMgr_; DragManager dragMgr_; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK SocketSessionManager socketSessionMgr_; std::unique_ptr input_ { nullptr }; std::unique_ptr pluginMgr_ { nullptr }; std::unique_ptr dsoftbus_ { nullptr }; std::unique_ptr ddp_ { nullptr }; sptr intention_ { nullptr }; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; class IntentionServiceTest : public testing::Test { diff --git a/test/unittest/intention/services/src/intention_service_test.cpp b/test/unittest/intention/services/src/intention_service_test.cpp index cbd0aee2c..c85e39775 100644 --- a/test/unittest/intention/services/src/intention_service_test.cpp +++ b/test/unittest/intention/services/src/intention_service_test.cpp @@ -89,12 +89,10 @@ ContextService* ContextService::GetInstance() ContextService::ContextService() { -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK input_ = std::make_unique(); pluginMgr_ = std::make_unique(this); dsoftbus_ = std::make_unique(); ddp_ = std::make_unique(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK } IDelegateTasks& ContextService::GetDelegateTasks() @@ -117,7 +115,6 @@ IDragManager& ContextService::GetDragManager() return dragMgr_; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return socketSessionMgr_; @@ -142,7 +139,6 @@ IDDPAdapter& ContextService::GetDP() { return *ddp_; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void IntentionServiceTest::SetUpTestCase() { diff --git a/test/unittest/intentiontest/include/cooperate_plugin_test.h b/test/unittest/intentiontest/include/cooperate_plugin_test.h index e5cc808a8..0cdcb39be 100644 --- a/test/unittest/intentiontest/include/cooperate_plugin_test.h +++ b/test/unittest/intentiontest/include/cooperate_plugin_test.h @@ -34,10 +34,8 @@ #include "i_context.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -52,14 +50,12 @@ public: ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; static ContextService* GetInstance(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; class CooperatePluginTest : public testing::Test { diff --git a/test/unittest/intentiontest/include/cooperate_test.h b/test/unittest/intentiontest/include/cooperate_test.h index 69c76358a..1e62f18b7 100644 --- a/test/unittest/intentiontest/include/cooperate_test.h +++ b/test/unittest/intentiontest/include/cooperate_test.h @@ -33,10 +33,8 @@ #include "i_context.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -51,14 +49,12 @@ public: ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; static ContextService* GetInstance(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; class CooperateTest : public testing::Test { diff --git a/test/unittest/intentiontest/include/drag_server_test.h b/test/unittest/intentiontest/include/drag_server_test.h index 4d11c3c58..dc2cfb2d7 100644 --- a/test/unittest/intentiontest/include/drag_server_test.h +++ b/test/unittest/intentiontest/include/drag_server_test.h @@ -41,14 +41,12 @@ public: ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; static ContextService* GetInstance(); -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK }; class DragServerTest : public testing::Test { diff --git a/test/unittest/intentiontest/include/input_event_builder_test.h b/test/unittest/intentiontest/include/input_event_builder_test.h index 196c61a74..c7e8ac8af 100644 --- a/test/unittest/intentiontest/include/input_event_builder_test.h +++ b/test/unittest/intentiontest/include/input_event_builder_test.h @@ -30,10 +30,8 @@ #include "input_event_serialization.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -48,14 +46,11 @@ public: IDeviceManager& GetDeviceManager() override; ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; - -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK private: static ContextService* GetInstance(); DelegateTasks delegateTasks_; diff --git a/test/unittest/intentiontest/include/input_event_interceptor_test.h b/test/unittest/intentiontest/include/input_event_interceptor_test.h index e05965949..4b51f14ba 100644 --- a/test/unittest/intentiontest/include/input_event_interceptor_test.h +++ b/test/unittest/intentiontest/include/input_event_interceptor_test.h @@ -16,8 +16,6 @@ #ifndef INPUT_EVENT_INTERCEPTOR_TEST_H #define INPUT_EVENT_INTERCEPTOR_TEST_H -#define private public - #include #include "cooperate_context.h" @@ -32,10 +30,8 @@ #include "input_event_serialization.h" #include "timer_manager.h" -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK #include "intention_service.h" #include "socket_session_manager.h" -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK namespace OHOS { namespace Msdp { @@ -50,14 +46,11 @@ public: IDeviceManager& GetDeviceManager() override; ITimerManager& GetTimerManager() override; IDragManager& GetDragManager() override; - -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK IPluginManager& GetPluginManager() override; ISocketSessionManager& GetSocketSessionManager() override; IInputAdapter& GetInput() override; IDSoftbusAdapter& GetDSoftbus() override; IDDPAdapter& GetDP() override; -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK private: static ContextService* GetInstance(); DelegateTasks delegateTasks_; diff --git a/test/unittest/intentiontest/src/cooperate_plugin_test.cpp b/test/unittest/intentiontest/src/cooperate_plugin_test.cpp index 0c33997cf..5f6699e93 100644 --- a/test/unittest/intentiontest/src/cooperate_plugin_test.cpp +++ b/test/unittest/intentiontest/src/cooperate_plugin_test.cpp @@ -102,7 +102,6 @@ ContextService* ContextService::GetInstance() return g_instance; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return g_socketSessionMgr; @@ -127,7 +126,6 @@ IDDPAdapter& ContextService::GetDP() { return *g_ddp; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK MMI::PointerEvent::PointerItem CooperatePluginTest::CreatePointerItem(int32_t pointerId, int32_t deviceId, const std::pair &displayLocation, bool isPressed) diff --git a/test/unittest/intentiontest/src/cooperate_test.cpp b/test/unittest/intentiontest/src/cooperate_test.cpp index bc0a19f3c..082ec4832 100644 --- a/test/unittest/intentiontest/src/cooperate_test.cpp +++ b/test/unittest/intentiontest/src/cooperate_test.cpp @@ -84,7 +84,6 @@ ContextService* ContextService::GetInstance() return g_instance; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return g_socketSessionMgr; @@ -109,7 +108,6 @@ IDDPAdapter& ContextService::GetDP() { return *g_ddp; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK class CooperateObserver final : public ICooperateObserver { public: diff --git a/test/unittest/intentiontest/src/drag_server_test.cpp b/test/unittest/intentiontest/src/drag_server_test.cpp index 29e5bd144..dfb448dd2 100644 --- a/test/unittest/intentiontest/src/drag_server_test.cpp +++ b/test/unittest/intentiontest/src/drag_server_test.cpp @@ -112,7 +112,6 @@ ContextService* ContextService::GetInstance() return g_instance; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return g_socketSessionMgr; @@ -137,7 +136,6 @@ IDDPAdapter& ContextService::GetDP() { return *g_ddp; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void DragServerTest::SetUpTestCase() {} diff --git a/test/unittest/intentiontest/src/input_event_builder_test.cpp b/test/unittest/intentiontest/src/input_event_builder_test.cpp index c3e288e93..f6bd20d64 100644 --- a/test/unittest/intentiontest/src/input_event_builder_test.cpp +++ b/test/unittest/intentiontest/src/input_event_builder_test.cpp @@ -69,7 +69,6 @@ ContextService* ContextService::GetInstance() return g_instance; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return socketSessionMgr_; @@ -94,7 +93,6 @@ IDDPAdapter& ContextService::GetDP() { return *ddp_; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void InputEventBuilderTest::SetUpTestCase() { diff --git a/test/unittest/intentiontest/src/input_event_interceptor_test.cpp b/test/unittest/intentiontest/src/input_event_interceptor_test.cpp index 430366bb7..f4b578a6f 100644 --- a/test/unittest/intentiontest/src/input_event_interceptor_test.cpp +++ b/test/unittest/intentiontest/src/input_event_interceptor_test.cpp @@ -68,7 +68,6 @@ ContextService* ContextService::GetInstance() return g_instance; } -#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK ISocketSessionManager& ContextService::GetSocketSessionManager() { return socketSessionMgr_; @@ -93,7 +92,6 @@ IDDPAdapter& ContextService::GetDP() { return *ddp_; } -#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK void InputEventInterceptorTest::SetUpTestCase() { From c23a89df6c5311a272fd6b1db409ec05d509c1e3 Mon Sep 17 00:00:00 2001 From: pengyanggit Date: Wed, 19 Jun 2024 15:09:46 +0800 Subject: [PATCH 2/2] Signed-off-by: pengyanggit Change-Id: I8d58648d432e4849248d4fa9a88c5bf79cb3aa22 --- services/interaction/drag/src/drag_manager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/services/interaction/drag/src/drag_manager.cpp b/services/interaction/drag/src/drag_manager.cpp index 4b040d3db..7b8b34054 100644 --- a/services/interaction/drag/src/drag_manager.cpp +++ b/services/interaction/drag/src/drag_manager.cpp @@ -259,7 +259,6 @@ int32_t DragManager::StopDrag(const DragDropResult &dropResult, const std::strin stateNotify_.StateChangedNotify(DragState::STOP); DragBehavior dragBehavior = dropResult.dragBehavior; GetDragBehavior(dropResult, dragBehavior); - if (NotifyDragResult(dropResult.result, dragBehavior) != RET_OK) { FI_HILOGE("Notify drag result failed"); }