mirror of
https://gitee.com/openharmony/msdp_device_status
synced 2024-11-27 09:41:43 +00:00
commit
a441f7fd1f
@ -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 {
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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<IRemoteDevStaCallback> 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<IRemoteDevStaCallback> 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
|
||||
|
@ -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,24 +67,20 @@ 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;
|
||||
#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<IInputAdapter> input_ { nullptr };
|
||||
std::unique_ptr<IPluginManager> pluginMgr_ { nullptr };
|
||||
std::unique_ptr<IDSoftbusAdapter> dsoftbus_ { nullptr };
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
|
@ -109,11 +109,9 @@ int32_t MockInputAdapter::RemoveVirtualInputDevice(int32_t deviceId)
|
||||
|
||||
TestContext::TestContext()
|
||||
{
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
input_ = std::make_unique<MockInputAdapter>();
|
||||
pluginMgr_ = std::make_unique<PluginManager>(this);
|
||||
dsoftbus_ = std::make_unique<DSoftbusAdapter>();
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
}
|
||||
|
||||
IDelegateTasks& TestContext::GetDelegateTasks()
|
||||
@ -136,7 +134,6 @@ IDragManager& TestContext::GetDragManager()
|
||||
return dragMgr_;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& TestContext::GetSocketSessionManager()
|
||||
{
|
||||
return socketSessionMgr_;
|
||||
@ -156,7 +153,6 @@ IDSoftbusAdapter& TestContext::GetDSoftbus()
|
||||
{
|
||||
return *dsoftbus_;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
} // namespace OHOS
|
||||
|
@ -19,12 +19,10 @@
|
||||
#include "i_delegate_tasks.h"
|
||||
#include "i_device_manager.h"
|
||||
#include "i_drag_manager.h"
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
#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 {
|
||||
@ -45,12 +43,10 @@ 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;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
|
@ -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<void(DragState)> 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;
|
||||
|
@ -176,6 +176,7 @@ ohos_unittest("IntentionDeviceManagerTest") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_runtime:app_manager",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"cJSON:cjson",
|
||||
"c_utils:utils",
|
||||
|
@ -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,13 +47,10 @@ 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;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
private:
|
||||
void OnStart();
|
||||
bool Init();
|
||||
@ -67,12 +62,10 @@ private:
|
||||
TimerManager timerMgr_;
|
||||
DeviceManager devMgr_;
|
||||
DragManager dragMgr_;
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
SocketSessionManager socketSessionMgr_;
|
||||
std::unique_ptr<IInputAdapter> input_;
|
||||
std::unique_ptr<IPluginManager> pluginMgr_;
|
||||
std::unique_ptr<IDSoftbusAdapter> dsoftbusAda_;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
class IntentionDeviceManagerTest : public testing::Test {
|
||||
public:
|
||||
@ -90,13 +83,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()
|
||||
@ -129,7 +117,6 @@ __attribute__((no_sanitize("cfi"))) ContextService* ContextService::GetInstance(
|
||||
});
|
||||
return g_instance;
|
||||
}
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& ContextService::GetSocketSessionManager()
|
||||
{
|
||||
return socketSessionMgr_;
|
||||
@ -149,7 +136,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
{
|
||||
return *dsoftbusAda_;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
bool ContextService::Init()
|
||||
{
|
||||
|
@ -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<void(DragState)> stateChangedCallback_ { nullptr };
|
||||
|
@ -21,11 +21,7 @@
|
||||
#include <mutex>
|
||||
|
||||
#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<MessageInfo> info)
|
||||
@ -64,11 +56,7 @@ public:
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
#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<std::shared_ptr<MessageInfo>> msgStateInfos_;
|
||||
|
@ -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<StateChangeNotify::MessageInfo>();
|
||||
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<StateChangeNotify::MessageInfo>();
|
||||
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<StateChangeNotify::MessageInfo>();
|
||||
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<StateChangeNotify::MessageInfo>();
|
||||
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;
|
||||
|
@ -85,11 +85,7 @@ int32_t StateChangeNotify::StateChangedNotify(DragState state)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
#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);
|
||||
|
@ -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,12 +58,10 @@ 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;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
void OnAddSystemAbility(int32_t saId, const std::string &deviceId) override;
|
||||
void Subscribe(Type type, ActivityEvent event, ReportLatencyNs latency,
|
||||
@ -129,9 +125,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
|
||||
@ -161,13 +155,11 @@ private:
|
||||
#ifdef OHOS_BUILD_ENABLE_MOTION_DRAG
|
||||
std::unique_ptr<MotionDrag> motionDrag_ { nullptr };
|
||||
#endif // OHOS_BUILD_ENABLE_MOTION_DRAG
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
SocketSessionManager socketSessionMgr_;
|
||||
std::unique_ptr<IInputAdapter> input_;
|
||||
std::unique_ptr<IPluginManager> pluginMgr_;
|
||||
std::unique_ptr<IDSoftbusAdapter> dsoftbus_;
|
||||
sptr<IntentionService> intention_;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
} // namespace DeviceStatus
|
||||
} // namespace Msdp
|
||||
|
@ -32,11 +32,9 @@
|
||||
|
||||
#include "devicestatus_common.h"
|
||||
#include "devicestatus_hisysevent.h"
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
#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
|
||||
@ -64,11 +62,9 @@ const bool REGISTER_RESULT =
|
||||
DeviceStatusService::DeviceStatusService()
|
||||
: SystemAbility(MSDP_DEVICESTATUS_SERVICE_ID, true)
|
||||
{
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
input_ = std::make_unique<InputAdapter>();
|
||||
pluginMgr_ = std::make_unique<PluginManager>(this);
|
||||
dsoftbus_ = std::make_unique<DSoftbusAdapter>();
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
}
|
||||
|
||||
DeviceStatusService::~DeviceStatusService()
|
||||
@ -106,13 +102,9 @@ void DeviceStatusService::OnStart()
|
||||
#ifdef MEMMGR_ENABLE
|
||||
AddSystemAbilityListener(MEMORY_MANAGER_SA_ID);
|
||||
#endif
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
EnableDSoftbus();
|
||||
intention_ = sptr<IntentionService>::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;
|
||||
}
|
||||
@ -163,7 +155,6 @@ IDragManager& DeviceStatusService::GetDragManager()
|
||||
return dragMgr_;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& DeviceStatusService::GetSocketSessionManager()
|
||||
{
|
||||
return socketSessionMgr_;
|
||||
@ -199,7 +190,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<std::u16string> &args)
|
||||
{
|
||||
@ -761,13 +751,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) {
|
||||
@ -779,16 +763,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) {
|
||||
@ -800,13 +775,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) {
|
||||
@ -818,13 +787,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) {
|
||||
@ -836,14 +799,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) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<Type>(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
|
||||
|
@ -67,6 +67,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",
|
||||
|
@ -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,12 +64,10 @@ 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;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
private:
|
||||
void OnStart();
|
||||
void OnStop();
|
||||
@ -97,12 +93,10 @@ private:
|
||||
std::atomic<bool> ready_ { false };
|
||||
DragManager dragMgr_;
|
||||
int32_t epollFd_ { -1 };
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
SocketSessionManager socketSessionMgr_;
|
||||
std::unique_ptr<IInputAdapter> input_;
|
||||
std::unique_ptr<IPluginManager> pluginMgr_;
|
||||
std::unique_ptr<IDSoftbusAdapter> dsoftbusAda_;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
|
||||
class TimerManagerTest : public testing::Test {
|
||||
|
@ -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_;
|
||||
@ -112,8 +106,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
return *dsoftbusAda_;
|
||||
}
|
||||
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
bool ContextService::Init()
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
|
@ -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,25 +49,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;
|
||||
#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<IInputAdapter> input_ { nullptr };
|
||||
std::unique_ptr<IPluginManager> pluginMgr_ { nullptr };
|
||||
std::unique_ptr<IDSoftbusAdapter> dsoftbus_ { nullptr };
|
||||
sptr<IntentionService> intention_ { nullptr };
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
|
||||
class IntentionServiceTest : public testing::Test {
|
||||
|
@ -88,11 +88,9 @@ ContextService* ContextService::GetInstance()
|
||||
|
||||
ContextService::ContextService()
|
||||
{
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
input_ = std::make_unique<InputAdapter>();
|
||||
pluginMgr_ = std::make_unique<PluginManager>(this);
|
||||
dsoftbus_ = std::make_unique<DSoftbusAdapter>();
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
}
|
||||
|
||||
IDelegateTasks& ContextService::GetDelegateTasks()
|
||||
@ -115,7 +113,6 @@ IDragManager& ContextService::GetDragManager()
|
||||
return dragMgr_;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& ContextService::GetSocketSessionManager()
|
||||
{
|
||||
return socketSessionMgr_;
|
||||
@ -135,7 +132,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
{
|
||||
return *dsoftbus_;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
void IntentionServiceTest::SetUpTestCase()
|
||||
{
|
||||
|
@ -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,13 +50,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;
|
||||
static ContextService* GetInstance();
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
|
||||
class CooperatePluginTest : public testing::Test {
|
||||
|
@ -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,13 +49,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;
|
||||
static ContextService* GetInstance();
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
|
||||
class CooperateTest : public testing::Test {
|
||||
|
@ -41,13 +41,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;
|
||||
static ContextService* GetInstance();
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
};
|
||||
|
||||
class DragServerTest : public testing::Test {
|
||||
|
@ -29,10 +29,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 {
|
||||
@ -47,13 +45,10 @@ 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;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
private:
|
||||
static ContextService* GetInstance();
|
||||
DelegateTasks delegateTasks_;
|
||||
|
@ -16,8 +16,6 @@
|
||||
#ifndef INPUT_EVENT_INTERCEPTOR_TEST_H
|
||||
#define INPUT_EVENT_INTERCEPTOR_TEST_H
|
||||
|
||||
#define private public
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "cooperate_context.h"
|
||||
@ -31,10 +29,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 {
|
||||
@ -49,13 +45,10 @@ 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;
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
private:
|
||||
static ContextService* GetInstance();
|
||||
DelegateTasks delegateTasks_;
|
||||
|
@ -100,7 +100,6 @@ ContextService* ContextService::GetInstance()
|
||||
return g_instance;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& ContextService::GetSocketSessionManager()
|
||||
{
|
||||
return g_socketSessionMgr;
|
||||
@ -120,7 +119,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
{
|
||||
return *g_dsoftbus;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
MMI::PointerEvent::PointerItem CooperatePluginTest::CreatePointerItem(int32_t pointerId, int32_t deviceId,
|
||||
const std::pair<int32_t, int32_t> &displayLocation, bool isPressed)
|
||||
|
@ -82,7 +82,6 @@ ContextService* ContextService::GetInstance()
|
||||
return g_instance;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& ContextService::GetSocketSessionManager()
|
||||
{
|
||||
return g_socketSessionMgr;
|
||||
@ -102,7 +101,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
{
|
||||
return *g_dsoftbus;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
class CooperateObserver final : public ICooperateObserver {
|
||||
public:
|
||||
|
@ -111,7 +111,6 @@ ContextService* ContextService::GetInstance()
|
||||
return g_instance;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& ContextService::GetSocketSessionManager()
|
||||
{
|
||||
return g_socketSessionMgr;
|
||||
@ -131,7 +130,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
{
|
||||
return *g_dsoftbus;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
void DragServerTest::SetUpTestCase() {}
|
||||
|
||||
|
@ -68,7 +68,6 @@ ContextService* ContextService::GetInstance()
|
||||
return g_instance;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& ContextService::GetSocketSessionManager()
|
||||
{
|
||||
return socketSessionMgr_;
|
||||
@ -88,7 +87,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
{
|
||||
return *dsoftbus_;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
void InputEventBuilderTest::SetUpTestCase()
|
||||
{
|
||||
|
@ -67,7 +67,6 @@ ContextService* ContextService::GetInstance()
|
||||
return g_instance;
|
||||
}
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
ISocketSessionManager& ContextService::GetSocketSessionManager()
|
||||
{
|
||||
return socketSessionMgr_;
|
||||
@ -87,7 +86,6 @@ IDSoftbusAdapter& ContextService::GetDSoftbus()
|
||||
{
|
||||
return *dsoftbus_;
|
||||
}
|
||||
#endif // OHOS_BUILD_ENABLE_INTENTION_FRAMEWORK
|
||||
|
||||
void InputEventInterceptorTest::SetUpTestCase()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user