• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2025 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 #ifdef OHOS_BUILD_INTERNAL_DROP_ANIMATION
28 #include "drag_data_util.h"
29 #endif // OHOS_BUILD_INTERNAL_DROP_ANIMATION
30 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
31 #include "stream_session.h"
32 #else
33 #include "virtual_rs_window.h"
34 #endif // OHOS_BUILD_ENABLE_ARKUI_X
35 
36 namespace OHOS {
37 namespace Msdp {
38 namespace DeviceStatus {
39 class IDragManager {
40 public:
41     IDragManager() = default;
42     virtual ~IDragManager() = default;
43 
44 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
45     virtual void Dump(int32_t fd) const = 0;
46     virtual int32_t AddListener(int32_t pid) = 0;
47     virtual int32_t RemoveListener(int32_t pid) = 0;
48     virtual int32_t AddSubscriptListener(int32_t pid) = 0;
49     virtual int32_t RemoveSubscriptListener(int32_t pid) = 0;
50     virtual int32_t StartDrag(
51         const DragData &dragData, int32_t pid, const std::string &peerNetId = "", bool isLongPressDrag = false,
52         const std::string &appCaller = "") = 0;
53 #else
54     virtual int32_t StartDrag(const DragData &dragData) = 0;
55 #endif // OHOS_BUILD_ENABLE_ARKUI_X
56     virtual int32_t StopDrag(const DragDropResult &dropResult, const std::string &packageName = "",
57         int32_t pid = -1, bool isStopCooperate = false,  const DragRadarPackageName &inPackageName = {}) = 0;
58     virtual int32_t GetDragData(DragData &dragData) = 0;
59     virtual int32_t GetDragTargetPid() const = 0;
60     virtual int32_t GetUdKey(std::string &udKey) const = 0;
61     virtual int32_t OnGetShadowOffset(ShadowOffset &shadowOffset) = 0;
62     virtual DragState GetDragState() const = 0;
63     virtual int32_t GetDragState(DragState &dragState) = 0;
64     virtual DragCursorStyle GetDragStyle() const = 0;
65     virtual int32_t GetExtraInfo(std::string &extraInfo) const = 0;
66     virtual void SetDragState(DragState state) = 0;
67     virtual void SetDragOriginDpi(float dragOriginDpi) = 0;
68     virtual DragResult GetDragResult() const = 0;
69     virtual std::string GetAppCallee() const = 0;
70     virtual int32_t GetDragSummary(std::map<std::string, int64_t> &summarys) = 0;
71     virtual int32_t GetDragSummaryInfo(DragSummaryInfo &dragSummaryInfo) = 0;
72     virtual int32_t GetDragAction(DragAction &dragAction) const = 0;
73     virtual int32_t OnSetDragWindowVisible(
74         bool visible, bool isForce = false, bool isZoomInAndAlphaChanged = false,
75         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr) = 0;
76     virtual OHOS::MMI::ExtraData GetExtraData(bool appended) const = 0;
77     virtual bool GetControlCollaborationVisible() const = 0;
78     virtual void SetControlCollaborationVisible(bool visible) = 0;
79     virtual int32_t GetDragBundleInfo(DragBundleInfo &dragBundleInfo) const = 0;
80     virtual bool IsDragStart() const = 0;
81 #ifdef OHOS_BUILD_INTERNAL_DROP_ANIMATION
82     virtual int32_t EnableInternalDropAnimation(const std::string &animationInfo) = 0;
83     virtual void GetDragDrawingInfo(DragInternalInfo &dragInternalInfo) = 0;
84     virtual void ResetDragState() = 0;
85     virtual void ResetAnimationParameter() = 0;
86 #endif // OHOS_BUILD_INTERNAL_DROP_ANIMATION
87 
88 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
89     virtual void RegisterStateChange(std::function<void(DragState)> callback) = 0;
90     virtual void UnregisterStateChange() = 0;
91     virtual void RegisterNotifyPullUp(std::function<void(bool)> callback) = 0;
92     virtual void UnregisterNotifyPullUp() = 0;
93     virtual void RegisterCrossDrag(std::function<void(bool)> callback) = 0;
94     virtual void UnregisterCrossDrag() = 0;
95     virtual void NotifyCrossDrag(bool isButtonDown) = 0;
96     virtual bool IsCrossDragging() = 0;
97 #endif // OHOS_BUILD_ENABLE_ARKUI_X
98     virtual void SetPointerEventFilterTime(int64_t filterTime) = 0;
99     virtual void MoveTo(int32_t x, int32_t y, bool isMultiSelectedAnimation = true) = 0;
100     virtual void SetMultiSelectedAnimationFlag(bool needMultiSelectedAnimation) = 0;
101 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
102     virtual void UpdateDragStylePositon() = 0;
103     virtual int32_t UpdateDragStyle(
104         DragCursorStyle style, int32_t targetPid, int32_t targetTid, int32_t eventId = -1) = 0;
105 #else
106     virtual int32_t UpdateDragStyle(DragCursorStyle style) = 0;
107     virtual void SetDragWindow(std::shared_ptr<OHOS::Rosen::Window> window) = 0;
108     virtual void AddDragDestroy(std::function<void()> cb) = 0;
109     virtual void SetSVGFilePath(const std::string &filePath) = 0;
110 #endif // OHOS_BUILD_ENABLE_ARKUI_X
111     virtual int32_t UpdateShadowPic(const ShadowInfo &shadowInfo) = 0;
112     virtual int32_t UpdatePreviewStyle(const PreviewStyle &previewStyle) = 0;
113     virtual int32_t UpdatePreviewStyleWithAnimation(const PreviewStyle &previewStyle,
114         const PreviewAnimation &animation) = 0;
115     virtual int32_t RotateDragWindowSync(const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr) = 0;
116     virtual void GetAllowDragState(bool &isAllowDrag) = 0;
117     virtual int32_t RotateDragWindow(Rosen::DisplayId displayId, Rosen::Rotation rotation) = 0;
118     virtual void SetRotation(Rosen::DisplayId displayId, Rosen::Rotation rotation) = 0;
119     virtual Rosen::Rotation GetRotation(Rosen::DisplayId displayId) = 0;
120     virtual void RemoveDisplayIdFromMap(Rosen::DisplayId displayId) = 0;
121     virtual int32_t ScreenRotate(Rosen::Rotation rotation, Rosen::Rotation lastRotation) = 0;
122     virtual int32_t EnterTextEditorArea(bool enable) = 0;
123     virtual int32_t AddPrivilege(int32_t tokenId) = 0;
124     virtual int32_t EraseMouseIcon() = 0;
125     virtual void SetDragWindowScreenId(uint64_t displayId, uint64_t screenId) = 0;
126 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
127     virtual int32_t AddSelectedPixelMap(std::shared_ptr<OHOS::Media::PixelMap> pixelMap) = 0;
128     virtual void SimulatePullCancelEvent() = 0;
129 #endif // OHOS_BUILD_ENABLE_ARKUI_X
130 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
131     virtual int32_t SetMouseDragMonitorState(bool state) = 0;
132 #endif // OHOS_BUILD_ENABLE_ARKUI_X
133 #ifdef OHOS_ENABLE_PULLTHROW
134 #ifndef OHOS_BUILD_ENABLE_ARKUI_X
135     virtual bool RegisterPullThrowListener() = 0;
136     virtual bool RegisterVKListener() = 0;
137 #endif // OHOS_BUILD_ENABLE_ARKUI_X
138 #endif // OHOS_ENABLE_PULLTHROW
139 };
140 } // namespace DeviceStatus
141 } // namespace Msdp
142 } // namespace OHOS
143 #endif // I_DRAG_MANAGER_H