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 #include "intention_manager.h"
17
18 #include "display_manager.h"
19
20 #include "devicestatus_define.h"
21 #include "drag_data.h"
22
23 #undef LOG_TAG
24 #define LOG_TAG "IntentionManager"
25
26 namespace OHOS {
27 namespace Msdp {
28 namespace DeviceStatus {
29 namespace {
30 constexpr int32_t INDEX_FOLDED { 0 };
31 constexpr int32_t INDEX_EXPAND { 1 };
32 constexpr size_t POLICY_VEC_SIZE { 2 };
33 const std::string SCREEN_ROTATION { "1" };
34 } // namespace
35
IntentionManager()36 IntentionManager::IntentionManager()
37 {
38 }
39
~IntentionManager()40 IntentionManager::~IntentionManager()
41 {
42 client_.reset();
43 }
44
InitClient()45 void IntentionManager::InitClient()
46 {
47 CALL_DEBUG_ENTER;
48 {
49 std::lock_guard<std::mutex> guard(mutex_);
50 if (client_ != nullptr) {
51 return;
52 }
53 client_ = std::make_unique<SocketClient>();
54 InitMsgHandler();
55 client_->RegisterConnectedFunction([this] {
56 this->OnConnected();
57 });
58 client_->RegisterDisconnectedFunction([this] {
59 this->OnDisconnected();
60 });
61 client_->Start();
62 }
63 GetRotatePolicy(isScreenRotation_, foldRotatePolicys_);
64 }
65
InitMsgHandler()66 void IntentionManager::InitMsgHandler()
67 {
68 CALL_DEBUG_ENTER;
69 std::map<MessageId, std::function<int32_t(const StreamClient&, NetPacket&)>> funs {
70 #ifdef OHOS_BUILD_ENABLE_COORDINATION
71 {MessageId::COORDINATION_ADD_LISTENER, [this](const StreamClient &client, NetPacket &pkt) {
72 return this->cooperate_.OnCoordinationListener(client, pkt);
73 }},
74 {MessageId::COORDINATION_MESSAGE, [this](const StreamClient &client, NetPacket &pkt) {
75 return this->cooperate_.OnCoordinationMessage(client, pkt);
76 }},
77 {MessageId::COORDINATION_GET_STATE, [this](const StreamClient &client, NetPacket &pkt) {
78 return this->cooperate_.OnCoordinationState(client, pkt);
79 }},
80 {MessageId::HOT_AREA_ADD_LISTENER, [this](const StreamClient &client, NetPacket &pkt) {
81 return this->cooperate_.OnHotAreaListener(client, pkt);
82 }},
83 {MessageId::MOUSE_LOCATION_ADD_LISTENER, [this](const StreamClient &client, NetPacket &pkt) {
84 return this->cooperate_.OnMouseLocationListener(client, pkt);
85 }},
86 #endif // OHOS_BUILD_ENABLE_COORDINATION
87
88 {MessageId::DRAG_NOTIFY_RESULT, [this](const StreamClient &client, NetPacket &pkt) {
89 return this->drag_.OnNotifyResult(client, pkt);
90 }},
91 {MessageId::DRAG_STATE_LISTENER, [this](const StreamClient &client, NetPacket &pkt) {
92 return this->drag_.OnStateChangedMessage(client, pkt);
93 }},
94 {MessageId::DRAG_NOTIFY_HIDE_ICON, [this](const StreamClient &client, NetPacket &pkt) {
95 return this->drag_.OnNotifyHideIcon(client, pkt);
96 }},
97 {MessageId::DRAG_STYLE_LISTENER, [this](const StreamClient &client, NetPacket &pkt) {
98 return this->drag_.OnDragStyleChangedMessage(client, pkt);
99 }}
100 };
101 CHKPV(client_);
102 for (auto &[id, cb] : funs) {
103 if (!client_->RegisterEvent(id, cb)) {
104 FI_HILOGI("RegistER event handler msg:%{public}d already exists", id);
105 }
106 }
107 }
108
SubscribeCallback(Type type,ActivityEvent event,ReportLatencyNs latency,sptr<IRemoteDevStaCallback> callback)109 int32_t IntentionManager::SubscribeCallback(Type type, ActivityEvent event, ReportLatencyNs latency,
110 sptr<IRemoteDevStaCallback> callback)
111 {
112 InitClient();
113 return stationary_.SubscribeCallback(type, event, latency, callback);
114 }
115
UnsubscribeCallback(Type type,ActivityEvent event,sptr<IRemoteDevStaCallback> callback)116 int32_t IntentionManager::UnsubscribeCallback(Type type, ActivityEvent event, sptr<IRemoteDevStaCallback> callback)
117 {
118 InitClient();
119 return stationary_.UnsubscribeCallback(type, event, callback);
120 }
121
GetDevicePostureDataSync(DevicePostureData & data)122 int32_t IntentionManager::GetDevicePostureDataSync(DevicePostureData &data)
123 {
124 return stationary_.GetDevicePostureDataSync(data);
125 }
126
SubscribeCallback(BoomerangType type,std::string bundleName,sptr<IRemoteBoomerangCallback> callback)127 int32_t IntentionManager::SubscribeCallback(BoomerangType type, std::string bundleName,
128 sptr<IRemoteBoomerangCallback> callback)
129 {
130 return boomerang_.SubscribeCallback(type, bundleName, callback);
131 }
132
UnsubscribeCallback(BoomerangType type,std::string bundleName,sptr<IRemoteBoomerangCallback> callback)133 int32_t IntentionManager::UnsubscribeCallback(BoomerangType type, std::string bundleName,
134 sptr<IRemoteBoomerangCallback> callback)
135 {
136 return boomerang_.UnsubscribeCallback(type, bundleName, callback);
137 }
138
NotifyMetadataBindingEvent(std::string bundleName,sptr<IRemoteBoomerangCallback> callback)139 int32_t IntentionManager::NotifyMetadataBindingEvent(std::string bundleName, sptr<IRemoteBoomerangCallback> callback)
140 {
141 return boomerang_.NotifyMetadataBindingEvent(bundleName, callback);
142 }
143
SubmitMetadata(std::string metadata)144 int32_t IntentionManager::SubmitMetadata(std::string metadata)
145 {
146 return boomerang_.SubmitMetadata(metadata);
147 }
148
BoomerangEncodeImage(std::shared_ptr<Media::PixelMap> pixelMap,std::string matedata,sptr<IRemoteBoomerangCallback> callback)149 int32_t IntentionManager::BoomerangEncodeImage(std::shared_ptr<Media::PixelMap> pixelMap, std::string matedata,
150 sptr<IRemoteBoomerangCallback> callback)
151 {
152 return boomerang_.BoomerangEncodeImage(pixelMap, matedata, callback);
153 }
154
BoomerangDecodeImage(std::shared_ptr<Media::PixelMap> pixelMap,sptr<IRemoteBoomerangCallback> callback)155 int32_t IntentionManager::BoomerangDecodeImage(std::shared_ptr<Media::PixelMap> pixelMap,
156 sptr<IRemoteBoomerangCallback> callback)
157 {
158 return boomerang_.BoomerangDecodeImage(pixelMap, callback);
159 }
160
GetDeviceStatusData(const Type type)161 Data IntentionManager::GetDeviceStatusData(const Type type)
162 {
163 return stationary_.GetDeviceStatusData(type);
164 }
165
RegisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener,bool isCompatible)166 int32_t IntentionManager::RegisterCoordinationListener(
167 std::shared_ptr<ICoordinationListener> listener, bool isCompatible)
168 {
169 CALL_INFO_TRACE;
170 #ifdef OHOS_BUILD_ENABLE_COORDINATION
171 InitClient();
172 return cooperate_.RegisterListener(listener, isCompatible);
173 #else
174 FI_HILOGW("Coordination does not support");
175 (void)(listener);
176 (void)(isCompatible);
177 return ERROR_UNSUPPORT;
178 #endif // OHOS_BUILD_ENABLE_COORDINATION
179 }
180
UnregisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener,bool isCompatible)181 int32_t IntentionManager::UnregisterCoordinationListener(
182 std::shared_ptr<ICoordinationListener> listener, bool isCompatible)
183 {
184 CALL_INFO_TRACE;
185 #ifdef OHOS_BUILD_ENABLE_COORDINATION
186 return cooperate_.UnregisterListener(listener, isCompatible);
187 #else
188 FI_HILOGW("Coordination does not support");
189 (void)(listener);
190 (void)(isCompatible);
191 return ERROR_UNSUPPORT;
192 #endif // OHOS_BUILD_ENABLE_COORDINATION
193 }
194
PrepareCoordination(CooperateMsgInfoCallback callback,bool isCompatible)195 int32_t IntentionManager::PrepareCoordination(CooperateMsgInfoCallback callback, bool isCompatible)
196 {
197 CALL_INFO_TRACE;
198 #ifdef OHOS_BUILD_ENABLE_COORDINATION
199 InitClient();
200 return cooperate_.Enable(callback, isCompatible);
201 #else
202 FI_HILOGW("Coordination does not support");
203 (void)(callback);
204 (void)(isCompatible);
205 return ERROR_UNSUPPORT;
206 #endif // OHOS_BUILD_ENABLE_COORDINATION
207 }
208
UnprepareCoordination(CooperateMsgInfoCallback callback,bool isCompatible)209 int32_t IntentionManager::UnprepareCoordination(CooperateMsgInfoCallback callback, bool isCompatible)
210 {
211 CALL_INFO_TRACE;
212 #ifdef OHOS_BUILD_ENABLE_COORDINATION
213 InitClient();
214 return cooperate_.Disable(callback, isCompatible);
215 #else
216 FI_HILOGW("Coordination does not support");
217 (void)(callback);
218 (void)(isCompatible);
219 return ERROR_UNSUPPORT;
220 #endif // OHOS_BUILD_ENABLE_COORDINATION
221 }
222
ActivateCoordination(const std::string & remoteNetworkId,int32_t startDeviceId,CooperateMsgInfoCallback callback,bool isCompatible)223 int32_t IntentionManager::ActivateCoordination(const std::string &remoteNetworkId, int32_t startDeviceId,
224 CooperateMsgInfoCallback callback, bool isCompatible)
225 {
226 CALL_INFO_TRACE;
227 #ifdef OHOS_BUILD_ENABLE_COORDINATION
228 InitClient();
229 return cooperate_.Start(remoteNetworkId, startDeviceId, callback, isCompatible);
230 #else
231 FI_HILOGW("Coordination does not support");
232 (void)(remoteNetworkId);
233 (void)(startDeviceId);
234 (void)(callback);
235 (void)(isCompatible);
236 return ERROR_UNSUPPORT;
237 #endif // OHOS_BUILD_ENABLE_COORDINATION
238 }
239
ActivateCooperateWithOptions(const std::string & remoteNetworkId,int32_t startDeviceId,CooperateMsgInfoCallback callback,const CooperateOptions & options)240 int32_t IntentionManager::ActivateCooperateWithOptions(const std::string &remoteNetworkId,
241 int32_t startDeviceId, CooperateMsgInfoCallback callback, const CooperateOptions &options)
242 {
243 CALL_INFO_TRACE;
244 #ifdef OHOS_BUILD_ENABLE_COORDINATION
245 InitClient();
246 return cooperate_.StartWithOptions(remoteNetworkId, startDeviceId, callback, options);
247 #else
248 FI_HILOGW("Coordination does not support");
249 (void)(remoteNetworkId);
250 (void)(startDeviceId);
251 (void)(callback);
252 (void)(options);
253 return ERROR_UNSUPPORT;
254 #endif // OHOS_BUILD_ENABLE_COORDINATION
255 }
256
DeactivateCoordination(bool isUnchained,CooperateMsgInfoCallback callback,bool isCompatible)257 int32_t IntentionManager::DeactivateCoordination(bool isUnchained,
258 CooperateMsgInfoCallback callback, bool isCompatible)
259 {
260 CALL_INFO_TRACE;
261 #ifdef OHOS_BUILD_ENABLE_COORDINATION
262 InitClient();
263 return cooperate_.Stop(isUnchained, callback, isCompatible);
264 #else
265 FI_HILOGW("Coordination does not support");
266 (void)(callback);
267 (void)(isCompatible);
268 return ERROR_UNSUPPORT;
269 #endif // OHOS_BUILD_ENABLE_COORDINATION
270 }
271
GetCoordinationState(const std::string & networkId,std::function<void (bool)> callback,bool isCompatible)272 int32_t IntentionManager::GetCoordinationState(
273 const std::string &networkId, std::function<void(bool)> callback, bool isCompatible)
274 {
275 CALL_INFO_TRACE;
276 #ifdef OHOS_BUILD_ENABLE_COORDINATION
277 InitClient();
278 return cooperate_.GetCooperateState(networkId, callback, isCompatible);
279 #else
280 (void)(networkId);
281 (void)(callback);
282 (void)(isCompatible);
283 FI_HILOGW("Coordination does not support");
284 return ERROR_UNSUPPORT;
285 #endif // OHOS_BUILD_ENABLE_COORDINATION
286 }
287
GetCoordinationState(const std::string & udId,bool & state)288 int32_t IntentionManager::GetCoordinationState(const std::string &udId, bool &state)
289 {
290 CALL_INFO_TRACE;
291 #ifdef OHOS_BUILD_ENABLE_COORDINATION
292 InitClient();
293 return cooperate_.GetCooperateState(udId, state);
294 #else
295 (void)(udId);
296 (void)(state);
297 FI_HILOGW("Coordination does not support");
298 return ERROR_UNSUPPORT;
299 #endif // OHOS_BUILD_ENABLE_COORDINATION
300 }
301
RegisterEventListener(const std::string & networkId,std::shared_ptr<IEventListener> listener)302 int32_t IntentionManager::RegisterEventListener(const std::string &networkId, std::shared_ptr<IEventListener> listener)
303 {
304 CALL_INFO_TRACE;
305 #ifdef OHOS_BUILD_ENABLE_COORDINATION
306 InitClient();
307 return cooperate_.RegisterEventListener(networkId, listener);
308 #else
309 (void)(networkId);
310 (void)(listener);
311 FI_HILOGW("Coordination does not support");
312 return ERROR_UNSUPPORT;
313 #endif // OHOS_BUILD_ENABLE_COORDINATION
314 }
315
UnregisterEventListener(const std::string & networkId,std::shared_ptr<IEventListener> listener)316 int32_t IntentionManager::UnregisterEventListener(const std::string &networkId,
317 std::shared_ptr<IEventListener> listener)
318 {
319 CALL_INFO_TRACE;
320 #ifdef OHOS_BUILD_ENABLE_COORDINATION
321 InitClient();
322 return cooperate_.UnregisterEventListener(networkId, listener);
323 #else
324 (void)(networkId);
325 (void)(listener);
326 FI_HILOGW("Coordination does not support");
327 return ERROR_UNSUPPORT;
328 #endif // OHOS_BUILD_ENABLE_COORDINATION
329 }
330
SetDamplingCoefficient(uint32_t direction,double coefficient)331 int32_t IntentionManager::SetDamplingCoefficient(uint32_t direction, double coefficient)
332 {
333 CALL_INFO_TRACE;
334 #ifdef OHOS_BUILD_ENABLE_COORDINATION
335 InitClient();
336 return cooperate_.SetDamplingCoefficient(direction, coefficient);
337 #else
338 (void)(direction);
339 (void)(coefficient);
340 FI_HILOGW("Coordination does not support");
341 return ERROR_UNSUPPORT;
342 #endif // OHOS_BUILD_ENABLE_COORDINATION
343 }
344
UpdateDragStyle(DragCursorStyle style,int32_t eventId)345 int32_t IntentionManager::UpdateDragStyle(DragCursorStyle style, int32_t eventId)
346 {
347 CALL_DEBUG_ENTER;
348 return drag_.UpdateDragStyle(style, eventId);
349 }
350
StartDrag(const DragData & dragData,std::shared_ptr<IStartDragListener> listener)351 int32_t IntentionManager::StartDrag(const DragData &dragData, std::shared_ptr<IStartDragListener> listener)
352 {
353 CALL_DEBUG_ENTER;
354 InitClient();
355 return drag_.StartDrag(dragData, listener);
356 }
357
StopDrag(const DragDropResult & dropResult)358 int32_t IntentionManager::StopDrag(const DragDropResult &dropResult)
359 {
360 CALL_DEBUG_ENTER;
361 return drag_.StopDrag(dropResult);
362 }
363
GetDragTargetPid()364 int32_t IntentionManager::GetDragTargetPid()
365 {
366 CALL_DEBUG_ENTER;
367 return drag_.GetDragTargetPid();
368 }
369
GetUdKey(std::string & udKey)370 int32_t IntentionManager::GetUdKey(std::string &udKey)
371 {
372 CALL_DEBUG_ENTER;
373 return drag_.GetUdKey(udKey);
374 }
375
AddDraglistener(DragListenerPtr listener,bool isJsCaller)376 int32_t IntentionManager::AddDraglistener(DragListenerPtr listener, bool isJsCaller)
377 {
378 CALL_DEBUG_ENTER;
379 InitClient();
380 return drag_.AddDraglistener(listener, isJsCaller);
381 }
382
RemoveDraglistener(DragListenerPtr listener,bool isJsCaller)383 int32_t IntentionManager::RemoveDraglistener(DragListenerPtr listener, bool isJsCaller)
384 {
385 CALL_DEBUG_ENTER;
386 return drag_.RemoveDraglistener(listener, isJsCaller);
387 }
388
AddSubscriptListener(SubscriptListenerPtr listener)389 int32_t IntentionManager::AddSubscriptListener(SubscriptListenerPtr listener)
390 {
391 CALL_DEBUG_ENTER;
392 InitClient();
393 return drag_.AddSubscriptListener(listener);
394 }
395
RemoveSubscriptListener(SubscriptListenerPtr listener)396 int32_t IntentionManager::RemoveSubscriptListener(SubscriptListenerPtr listener)
397 {
398 CALL_DEBUG_ENTER;
399 return drag_.RemoveSubscriptListener(listener);
400 }
401
SetDragWindowVisible(bool visible,bool isForce,const std::shared_ptr<Rosen::RSTransaction> & rsTransaction)402 int32_t IntentionManager::SetDragWindowVisible(
403 bool visible, bool isForce, const std::shared_ptr<Rosen::RSTransaction>& rsTransaction)
404 {
405 CALL_DEBUG_ENTER;
406 return drag_.SetDragWindowVisible(visible, isForce, rsTransaction);
407 }
408
GetShadowOffset(ShadowOffset & shadowOffset)409 int32_t IntentionManager::GetShadowOffset(ShadowOffset &shadowOffset)
410 {
411 CALL_DEBUG_ENTER;
412 return drag_.GetShadowOffset(shadowOffset);
413 }
414
UpdateShadowPic(const ShadowInfo & shadowInfo)415 int32_t IntentionManager::UpdateShadowPic(const ShadowInfo &shadowInfo)
416 {
417 CALL_DEBUG_ENTER;
418 return drag_.UpdateShadowPic(shadowInfo);
419 }
420
GetDragData(DragData & dragData)421 int32_t IntentionManager::GetDragData(DragData &dragData)
422 {
423 CALL_DEBUG_ENTER;
424 return drag_.GetDragData(dragData);
425 }
426
GetDragState(DragState & dragState)427 int32_t IntentionManager::GetDragState(DragState &dragState)
428 {
429 CALL_DEBUG_ENTER;
430 return drag_.GetDragState(dragState);
431 }
432
GetDragAction(DragAction & dragAction)433 int32_t IntentionManager::GetDragAction(DragAction &dragAction)
434 {
435 CALL_DEBUG_ENTER;
436 return drag_.GetDragAction(dragAction);
437 }
438
GetExtraInfo(std::string & extraInfo)439 int32_t IntentionManager::GetExtraInfo(std::string &extraInfo)
440 {
441 CALL_DEBUG_ENTER;
442 return drag_.GetExtraInfo(extraInfo);
443 }
444
AddHotAreaListener(std::shared_ptr<IHotAreaListener> listener)445 int32_t IntentionManager::AddHotAreaListener(std::shared_ptr<IHotAreaListener> listener)
446 {
447 CALL_DEBUG_ENTER;
448 #ifdef OHOS_BUILD_ENABLE_COORDINATION
449 InitClient();
450 return cooperate_.AddHotAreaListener(listener);
451 #else
452 FI_HILOGW("Coordination does not support");
453 (void)(listener);
454 return ERROR_UNSUPPORT;
455 #endif // OHOS_BUILD_ENABLE_COORDINATION
456 }
457
RemoveHotAreaListener(std::shared_ptr<IHotAreaListener> listener)458 int32_t IntentionManager::RemoveHotAreaListener(std::shared_ptr<IHotAreaListener> listener)
459 {
460 CALL_DEBUG_ENTER;
461 #ifdef OHOS_BUILD_ENABLE_COORDINATION
462 return cooperate_.RemoveHotAreaListener(listener);
463 #else
464 FI_HILOGW("Coordination does not support");
465 (void)(listener);
466 return ERROR_UNSUPPORT;
467 #endif // OHOS_BUILD_ENABLE_COORDINATION
468 }
469
UpdatePreviewStyle(const PreviewStyle & previewStyle)470 int32_t IntentionManager::UpdatePreviewStyle(const PreviewStyle &previewStyle)
471 {
472 CALL_DEBUG_ENTER;
473 return drag_.UpdatePreviewStyle(previewStyle);
474 }
475
UpdatePreviewStyleWithAnimation(const PreviewStyle & previewStyle,const PreviewAnimation & animation)476 int32_t IntentionManager::UpdatePreviewStyleWithAnimation(const PreviewStyle &previewStyle,
477 const PreviewAnimation &animation)
478 {
479 CALL_DEBUG_ENTER;
480 return drag_.UpdatePreviewStyleWithAnimation(previewStyle, animation);
481 }
482
RotateDragWindowSync(const std::shared_ptr<Rosen::RSTransaction> & rsTransaction)483 int32_t IntentionManager::RotateDragWindowSync(const std::shared_ptr<Rosen::RSTransaction>& rsTransaction)
484 {
485 CALL_DEBUG_ENTER;
486 if (isScreenRotation_) {
487 FI_HILOGW("Screen rotation, not need rotate drag window");
488 return RET_OK;
489 }
490 if (Rosen::DisplayManager::GetInstance().IsFoldable()) {
491 if ((foldRotatePolicys_.empty()) || (foldRotatePolicys_.size() < POLICY_VEC_SIZE)) {
492 FI_HILOGE("foldRotatePolicys_ is invalid");
493 return drag_.RotateDragWindowSync(rsTransaction);
494 }
495 Rosen::FoldStatus foldStatus = Rosen::DisplayManager::GetInstance().GetFoldStatus();
496 if (IsSecondaryDevice()) {
497 bool isExpand = (foldStatus == Rosen::FoldStatus::EXPAND || foldStatus == Rosen::FoldStatus::HALF_FOLD ||
498 foldStatus == Rosen::FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_EXPAND ||
499 foldStatus == Rosen::FoldStatus::FOLD_STATE_EXPAND_WITH_SECOND_HALF_FOLDED ||
500 foldStatus == Rosen::FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_EXPAND ||
501 foldStatus == Rosen::FoldStatus::FOLD_STATE_HALF_FOLDED_WITH_SECOND_HALF_FOLDED);
502 bool isFold = (foldStatus == Rosen::FoldStatus::FOLDED ||
503 foldStatus == Rosen::FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_EXPAND ||
504 foldStatus == Rosen::FoldStatus::FOLD_STATE_FOLDED_WITH_SECOND_HALF_FOLDED);
505 if ((isExpand && (foldRotatePolicys_[INDEX_EXPAND] == SCREEN_ROTATION)) ||
506 (isFold && (foldRotatePolicys_[INDEX_FOLDED] == SCREEN_ROTATION))) {
507 FI_HILOGD("Secondary device Full display rotation, not need rotate drag window");
508 return RET_OK;
509 }
510 } else {
511 if ((((foldStatus == Rosen::FoldStatus::EXPAND) || (foldStatus == Rosen::FoldStatus::HALF_FOLD)) &&
512 (foldRotatePolicys_[INDEX_EXPAND] == SCREEN_ROTATION)) ||
513 ((foldStatus == Rosen::FoldStatus::FOLDED) && (foldRotatePolicys_[INDEX_FOLDED] == SCREEN_ROTATION))) {
514 FI_HILOGD("Full display rotation, not need rotate drag window");
515 return RET_OK;
516 }
517 }
518 }
519 return drag_.RotateDragWindowSync(rsTransaction);
520 }
521
SetDragWindowScreenId(uint64_t displayId,uint64_t screenId)522 int32_t IntentionManager::SetDragWindowScreenId(uint64_t displayId, uint64_t screenId)
523 {
524 CALL_DEBUG_ENTER;
525 return drag_.SetDragWindowScreenId(displayId, screenId);
526 }
527
GetDragSummary(std::map<std::string,int64_t> & summarys,bool isJsCaller)528 int32_t IntentionManager::GetDragSummary(std::map<std::string, int64_t> &summarys, bool isJsCaller)
529 {
530 CALL_DEBUG_ENTER;
531 return drag_.GetDragSummary(summarys, isJsCaller);
532 }
533
SetDragSwitchState(bool enable,bool isJsCaller)534 int32_t IntentionManager::SetDragSwitchState(bool enable, bool isJsCaller)
535 {
536 CALL_DEBUG_ENTER;
537 return drag_.SetDragSwitchState(enable, isJsCaller);
538 }
539
SetAppDragSwitchState(bool enable,const std::string & pkgName,bool isJsCaller)540 int32_t IntentionManager::SetAppDragSwitchState(bool enable, const std::string &pkgName, bool isJsCaller)
541 {
542 CALL_DEBUG_ENTER;
543 return drag_.SetAppDragSwitchState(enable, pkgName, isJsCaller);
544 }
545
EnterTextEditorArea(bool enable)546 int32_t IntentionManager::EnterTextEditorArea(bool enable)
547 {
548 CALL_DEBUG_ENTER;
549 return drag_.EnableUpperCenterMode(enable);
550 }
551
AddPrivilege()552 int32_t IntentionManager::AddPrivilege()
553 {
554 CALL_DEBUG_ENTER;
555 return drag_.AddPrivilege();
556 }
557
EraseMouseIcon()558 int32_t IntentionManager::EraseMouseIcon()
559 {
560 CALL_DEBUG_ENTER;
561 return drag_.EraseMouseIcon();
562 }
563
SetMouseDragMonitorState(bool state)564 int32_t IntentionManager::SetMouseDragMonitorState(bool state)
565 {
566 CALL_DEBUG_ENTER;
567 return drag_.SetMouseDragMonitorState(state);
568 }
569
OnConnected()570 void IntentionManager::OnConnected()
571 {
572 CALL_DEBUG_ENTER;
573
574 drag_.OnConnected();
575 cooperate_.OnConnected();
576 stationary_.OnConnected();
577 }
578
OnDisconnected()579 void IntentionManager::OnDisconnected()
580 {
581 CALL_DEBUG_ENTER;
582 drag_.OnDisconnected();
583 cooperate_.OnDisconnected();
584 }
585
SetDraggableState(bool state)586 int32_t IntentionManager::SetDraggableState(bool state)
587 {
588 CALL_DEBUG_ENTER;
589 return drag_.SetDraggableState(state);
590 }
591
GetAppDragSwitchState(bool & state)592 int32_t IntentionManager::GetAppDragSwitchState(bool &state)
593 {
594 CALL_DEBUG_ENTER;
595 return drag_.GetAppDragSwitchState(state);
596 }
597
SetDraggableStateAsync(bool state,int64_t downTime)598 void IntentionManager::SetDraggableStateAsync(bool state, int64_t downTime)
599 {
600 CALL_DEBUG_ENTER;
601 return drag_.SetDraggableStateAsync(state, downTime);
602 }
603
GetDragBundleInfo(DragBundleInfo & dragBundleInfo)604 int32_t IntentionManager::GetDragBundleInfo(DragBundleInfo &dragBundleInfo)
605 {
606 CALL_DEBUG_ENTER;
607 return drag_.GetDragBundleInfo(dragBundleInfo);
608 }
609
EnableInternalDropAnimation(const std::string & animationInfo)610 int32_t IntentionManager::EnableInternalDropAnimation(const std::string &animationInfo)
611 {
612 CALL_DEBUG_ENTER;
613 return drag_.EnableInternalDropAnimation(animationInfo);
614 }
615
IsDragStart()616 bool IntentionManager::IsDragStart()
617 {
618 CALL_DEBUG_ENTER;
619 return drag_.IsDragStart();
620 }
621
GetDragSummaryInfo(DragSummaryInfo & dragSummaryInfo)622 int32_t IntentionManager::GetDragSummaryInfo(DragSummaryInfo &dragSummaryInfo)
623 {
624 CALL_DEBUG_ENTER;
625 return drag_.GetDragSummaryInfo(dragSummaryInfo);
626 }
627
GetPageContent(const OnScreen::ContentOption & option,OnScreen::PageContent & pageContent)628 int32_t IntentionManager::GetPageContent(const OnScreen::ContentOption& option, OnScreen::PageContent& pageContent)
629 {
630 CALL_DEBUG_ENTER;
631 return onScreen_.GetPageContent(option, pageContent);
632 }
633
SendControlEvent(const OnScreen::ControlEvent & event)634 int32_t IntentionManager::SendControlEvent(const OnScreen::ControlEvent& event)
635 {
636 CALL_DEBUG_ENTER;
637 return onScreen_.SendControlEvent(event);
638 }
639 } // namespace DeviceStatus
640 } // namespace Msdp
641 } // namespace OHOS
642