/* * Copyright (c) 2023 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_WINDOW_SCENE_SESSION_MANAGER_H #define OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_H #include #include "screenlock_manager_interface.h" #include "session_manager_service_interface.h" #include "mock_session_manager_service_interface.h" #include "zidl/scene_session_manager_interface.h" #include "zidl/screen_session_manager_interface.h" #include "wm_single_instance.h" namespace OHOS::Rosen { class SessionManager { WM_DECLARE_SINGLE_INSTANCE_BASE(SessionManager); public: void CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, sptr property, int32_t& persistentId, sptr& session, sptr token = nullptr); void DestroyAndDisconnectSpecificSession(const int32_t& persistentId); WMError UpdateProperty(sptr& property, WSPropertyChangeAction action); WMError SetSessionGravity(int32_t persistentId, SessionGravity gravity, uint32_t percent); WMError BindDialogTarget(uint64_t persistentId, sptr targetToken); void ClearSessionManagerProxy(); sptr GetSceneSessionManagerProxy(); sptr GetScreenSessionManagerProxy(); sptr GetScreenLockManagerProxy(); protected: SessionManager() = default; virtual ~SessionManager() = default; private: void InitSessionManagerServiceProxy(); void InitSceneSessionManagerProxy(); void InitScreenSessionManagerProxy(); void InitScreenLockManagerProxy(); sptr mockSessionManagerServiceProxy_ = nullptr; sptr sessionManagerServiceProxy_ = nullptr; sptr sceneSessionManagerProxy_ = nullptr; sptr screenSessionManagerProxy_ = nullptr; sptr screenLockManagerProxy_ = nullptr; std::shared_mutex proxyMutex_; }; } // namespace OHOS::Rosen #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_H