1 /* 2 * Copyright (c) 2023 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 #ifndef OHOS_ROSEN_WINDOW_GROUP_MGR_H 17 #define OHOS_ROSEN_WINDOW_GROUP_MGR_H 18 19 #include <refbase.h> 20 #include <unordered_map> 21 22 #include "window_root.h" 23 #include "window_transition_info.h" 24 #include "wm_common.h" 25 #include "wm_occlusion_region.h" 26 27 namespace OHOS { 28 namespace Rosen { 29 class WindowGroupMgr : public RefBase { 30 public: WindowGroupMgr(sptr<WindowRoot> & root)31 explicit WindowGroupMgr(sptr<WindowRoot>& root) : windowRoot_(root) { 32 } 33 34 static constexpr int32_t DEFAULT_GROUP_ID = 0; 35 static constexpr int32_t START_GROUP_ID = 1; 36 static constexpr int32_t MAX_GROUP_NUM = 3; 37 38 static constexpr int32_t DEFAULT_MISSION_ID = -1; 39 40 WMError MoveMissionsToForeground(const std::vector<int32_t>& missionIds, int32_t topMissionId); 41 WMError MoveMissionsToBackground(const std::vector<int32_t>& missionIds, std::vector<int32_t>& result); 42 43 void OnWindowDestroyed(uint32_t windowId); 44 void OnDisplayStateChange(DisplayId defaultDisplayId, sptr<DisplayInfo> displayInfo, 45 const std::map<DisplayId, sptr<DisplayInfo>>& displayInfoMap, DisplayStateChangeType type); 46 47 private: 48 WMError MoveMissionToForeground(int32_t missionId); 49 sptr<WindowRoot> windowRoot_; 50 std::unordered_map<uint32_t, WindowMode> backupWindowModes_; 51 std::map<DisplayId, Rect> backupDividerWindowRect_; 52 DumpVector(std::vector<T> vec)53 template<typename T> std::string DumpVector(std::vector<T> vec) 54 { 55 std::stringstream oss; 56 oss << "[ "; 57 for (T& v : vec) { 58 oss << v << ", "; 59 } 60 oss << " ]"; 61 return oss.str(); 62 } 63 }; 64 65 } // Rosen 66 } // OHOS 67 #endif // OHOS_ROSEN_WINDOW_GROUP_MGR_H 68