/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef INTENTION_MANAGER_H #define INTENTION_MANAGER_H #include #include "singleton.h" #include "cooperate_client.h" #include "drag_client.h" #include "drag_data.h" #include "drag_manager_impl.h" #include "i_event_listener.h" #include "socket_client.h" #include "stationary_client.h" #include "tunnel_client.h" namespace OHOS { namespace Msdp { namespace DeviceStatus { class IntentionManager { DECLARE_SINGLETON(IntentionManager); using CooperateMsgInfoCallback = std::function; public: DISALLOW_MOVE(IntentionManager); int32_t SubscribeCallback(Type type, ActivityEvent event, ReportLatencyNs latency, sptr callback); int32_t UnsubscribeCallback(Type type, ActivityEvent event, sptr callback); Data GetDeviceStatusData(const Type type); int32_t RegisterCoordinationListener( std::shared_ptr listener, bool isCompatible = false); int32_t UnregisterCoordinationListener( std::shared_ptr listener, bool isCompatible = false); int32_t PrepareCoordination(CooperateMsgInfoCallback callback, bool isCompatible = false); int32_t UnprepareCoordination(CooperateMsgInfoCallback callback, bool isCompatible = false); int32_t ActivateCoordination(const std::string &remoteNetworkId, int32_t startDeviceId, CooperateMsgInfoCallback callback, bool isCompatible = false); int32_t DeactivateCoordination(bool isUnchained, CooperateMsgInfoCallback callback, bool isCompatible = false); int32_t GetCoordinationState(const std::string &networkId, std::function callback, bool isCompatible = false); int32_t GetCoordinationState(const std::string &udId, bool &state); int32_t RegisterEventListener(const std::string &networkId, std::shared_ptr listener); int32_t UnregisterEventListener(const std::string &networkId, std::shared_ptr listener = nullptr); int32_t UpdateDragStyle(DragCursorStyle style, int32_t eventId = -1); int32_t StartDrag(const DragData &dragData, std::shared_ptr listener); int32_t StopDrag(const DragDropResult &dropResult); int32_t GetDragTargetPid(); int32_t GetUdKey(std::string &udKey); int32_t AddDraglistener(DragListenerPtr listener, bool isJsCaller = false); int32_t RemoveDraglistener(DragListenerPtr listener, bool isJsCaller = false); int32_t AddSubscriptListener(SubscriptListenerPtr listener); int32_t RemoveSubscriptListener(SubscriptListenerPtr listener); int32_t SetDragWindowVisible(bool visible, bool isForce = false); int32_t GetShadowOffset(ShadowOffset &shadowOffset); int32_t UpdateShadowPic(const ShadowInfo &shadowInfo); int32_t GetDragData(DragData &dragData); int32_t GetDragState(DragState &dragState); int32_t AddHotAreaListener(std::shared_ptr listener); int32_t RemoveHotAreaListener(std::shared_ptr listener = nullptr); int32_t UpdatePreviewStyle(const PreviewStyle &previewStyle); int32_t UpdatePreviewStyleWithAnimation(const PreviewStyle &previewStyle, const PreviewAnimation &animation); int32_t RotateDragWindowSync(const std::shared_ptr& rsTransaction = nullptr); int32_t GetDragSummary(std::map &summarys, bool isJsCaller = false); int32_t EnterTextEditorArea(bool enable); int32_t GetDragAction(DragAction &dragAction); int32_t GetExtraInfo(std::string &extraInfo); int32_t AddPrivilege(); int32_t EraseMouseIcon(); int32_t SetDragWindowScreenId(uint64_t displayId, uint64_t screenId); int32_t SetMouseDragMonitorState(bool state); void OnConnected(); void OnDisconnected(); private: void InitClient(); void InitMsgHandler(); std::mutex mutex_; std::shared_ptr tunnel_ { nullptr }; std::unique_ptr client_ { nullptr }; CooperateClient cooperate_; DragClient drag_; StationaryClient stationary_; bool isScreenRotation_ { false }; std::vector foldRotatePolicys_ {}; }; #define INTER_MGR_IMPL OHOS::Singleton::GetInstance() } // namespace DeviceStatus } // namespace Msdp } // namespace OHOS #endif // INTENTION_MANAGER_H