1 /* 2 * Copyright (c) 2022 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_PROCESS_PRIORITY_INFO_H 17 #define OHOS_MEMORY_MEMMGR_PROCESS_PRIORITY_INFO_H 18 19 #include <set> 20 21 namespace OHOS { 22 namespace Memory { 23 constexpr int EXTENSION_STATUS_BIND_UNKOWN = 0; 24 constexpr int EXTENSION_STATUS_FG_BIND = 1; 25 constexpr int EXTENSION_STATUS_BG_BIND = 2; 26 constexpr int EXTENSION_STATUS_NO_BIND = 3; 27 28 class ProcessPriorityInfo { 29 public: 30 explicit ProcessPriorityInfo(pid_t pid, int bundleUid, int priority); 31 ProcessPriorityInfo(const ProcessPriorityInfo ©Process); 32 ~ProcessPriorityInfo(); 33 34 int uid_; 35 pid_t pid_; 36 int priority_; 37 bool isFreground; // true means freground, false means background 38 bool isBackgroundRunning; 39 bool isSuspendDelay; 40 bool isEventStart; 41 bool isDistDeviceConnected; 42 int extensionBindStatus; // 0: unkown, 1:fg bind, 2:bg bind, 3:no bind 43 std::set<int32_t> extensionConnectors; // contains all pid of connectors 44 45 void SetPriority(int targetPriority); 46 int32_t ExtensionConnectorsCount(); 47 void AddExtensionConnector(int32_t pid); 48 void RemoveExtensionConnector(int32_t pid); 49 bool ContainsConnector(int32_t pid); 50 std::string ConnectorsToString(); 51 }; 52 } // namespace Memory 53 } // namespace OHOS 54 #endif // OHOS_MEMORY_MEMMGR_PROCESS_PRIORITY_INFO_H 55