/* * Copyright (c) 2022 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 OHOS_ROSEN_REMOTE_ANIMATION_H #define OHOS_ROSEN_REMOTE_ANIMATION_H #include #include #include #include #include "wm_common.h" #include "window_controller.h" #include "window_node.h" #include "window_root.h" #include "window_transition_info.h" namespace OHOS { namespace Rosen { enum class TransitionEvent : uint32_t { APP_TRANSITION, HOME, MINIMIZE, CLOSE, BACK_TRANSITION, CLOSE_BUTTON, BACKGROUND_TRANSITION, UNKNOWN, }; class RemoteAnimation : public RefBase { public: RemoteAnimation() = delete; ~RemoteAnimation() = default; static bool CheckTransition(sptr srcInfo, const sptr& srcNode, sptr dstInfo, const sptr& dstNode); static TransitionEvent GetTransitionEvent(sptr srcInfo, sptr dstInfo, const sptr& srcNode, const sptr& dstNode); static WMError SetWindowAnimationController(const sptr& controller); static WMError NotifyAnimationTransition(sptr srcInfo, sptr dstInfo, const sptr& srcNode, const sptr& dstNode); static WMError NotifyAnimationMinimize(sptr srcInfo, const sptr& srcNode); static WMError NotifyAnimationClose(sptr srcInfo, const sptr& srcNode, TransitionEvent event); static WMError NotifyAnimationBackTransition(sptr srcInfo, sptr dstInfo, const sptr& srcNode, const sptr& dstNode, const TransitionEvent event); static void NotifyAnimationUpdateWallpaper(sptr node); static void OnRemoteDie(const sptr& remoteObject); static bool CheckAnimationController(); static bool CheckRemoteAnimationEnabled(DisplayId displayId); static void NotifyAnimationAbilityDied(sptr info); static WMError NotifyAnimationByHome(); static WMError NotifyAnimationScreenUnlock(std::function callback, sptr node); static void SetMainTaskHandler(std::shared_ptr handler); static void NotifyAnimationTargetsUpdate(std::vector& fullScreenWinIds, std::vector& floatWinIds); static void SetAnimationFirst(bool animationFirst); static void SetWindowControllerAndRoot(const sptr& windowController, const sptr& windowRoot); static bool IsRemoteAnimationEnabledAndFirst(DisplayId displayId = 0); static void CallbackTimeOutProcess(); static sptr CreateAnimationFinishedCallback( const std::function& callback, sptr windowNode); static WMError GetWindowAnimationTargets(std::vector missionIds, std::vector>& targets); static inline bool IsAnimationFirst() { return animationFirst_; } static bool isRemoteAnimationEnable_; private: static sptr CreateWindowAnimationTarget(sptr info, const sptr& windowNode); static WMError NotifyAnimationStartApp(sptr srcInfo, const sptr& srcNode, const sptr& dstNode, sptr& dstTarget, sptr& finishedCallback); static sptr CreateShowAnimationFinishedCallback( const sptr& srcNode, const sptr& dstNode, bool needMinimizeSrcNode); static sptr CreateHideAnimationFinishedCallback( const sptr& srcNode, TransitionEvent event); static void ProcessNodeStateTask(sptr& node); static void GetExpectRect(const sptr& dstNode, const sptr& dstTarget); static void PostProcessShowCallback(const sptr& node); static void ExecuteFinalStateTask(sptr& node); static void GetAnimationTargetsForHome(std::vector>& animationTargets, std::vector> needMinimizeAppNodes); static sptr GetTransitionFinishedCallback( const sptr& srcNode, const sptr& dstNode); static sptr windowAnimationController_; static wptr windowRoot_; static std::weak_ptr wmsTaskHandler_; static wptr windowController_; static bool animationFirst_; static std::atomic allocationId_; }; } // Rosen } // OHOS #endif // OHOS_ROSEN_REMOTE_ANIMATION_H