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_VISIBILITY_INFO_H 17 #define OHOS_ROSEN_WINDOW_VISIBILITY_INFO_H 18 19 #include "wm_common.h" 20 21 namespace OHOS::Rosen { 22 /** 23 * @enum WindowVisibilityState 24 * 25 * @brief Visibility state of a window 26 */ 27 enum WindowVisibilityState : uint32_t { 28 WINDOW_VISIBILITY_STATE_NO_OCCLUSION = 0, 29 WINDOW_VISIBILITY_STATE_PARTICALLY_OCCLUSION, 30 WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION, 31 WINDOW_LAYER_STATE_MAX 32 }; 33 34 /** 35 * @enum WindowLayerState 36 * 37 * @brief Layer state of a window 38 */ 39 enum WindowLayerState { 40 WINDOW_ALL_VISIBLE = 0, 41 WINDOW_SEMI_VISIBLE, 42 WINDOW_IN_VISIBLE, 43 WINDOW_LAYER_DRAWING, 44 WINDOW_LAYER_NO_DRAWING, 45 WINDOW_LAYER_UNKNOWN_STATE, 46 }; 47 48 /** 49 * @class WindowVisibilityInfo 50 * 51 * @brief Visibility info of window. 52 */ 53 class WindowVisibilityInfo : public Parcelable { 54 public: 55 /** 56 * @brief Default construct of WindowVisibilityInfo. 57 */ 58 WindowVisibilityInfo() = default; 59 /** 60 * @brief Construct of WindowVisibilityInfo. 61 * 62 * @param winId Window id. 63 * @param pid Process id. 64 * @param uid User id. 65 * @param visibility True means window is visible, false means the opposite. 66 * @param winType Type of window. 67 */ WindowVisibilityInfo(uint32_t winId,int32_t pid,int32_t uid,WindowVisibilityState visibilityState,WindowType winType)68 WindowVisibilityInfo(uint32_t winId, int32_t pid, int32_t uid, WindowVisibilityState visibilityState, 69 WindowType winType) : windowId_(winId), pid_(pid), uid_(uid), visibilityState_(visibilityState), 70 windowType_(winType) {}; 71 /** 72 * @brief Deconstruct of WindowVisibilityInfo. 73 */ 74 ~WindowVisibilityInfo() = default; 75 76 /** 77 * @brief Marshalling WindowVisibilityInfo. 78 * 79 * @param parcel Package of WindowVisibilityInfo. 80 * @return True means marshall success, false means marshall failed. 81 */ 82 virtual bool Marshalling(Parcel& parcel) const override; 83 /** 84 * @brief Unmarshalling WindowVisibilityInfo. 85 * 86 * @param parcel Package of WindowVisibilityInfo. 87 * @return WindowVisibilityInfo object. 88 */ 89 static WindowVisibilityInfo* Unmarshalling(Parcel& parcel); 90 91 uint32_t windowId_ { INVALID_WINDOW_ID }; 92 int32_t pid_ { 0 }; 93 int32_t uid_ { 0 }; 94 WindowVisibilityState visibilityState_ = WINDOW_LAYER_STATE_MAX; 95 WindowType windowType_ { WindowType::WINDOW_TYPE_APP_MAIN_WINDOW }; 96 }; 97 } // namespace OHOS::Rosen 98 #endif // OHOS_ROSEN_WINDOW_VISIBILITY_INFO_H