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_MEMORY_MEMMGR_INNERKITS_MEM_MGR_WINDOW_INFO_H 17 #define OHOS_MEMORY_MEMMGR_INNERKITS_MEM_MGR_WINDOW_INFO_H 18 19 #include <parcel.h> 20 namespace OHOS { 21 namespace Memory { 22 constexpr int INVALID_WINDOW_ID = 0; 23 /** 24 * @class MemMgrWindowInfo 25 * 26 * @brief Visibility info of window. 27 */ 28 class MemMgrWindowInfo : public Parcelable { 29 public: 30 /** 31 * @brief Default construct of MemMgrWindowInfo. 32 */ 33 MemMgrWindowInfo() = default; 34 /** 35 * @brief Construct of MemMgrWindowInfo. 36 * 37 * @param winId Window id. 38 * @param pid Process id. 39 * @param uid User id. 40 * @param visibility True means window is visible, false means the opposite. 41 */ MemMgrWindowInfo(uint32_t winId,int32_t pid,int32_t uid,bool visibility)42 MemMgrWindowInfo(uint32_t winId, int32_t pid, int32_t uid, bool visibility) 43 : windowId_(winId), pid_(pid), uid_(uid), isVisible_(visibility) {}; 44 /** 45 * @brief Deconstruct of MemMgrWindowInfo. 46 */ 47 ~MemMgrWindowInfo() = default; 48 49 /** 50 * @brief Marshalling MemMgrWindowInfo. 51 * 52 * @param parcel Package of MemMgrWindowInfo. 53 * @return True means marshall success, false means marshall failed. 54 */ 55 virtual bool Marshalling(Parcel &parcel) const override; 56 /** 57 * @brief Unmarshalling MemMgrWindowInfo. 58 * 59 * @param parcel Package of MemMgrWindowInfo. 60 * @return MemMgrWindowInfo object. 61 */ 62 static MemMgrWindowInfo* Unmarshalling(Parcel &parcel); 63 64 uint32_t windowId_ {INVALID_WINDOW_ID}; 65 int32_t pid_ {0}; 66 int32_t uid_ {0}; 67 bool isVisible_ {false}; 68 }; 69 } // namespace Memory 70 } // namespace OHOS 71 #endif // OHOS_MEMORY_MEMMGR_INNERKITS_MEM_MGR_WINDOW_INFO_H