• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef I_DRAG_MANAGER_H
17 #define I_DRAG_MANAGER_H
18 
19 #include <cstdint>
20 #include <functional>
21 
22 #include <display_manager.h>
23 #include <input_manager.h>
24 #include "transaction/rs_transaction.h"
25 
26 #include "drag_data.h"
27 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
28 #include "stream_session.h"
29 #else
30 #include "virtual_rs_window.h"
31 #endif // OHOS_BUILD_ENABLE_ARKUI_X
32 
33 namespace OHOS {
34 namespace Msdp {
35 namespace DeviceStatus {
36 class IDragManager {
37 public:
38     IDragManager() = default;
39     virtual ~IDragManager() = default;
40 
41 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
42     virtual void Dump(int32_t fd) const = 0;
43     virtual int32_t AddListener(int32_t pid) = 0;
44     virtual int32_t RemoveListener(int32_t pid) = 0;
45     virtual int32_t AddSubscriptListener(int32_t pid) = 0;
46     virtual int32_t RemoveSubscriptListener(int32_t pid) = 0;
47     virtual int32_t StartDrag(
48         const DragData &dragData, int32_t pid, const std::string &peerNetId = "", bool isLongPressDrag = false,
49         const std::string &appCaller = "") = 0;
50 #else
51     virtual int32_t StartDrag(const DragData &dragData) = 0;
52 #endif // OHOS_BUILD_ENABLE_ARKUI_X
53     virtual int32_t StopDrag(const DragDropResult &dropResult, const std::string &packageName = "",
54         int32_t pid = -1, bool isStopCooperate = false,  const std::string &appCallee = "") = 0;
55     virtual int32_t GetDragData(DragData &dragData) = 0;
56     virtual int32_t GetDragTargetPid() const = 0;
57     virtual int32_t GetUdKey(std::string &udKey) const = 0;
58     virtual int32_t OnGetShadowOffset(ShadowOffset &shadowOffset) = 0;
59     virtual DragState GetDragState() const = 0;
60     virtual int32_t GetDragState(DragState &dragState) = 0;
61     virtual DragCursorStyle GetDragStyle() const = 0;
62     virtual int32_t GetExtraInfo(std::string &extraInfo) const = 0;
63     virtual void SetDragState(DragState state) = 0;
64     virtual void SetDragOriginDpi(float dragOriginDpi) = 0;
65     virtual DragResult GetDragResult() const = 0;
66     virtual std::string GetAppCallee() const = 0;
67     virtual int32_t GetDragSummary(std::map<std::string, int64_t> &summarys) = 0;
68     virtual int32_t GetDragAction(DragAction &dragAction) const = 0;
69     virtual int32_t OnSetDragWindowVisible(
70         bool visible, bool isForce = false, bool isZoomInAndAlphaChanged = false) = 0;
71     virtual OHOS::MMI::ExtraData GetExtraData(bool appended) const = 0;
72     virtual bool GetControlCollaborationVisible() const = 0;
73     virtual void SetControlCollaborationVisible(bool visible) = 0;
74 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
75     virtual void RegisterStateChange(std::function<void(DragState)> callback) = 0;
76     virtual void UnregisterStateChange() = 0;
77     virtual void RegisterNotifyPullUp(std::function<void(bool)> callback) = 0;
78     virtual void UnregisterNotifyPullUp() = 0;
79     virtual void RegisterCrossDrag(std::function<void(bool)> callback) = 0;
80     virtual void UnregisterCrossDrag() = 0;
81     virtual void NotifyCrossDrag(bool isButtonDown) = 0;
82     virtual bool IsCrossDragging() = 0;
83 #endif // OHOS_BUILD_ENABLE_ARKUI_X
84     virtual void SetPointerEventFilterTime(int64_t filterTime) = 0;
85     virtual void MoveTo(int32_t x, int32_t y, bool isMultiSelectedAnimation = true) = 0;
86     virtual void SetMultiSelectedAnimationFlag(bool needMultiSelectedAnimation) = 0;
87 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
88     virtual int32_t UpdateDragStyle(
89         DragCursorStyle style, int32_t targetPid, int32_t targetTid, int32_t eventId = -1) = 0;
90 #else
91     virtual int32_t UpdateDragStyle(DragCursorStyle style) = 0;
92     virtual void SetDragWindow(std::shared_ptr<OHOS::Rosen::Window> window) = 0;
93     virtual void AddDragDestroy(std::function<void()> cb) = 0;
94     virtual void SetSVGFilePath(const std::string &filePath) = 0;
95 #endif // OHOS_BUILD_ENABLE_ARKUI_X
96     virtual int32_t UpdateShadowPic(const ShadowInfo &shadowInfo) = 0;
97     virtual int32_t UpdatePreviewStyle(const PreviewStyle &previewStyle) = 0;
98     virtual int32_t UpdatePreviewStyleWithAnimation(const PreviewStyle &previewStyle,
99         const PreviewAnimation &animation) = 0;
100     virtual int32_t RotateDragWindowSync(const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr) = 0;
101     virtual void GetAllowDragState(bool &isAllowDrag) = 0;
102     virtual int32_t RotateDragWindow(Rosen::Rotation rotation) = 0;
103     virtual int32_t ScreenRotate(Rosen::Rotation rotation, Rosen::Rotation lastRotation) = 0;
104     virtual int32_t EnterTextEditorArea(bool enable) = 0;
105     virtual int32_t AddPrivilege(int32_t tokenId) = 0;
106     virtual int32_t EraseMouseIcon() = 0;
107     virtual void SetDragWindowScreenId(uint64_t displayId, uint64_t screenId) = 0;
108 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
109     virtual int32_t AddSelectedPixelMap(std::shared_ptr<OHOS::Media::PixelMap> pixelMap) = 0;
110 #endif // OHOS_BUILD_ENABLE_ARKUI_X
111 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
112     virtual int32_t SetMouseDragMonitorState(bool state) = 0;
113 #endif // OHOS_BUILD_ENABLE_ARKUI_X
114 };
115 } // namespace DeviceStatus
116 } // namespace Msdp
117 } // namespace OHOS
118 #endif // I_DRAG_MANAGER_H