/* * Copyright (c) 2025 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_UI_EFFECT_CONTROLLER_H #define OHOS_ROSEN_UI_EFFECT_CONTROLLER_H #include #include "ui_effect_controller_stub.h" namespace OHOS::Rosen { class UIEffectControllerClientDeath final : public IRemoteObject::DeathRecipient { public: using EraseUIEffectFunc = std::function; explicit UIEffectControllerClientDeath(const EraseUIEffectFunc& func): eraseFunc_(func) {}; void OnRemoteDied(const wptr& remote) override; private: EraseUIEffectFunc eraseFunc_; }; class UIEffectController : public UIEffectControllerStub { public: using SetParamsFunc = std::function)>; using AnimateToFunc = std::function, sptr, sptr)>; UIEffectController(int32_t id, const SetParamsFunc& paramCallback, const AnimateToFunc& animateCallback); WMError SetParams(const sptr& params) override; WMError AnimateTo(const sptr& params, const sptr& config, const sptr& interruptOption) override; void SetIsAliveInUI(bool state) { isAliveInUI_ = state; } private: SetParamsFunc setParamsCallback_ = nullptr; AnimateToFunc animateToCallback_ = nullptr; // unique id of ui effect controller int32_t id_; std::atomic isAliveInUI_ = false; }; } // namespace OHOS::Rosen #endif