1 /* 2 * Copyright (c) 2024 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_PROCESS_STATE_INFO_H 17 #define OHOS_MEMORY_MEMMGR_INNERKITS_MEM_MGR_PROCESS_STATE_INFO_H 18 19 #include <parcel.h> 20 namespace OHOS { 21 namespace Memory { 22 enum class ProcPriorityUpdateReason : uint32_t { 23 START_ABILITY = 0, 24 UNKNOWN, 25 }; 26 27 /** 28 * @class MemMgrProcessStateInfo 29 * 30 * @brief State info of process. 31 */ 32 class MemMgrProcessStateInfo : public Parcelable { 33 public: 34 /** 35 * @brief Default construct of MemMgrProcessStateInfo. 36 */ 37 MemMgrProcessStateInfo() = default; 38 /** 39 * @brief Construct of MemMgrProcessStateInfo. 40 * 41 * @param callerPid Process id of caller process. 42 * @param callerUid User id of caller process. 43 * @param pid Process id. 44 * @param uid User id. 45 * @param reason Reason of update process priority. 46 */ MemMgrProcessStateInfo(int32_t callerPid,int32_t callerUid,int32_t pid,int32_t uid,ProcPriorityUpdateReason reason)47 MemMgrProcessStateInfo(int32_t callerPid, int32_t callerUid, int32_t pid, int32_t uid, 48 ProcPriorityUpdateReason reason) 49 : callerPid_(callerPid), callerUid_(callerUid), pid_(pid), uid_(uid), reason_(reason) {}; 50 /** 51 * @brief Deconstruct of MemMgrProcessStateInfo. 52 */ 53 ~MemMgrProcessStateInfo() = default; 54 55 /** 56 * @brief Marshalling MemMgrProcessStateInfo. 57 * 58 * @param parcel Package of MemMgrProcessStateInfo. 59 * @return True means marshall success, false means marshall failed. 60 */ 61 virtual bool Marshalling(Parcel &parcel) const override; 62 /** 63 * @brief Unmarshalling MemMgrProcessStateInfo. 64 * 65 * @param parcel Package of MemMgrProcessStateInfo. 66 * @return MemMgrProcessStateInfo object. 67 */ 68 static MemMgrProcessStateInfo* Unmarshalling(Parcel &parcel); 69 70 int32_t callerPid_ {0}; 71 int32_t callerUid_ {0}; 72 int32_t pid_ {0}; 73 int32_t uid_ {0}; 74 ProcPriorityUpdateReason reason_ = ProcPriorityUpdateReason::UNKNOWN; 75 }; 76 } // namespace Memory 77 } // namespace OHOS 78 #endif // OHOS_MEMORY_MEMMGR_INNERKITS_MEM_MGR_PROCESS_STATE_INFO_H