1f857971dSopenharmony_ci/* 2f857971dSopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3f857971dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4f857971dSopenharmony_ci * you may not use this file except in compliance with the License. 5f857971dSopenharmony_ci * You may obtain a copy of the License at 6f857971dSopenharmony_ci * 7f857971dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8f857971dSopenharmony_ci * 9f857971dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10f857971dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11f857971dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12f857971dSopenharmony_ci * See the License for the specific language governing permissions and 13f857971dSopenharmony_ci * limitations under the License. 14f857971dSopenharmony_ci */ 15f857971dSopenharmony_ci 16f857971dSopenharmony_ci#ifndef INTERACTION_MANAGER_H 17f857971dSopenharmony_ci#define INTERACTION_MANAGER_H 18f857971dSopenharmony_ci 19f857971dSopenharmony_ci#include <functional> 20f857971dSopenharmony_ci#include <memory> 21f857971dSopenharmony_ci 22f857971dSopenharmony_ci#include "nocopyable.h" 23f857971dSopenharmony_ci 24f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 25f857971dSopenharmony_ci#include "coordination_message.h" 26f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 27f857971dSopenharmony_ci#include "drag_data.h" 28f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 29f857971dSopenharmony_ci#include "i_coordination_listener.h" 30f857971dSopenharmony_ci#include "i_drag_listener.h" 31f857971dSopenharmony_ci#include "i_event_listener.h" 32f857971dSopenharmony_ci#include "i_hotarea_listener.h" 33f857971dSopenharmony_ci#include "i_start_drag_listener.h" 34f857971dSopenharmony_ci#include "i_subscript_listener.h" 35f857971dSopenharmony_ci#include "transaction/rs_transaction.h" 36f857971dSopenharmony_ci#else 37f857971dSopenharmony_ci#include "pointer_event.h" 38f857971dSopenharmony_ci#include "virtual_rs_window.h" 39f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 40f857971dSopenharmony_ci 41f857971dSopenharmony_cinamespace OHOS { 42f857971dSopenharmony_cinamespace Msdp { 43f857971dSopenharmony_cinamespace DeviceStatus { 44f857971dSopenharmony_ciclass InteractionManager { 45f857971dSopenharmony_cipublic: 46f857971dSopenharmony_ci 47f857971dSopenharmony_ci static InteractionManager *GetInstance(); 48f857971dSopenharmony_ci virtual ~InteractionManager() = default; 49f857971dSopenharmony_ci 50f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 51f857971dSopenharmony_ci /** 52f857971dSopenharmony_ci * @brief Registers a listener for screen hopping events of the mouse pointer. 53f857971dSopenharmony_ci * @param listener Indicates the listener for screen hopping events of the mouse pointer. 54f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 55f857971dSopenharmony_ci * @since 9 56f857971dSopenharmony_ci */ 57f857971dSopenharmony_ci int32_t RegisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener, 58f857971dSopenharmony_ci bool isCompatible = false); 59f857971dSopenharmony_ci 60f857971dSopenharmony_ci /** 61f857971dSopenharmony_ci * @brief Unregisters a listener for screen hopping events of the mouse pointer. 62f857971dSopenharmony_ci * @param listener Indicates the listener for screen hopping events of the mouse pointer. 63f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 64f857971dSopenharmony_ci * @since 9 65f857971dSopenharmony_ci */ 66f857971dSopenharmony_ci int32_t UnregisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener, 67f857971dSopenharmony_ci bool isCompatible = false); 68f857971dSopenharmony_ci 69f857971dSopenharmony_ci /** 70f857971dSopenharmony_ci * @brief Prepares for screen hopping. 71f857971dSopenharmony_ci * @param callback Indicates the callback used to receive the result of enabling or disabling screen hopping. 72f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 73f857971dSopenharmony_ci * @since 9 74f857971dSopenharmony_ci */ 75f857971dSopenharmony_ci int32_t PrepareCoordination(std::function<void(const std::string&, const CoordinationMsgInfo&)> callback, 76f857971dSopenharmony_ci bool isCompatible = false); 77f857971dSopenharmony_ci 78f857971dSopenharmony_ci /** 79f857971dSopenharmony_ci * @brief Cancels the preparation for screen hopping. 80f857971dSopenharmony_ci * @param callback Indicates the callback used to receive the result of enabling or disabling screen hopping. 81f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 82f857971dSopenharmony_ci * @since 9 83f857971dSopenharmony_ci */ 84f857971dSopenharmony_ci int32_t UnprepareCoordination(std::function<void(const std::string&, const CoordinationMsgInfo&)> callback, 85f857971dSopenharmony_ci bool isCompatible = false); 86f857971dSopenharmony_ci 87f857971dSopenharmony_ci /** 88f857971dSopenharmony_ci * @brief Starts screen hopping for the mouse pointer. 89f857971dSopenharmony_ci * @param s remoteNetworkId Indicates the descriptor of the target input device (network ID) for screen hopping. 90f857971dSopenharmony_ci * @param startDeviceId Indicates the ID of the source input device (device ID handle) for screen hopping. 91f857971dSopenharmony_ci * @param callback Indicates the callback used to receive the result of starting screen hopping. 92f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 93f857971dSopenharmony_ci * @since 9 94f857971dSopenharmony_ci */ 95f857971dSopenharmony_ci int32_t ActivateCoordination(const std::string &remoteNetworkId, int32_t startDeviceId, 96f857971dSopenharmony_ci std::function<void(const std::string&, const CoordinationMsgInfo&)> callback, bool isCompatible = false); 97f857971dSopenharmony_ci 98f857971dSopenharmony_ci /** 99f857971dSopenharmony_ci * @brief Stops screen hopping for the mouse pointer. 100f857971dSopenharmony_ci * @param isUnchained Specifies Whether to disable the cross-device link. 101f857971dSopenharmony_ci * The value <b>true</b> means to disable the cross-device link, and <b>false</b> means the opposite. 102f857971dSopenharmony_ci * @param callback Indicates the callback used to receive the result of stopping screen hopping. 103f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 104f857971dSopenharmony_ci * @since 9 105f857971dSopenharmony_ci */ 106f857971dSopenharmony_ci int32_t DeactivateCoordination(bool isUnchained, 107f857971dSopenharmony_ci std::function<void(const std::string&, const CoordinationMsgInfo&)> callback, bool isCompatible = false); 108f857971dSopenharmony_ci 109f857971dSopenharmony_ci /** 110f857971dSopenharmony_ci * @brief Obtains the screen hopping status of a mouse pointer. 111f857971dSopenharmony_ci * @param networkId Indicates the descriptor of the input device. 112f857971dSopenharmony_ci * @param callback Indicates the callback used to receive the screen hopping status. 113f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 114f857971dSopenharmony_ci * @since 9 115f857971dSopenharmony_ci */ 116f857971dSopenharmony_ci int32_t GetCoordinationState(const std::string &networkId, std::function<void(bool)> callback, 117f857971dSopenharmony_ci bool isCompatible = false); 118f857971dSopenharmony_ci 119f857971dSopenharmony_ci /** 120f857971dSopenharmony_ci * @brief Obtains the screen hopping status of a mouse pointer. 121f857971dSopenharmony_ci * @param udId Indicates the descriptor of the input device. 122f857971dSopenharmony_ci * @param state Indicates the state of crossing switch. 123f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 124f857971dSopenharmony_ci * @since 12 125f857971dSopenharmony_ci */ 126f857971dSopenharmony_ci int32_t GetCoordinationState(const std::string &udId, bool &state); 127f857971dSopenharmony_ci 128f857971dSopenharmony_ci /** 129f857971dSopenharmony_ci * @brief Registers a listener for mouse pointer position information on the specified device. 130f857971dSopenharmony_ci * @param networkId Indicates the descriptor of the input device. 131f857971dSopenharmony_ci * @param listener Indicates the listener for mouse pointer position information on the specified device. 132f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 133f857971dSopenharmony_ci * @since 9 134f857971dSopenharmony_ci */ 135f857971dSopenharmony_ci int32_t RegisterEventListener(const std::string &networkId, std::shared_ptr<IEventListener> listener); 136f857971dSopenharmony_ci 137f857971dSopenharmony_ci /** 138f857971dSopenharmony_ci * @brief Unregisters a listener for mouse pointer position information on the specified device. 139f857971dSopenharmony_ci * @param networkId Indicates the descriptor of the input device. 140f857971dSopenharmony_ci * @param listener Indicates the listener mouse pointer position information on the specified device. 141f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 142f857971dSopenharmony_ci * @since 9 143f857971dSopenharmony_ci */ 144f857971dSopenharmony_ci int32_t UnregisterEventListener(const std::string &networkId, std::shared_ptr<IEventListener> listener = nullptr); 145f857971dSopenharmony_ci 146f857971dSopenharmony_ci int32_t SetDamplingCoefficient(uint32_t direction, double coefficient); 147f857971dSopenharmony_ci 148f857971dSopenharmony_ci /** 149f857971dSopenharmony_ci * @brief Starts dragging. 150f857971dSopenharmony_ci * @param dragData Indicates additional data used for dragging. 151f857971dSopenharmony_ci * @param listener Indicates the listener used to notify dragging result etc. 152f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 153f857971dSopenharmony_ci * @since 10 154f857971dSopenharmony_ci */ 155f857971dSopenharmony_ci int32_t StartDrag(const DragData &dragData, std::shared_ptr<IStartDragListener> listener); 156f857971dSopenharmony_ci#else 157f857971dSopenharmony_ci /** 158f857971dSopenharmony_ci * @brief Starts dragging. 159f857971dSopenharmony_ci * @param dragData Indicates additional data used for dragging. 160f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 161f857971dSopenharmony_ci * @since 12 162f857971dSopenharmony_ci */ 163f857971dSopenharmony_ci int32_t StartDrag(const DragData &dragData); 164f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 165f857971dSopenharmony_ci /** 166f857971dSopenharmony_ci * @brief Stops dragging. 167f857971dSopenharmony_ci * @param result Indicates the dragging result. The value <b>0</b> means that the dragging operation is successful; 168f857971dSopenharmony_ci * <b>1</b> means that the dragging operation is failed; <b>2</b> means that the dragging operation is canceled. 169f857971dSopenharmony_ci * @param hasCustomAnimation Specifies whether a custom animation is played when the dragging is successful. 170f857971dSopenharmony_ci * The value <b>true</b> means that a custom animation is played, 171f857971dSopenharmony_ci * and <b>false</b> means that the default animation is played. 172f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 173f857971dSopenharmony_ci * @since 10 174f857971dSopenharmony_ci */ 175f857971dSopenharmony_ci int32_t StopDrag(const DragDropResult &dropResult); 176f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 177f857971dSopenharmony_ci /** 178f857971dSopenharmony_ci * @brief Updates the mouse pointer style used for dragging. 179f857971dSopenharmony_ci * @param style Indicates the new mouse pointer style. 180f857971dSopenharmony_ci * @param eventId Indicates the descriptor of the event. 181f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 182f857971dSopenharmony_ci * @since 10 183f857971dSopenharmony_ci */ 184f857971dSopenharmony_ci int32_t UpdateDragStyle(DragCursorStyle style, int32_t eventId = -1); 185f857971dSopenharmony_ci#else 186f857971dSopenharmony_ci /** 187f857971dSopenharmony_ci * @brief Updates the mouse pointer style used for dragging. 188f857971dSopenharmony_ci * @param style Indicates the new mouse pointer style. 189f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 190f857971dSopenharmony_ci * @since 10 191f857971dSopenharmony_ci */ 192f857971dSopenharmony_ci int32_t UpdateDragStyle(DragCursorStyle style); 193f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 194f857971dSopenharmony_ci /** 195f857971dSopenharmony_ci * @brief Obtains the PID of the target window. 196f857971dSopenharmony_ci * @return Returns a value greater than or equal to 0 in normal cases; returns <b>-1</b> if the PID is invalid. 197f857971dSopenharmony_ci * @since 10 198f857971dSopenharmony_ci */ 199f857971dSopenharmony_ci int32_t GetDragTargetPid(); 200f857971dSopenharmony_ci 201f857971dSopenharmony_ci /** 202f857971dSopenharmony_ci * @brief Obtains the unified data key of the target window. 203f857971dSopenharmony_ci * @param UdKey Indicates the unified data key of the target window. 204f857971dSopenharmony_ci * @return Returns a value greater than or equal to 0 in normal cases; returns <b>-1</b> if the PID is invalid. 205f857971dSopenharmony_ci * @since 10 206f857971dSopenharmony_ci */ 207f857971dSopenharmony_ci int32_t GetUdKey(std::string &udKey); 208f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 209f857971dSopenharmony_ci /** 210f857971dSopenharmony_ci * @brief Registers a listener for dragging status changes. 211f857971dSopenharmony_ci * @param listener Indicates the listener for dragging status changes. 212f857971dSopenharmony_ci * @param isJsCaller Indicates whether to add checking. 213f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 214f857971dSopenharmony_ci * @since 10 215f857971dSopenharmony_ci */ 216f857971dSopenharmony_ci int32_t AddDraglistener(std::shared_ptr<IDragListener> listener, bool isJsCaller = false); 217f857971dSopenharmony_ci 218f857971dSopenharmony_ci /** 219f857971dSopenharmony_ci * @brief Unregisters a listener for dragging status changes. 220f857971dSopenharmony_ci * @param listener Indicates the listener for dragging status changes. 221f857971dSopenharmony_ci * If no value is passed, all listeners are canceled. 222f857971dSopenharmony_ci * @param isJsCaller Indicates whether to add checking. 223f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 224f857971dSopenharmony_ci * @since 10 225f857971dSopenharmony_ci */ 226f857971dSopenharmony_ci int32_t RemoveDraglistener(std::shared_ptr<IDragListener> listener = nullptr, bool isJsCaller = false); 227f857971dSopenharmony_ci 228f857971dSopenharmony_ci /** 229f857971dSopenharmony_ci * @brief Register a listener for dragging corner style changes. 230f857971dSopenharmony_ci * @param listener Indicates the listener for dragging corner style changes. 231f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 232f857971dSopenharmony_ci * @since 10 233f857971dSopenharmony_ci */ 234f857971dSopenharmony_ci int32_t AddSubscriptListener(std::shared_ptr<ISubscriptListener> listener); 235f857971dSopenharmony_ci 236f857971dSopenharmony_ci /** 237f857971dSopenharmony_ci * @brief Unregisters a listener for dragging corner style changes. 238f857971dSopenharmony_ci * @param listener Indicates the listener for dragging corner style changes. 239f857971dSopenharmony_ci * If no value is passed, all listeners are canceled. 240f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 241f857971dSopenharmony_ci * @since 10 242f857971dSopenharmony_ci */ 243f857971dSopenharmony_ci int32_t RemoveSubscriptListener(std::shared_ptr<ISubscriptListener> listener); 244f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 245f857971dSopenharmony_ci 246f857971dSopenharmony_ci /** 247f857971dSopenharmony_ci * @brief Displays or hides the dragging window. 248f857971dSopenharmony_ci * @param visible Specifies whether to display the dragging window. 249f857971dSopenharmony_ci * The value <b>true</b> means to display the dragging window, and <b>false</b> means to hide the window. 250f857971dSopenharmony_ci * @param isForce Specifies Enforce the visibility of the drag window, which is applied to this drag. 251f857971dSopenharmony_ci * For example, if you set the drag window to Hidden and isForce to true during a drag, the setting does not 252f857971dSopenharmony_ci * take effect when the drag window is displayed and isForce is false, and the setting becomes invalid at the 253f857971dSopenharmony_ci * end of the current drag. 254f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 255f857971dSopenharmony_ci * @since 10 256f857971dSopenharmony_ci */ 257f857971dSopenharmony_ci int32_t SetDragWindowVisible(bool visible, bool isForce = false); 258f857971dSopenharmony_ci 259f857971dSopenharmony_ci /** 260f857971dSopenharmony_ci * @brief Obtains the position of the touch point or mouse pointer relative to 261f857971dSopenharmony_ci * the upper left corner of the shadow thumbnail. 262f857971dSopenharmony_ci * @param offsetX Indicates the x coordinate. 263f857971dSopenharmony_ci * @param offsetY Indicates the y coordinate. 264f857971dSopenharmony_ci * @param width Indicates the width of the shadow thumbnail. 265f857971dSopenharmony_ci * @param height Indicates the height of the shadow thumbnail. 266f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 267f857971dSopenharmony_ci * @since 10 268f857971dSopenharmony_ci */ 269f857971dSopenharmony_ci int32_t GetShadowOffset(int32_t &offsetX, int32_t &offsetY, int32_t &width, int32_t &height); 270f857971dSopenharmony_ci 271f857971dSopenharmony_ci /** 272f857971dSopenharmony_ci * @brief Updates the shadow thumbnail information used for dragging. 273f857971dSopenharmony_ci * @param shadowInfo Indicates the new shadow thumbnail information. 274f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns other values if the operation fails. 275f857971dSopenharmony_ci * @since 10 276f857971dSopenharmony_ci */ 277f857971dSopenharmony_ci int32_t UpdateShadowPic(const ShadowInfo &shadowInfo); 278f857971dSopenharmony_ci 279f857971dSopenharmony_ci /** 280f857971dSopenharmony_ci * @brief Obtains the dragging data. 281f857971dSopenharmony_ci * @param dragData Indicates the dragging data. 282f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns other values if the operation fails. 283f857971dSopenharmony_ci * @since 10 284f857971dSopenharmony_ci */ 285f857971dSopenharmony_ci int32_t GetDragData(DragData &dragData); 286f857971dSopenharmony_ci 287f857971dSopenharmony_ci /** 288f857971dSopenharmony_ci * @brief Obtains the current droping type. 289f857971dSopenharmony_ci * @param dragAction dropping type while user pressed ctrl or not. 290f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns other values if the operation fails. 291f857971dSopenharmony_ci * @since 10 292f857971dSopenharmony_ci */ 293f857971dSopenharmony_ci int32_t GetDragAction(DragAction &dragAction); 294f857971dSopenharmony_ci 295f857971dSopenharmony_ci /** 296f857971dSopenharmony_ci * @brief Obtains the 'extraInfo' field in the drag data. 297f857971dSopenharmony_ci * @param extraInfo Indicates the 'extraInfo' field in the drag data, mainly to save whether to allow drag across 298f857971dSopenharmony_ci * the device "drag_allow_distributed" field. 299f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns other values if the operation fails. 300f857971dSopenharmony_ci * @since 10 301f857971dSopenharmony_ci */ 302f857971dSopenharmony_ci int32_t GetExtraInfo(std::string &extraInfo); 303f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 304f857971dSopenharmony_ci /** 305f857971dSopenharmony_ci * @brief Registers a listener for screen hot area of the mouse pointer. 306f857971dSopenharmony_ci * @param listener Indicates the listener for screen hot area of the mouse pointer. 307f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 308f857971dSopenharmony_ci * @since 11 309f857971dSopenharmony_ci */ 310f857971dSopenharmony_ci int32_t AddHotAreaListener(std::shared_ptr<IHotAreaListener> listener); 311f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 312f857971dSopenharmony_ci /** 313f857971dSopenharmony_ci * @brief Obtains the dragging state. 314f857971dSopenharmony_ci * @param dragState Dragging state. 315f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns other values if the operation fails. 316f857971dSopenharmony_ci * @since 10 317f857971dSopenharmony_ci */ 318f857971dSopenharmony_ci int32_t GetDragState(DragState &dragState); 319f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 320f857971dSopenharmony_ci /** 321f857971dSopenharmony_ci * @brief Unregisters a listener for screen hot area of the mouse pointer. 322f857971dSopenharmony_ci * @param listener Indicates the listener for screen hot area of the mouse pointer. 323f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 324f857971dSopenharmony_ci * @since 9 325f857971dSopenharmony_ci */ 326f857971dSopenharmony_ci int32_t RemoveHotAreaListener(std::shared_ptr<IHotAreaListener> listener = nullptr); 327f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 328f857971dSopenharmony_ci 329f857971dSopenharmony_ci /** 330f857971dSopenharmony_ci * @brief Update preview style when dragging. 331f857971dSopenharmony_ci * @param previewStyle Indicates the preview style param for dragged item. 332f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 333f857971dSopenharmony_ci * @since 11 334f857971dSopenharmony_ci */ 335f857971dSopenharmony_ci int32_t UpdatePreviewStyle(const PreviewStyle &previewStyle); 336f857971dSopenharmony_ci 337f857971dSopenharmony_ci /** 338f857971dSopenharmony_ci * @brief Update preview style with animation when dragging. 339f857971dSopenharmony_ci * @param previewStyle Indicates the preview style param for dragged item. 340f857971dSopenharmony_ci * @param animation Indicates the animation param for dragged item. 341f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 342f857971dSopenharmony_ci * @since 11 343f857971dSopenharmony_ci */ 344f857971dSopenharmony_ci int32_t UpdatePreviewStyleWithAnimation(const PreviewStyle &previewStyle, const PreviewAnimation &animation); 345f857971dSopenharmony_ci 346f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 347f857971dSopenharmony_ci /** 348f857971dSopenharmony_ci * @brief Rotate drag window sync. 349f857971dSopenharmony_ci * @param rsTransaction Indicates utterances rotate the sync handle. 350f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 351f857971dSopenharmony_ci * @since 12 352f857971dSopenharmony_ci */ 353f857971dSopenharmony_ci int32_t RotateDragWindowSync(const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr); 354f857971dSopenharmony_ci 355f857971dSopenharmony_ci /** 356f857971dSopenharmony_ci * @brief Obtains data summary of the drag object. 357f857971dSopenharmony_ci * @param summarys Indicates data summary of the drag object. 358f857971dSopenharmony_ci * @param isJsCaller Indicates whether to add checking. 359f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns other values if the operation fails. 360f857971dSopenharmony_ci * @since 11 361f857971dSopenharmony_ci */ 362f857971dSopenharmony_ci int32_t GetDragSummary(std::map<std::string, int64_t> &summarys, bool isJsCaller = false); 363f857971dSopenharmony_ci#else 364f857971dSopenharmony_ci /** 365f857971dSopenharmony_ci * @brief Obtains data summary of the drag object. 366f857971dSopenharmony_ci * @param summarys Indicates data summary of the drag object. 367f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns other values if the operation fails. 368f857971dSopenharmony_ci * @since 12 369f857971dSopenharmony_ci */ 370f857971dSopenharmony_ci int32_t GetDragSummary(std::map<std::string, int64_t> &summarys); 371f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 372f857971dSopenharmony_ci 373f857971dSopenharmony_ci /** 374f857971dSopenharmony_ci * @brief Specifies whether to implement 8dp movement in the text editor area. 375f857971dSopenharmony_ci * @param enable Indicates whether to enable 8dp movement. 376f857971dSopenharmony_ci * The value <b>true</b> means to enable 8dp movement, and the value <b>false</b> means the opposite. 377f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 378f857971dSopenharmony_ci * @since 11 379f857971dSopenharmony_ci */ 380f857971dSopenharmony_ci int32_t EnterTextEditorArea(bool enable); 381f857971dSopenharmony_ci 382f857971dSopenharmony_ci#ifndef OHOS_BUILD_ENABLE_ARKUI_X 383f857971dSopenharmony_ci int32_t AddPrivilege(); 384f857971dSopenharmony_ci 385f857971dSopenharmony_ci int32_t EraseMouseIcon(); 386f857971dSopenharmony_ci 387f857971dSopenharmony_ci int32_t SetDragWindowScreenId(uint64_t displayId, uint64_t screenId); 388f857971dSopenharmony_ci 389f857971dSopenharmony_ci int32_t SetMouseDragMonitorState(bool state); 390f857971dSopenharmony_ci 391f857971dSopenharmony_ci /** 392f857971dSopenharmony_ci * @brief Add an image to the drag list. 393f857971dSopenharmony_ci * @param pixelMap Add Selected image information. 394f857971dSopenharmony_ci * @param callback Indicates the callback used to notify addSelectedPixelMap result. 395f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 396f857971dSopenharmony_ci * @since 12 397f857971dSopenharmony_ci */ 398f857971dSopenharmony_ci int32_t AddSelectedPixelMap(std::shared_ptr<OHOS::Media::PixelMap> pixelMap, std::function<void(bool)> callback); 399f857971dSopenharmony_ci#else 400f857971dSopenharmony_ci /** 401f857971dSopenharmony_ci * @brief convert relative pointerEvent action to PULL_MOVE or PULL_UP. 402f857971dSopenharmony_ci * @param pointerEvent the normal input event need to deal with. 403f857971dSopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise. 404f857971dSopenharmony_ci * @since 12 405f857971dSopenharmony_ci */ 406f857971dSopenharmony_ci int32_t UpdatePointerAction(std::shared_ptr<MMI::PointerEvent> pointerEvent); 407f857971dSopenharmony_ci 408f857971dSopenharmony_ci /** 409f857971dSopenharmony_ci * @brief set window. 410f857971dSopenharmony_ci * @param window drag drawing needs window. 411f857971dSopenharmony_ci * @return 412f857971dSopenharmony_ci * @since 12 413f857971dSopenharmony_ci */ 414f857971dSopenharmony_ci void SetDragWindow(std::shared_ptr<OHOS::Rosen::Window> window); 415f857971dSopenharmony_ci 416f857971dSopenharmony_ci /** 417f857971dSopenharmony_ci * @brief set callback to destroy window. 418f857971dSopenharmony_ci * @param cb callback function. 419f857971dSopenharmony_ci * @return 420f857971dSopenharmony_ci * @since 12 421f857971dSopenharmony_ci */ 422f857971dSopenharmony_ci void RegisterDragWindow(std::function<void()> cb); 423f857971dSopenharmony_ci 424f857971dSopenharmony_ci /** 425f857971dSopenharmony_ci * @brief set VSG file path. 426f857971dSopenharmony_ci * @param filePath save SVG file path. 427f857971dSopenharmony_ci * @return 428f857971dSopenharmony_ci * @since 12 429f857971dSopenharmony_ci */ 430f857971dSopenharmony_ci void SetSVGFilePath(const std::string &filePath); 431f857971dSopenharmony_ci#endif // OHOS_BUILD_ENABLE_ARKUI_X 432f857971dSopenharmony_ci 433f857971dSopenharmony_ciprivate: 434f857971dSopenharmony_ci InteractionManager() = default; 435f857971dSopenharmony_ci DISALLOW_COPY_AND_MOVE(InteractionManager); 436f857971dSopenharmony_ci static InteractionManager *instance_; 437f857971dSopenharmony_ci}; 438f857971dSopenharmony_ci} // namespace DeviceStatus 439f857971dSopenharmony_ci} // namespace Msdp 440f857971dSopenharmony_ci} // namespace OHOS 441f857971dSopenharmony_ci 442f857971dSopenharmony_ci#define INTERACTION_MGR OHOS::Msdp::DeviceStatus::InteractionManager::GetInstance() 443f857971dSopenharmony_ci 444f857971dSopenharmony_ci#endif // INTERACTION_MANAGER_H 445