1ba5c3796Sopenharmony_ci/*
2ba5c3796Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3ba5c3796Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4ba5c3796Sopenharmony_ci * you may not use this file except in compliance with the License.
5ba5c3796Sopenharmony_ci * You may obtain a copy of the License at
6ba5c3796Sopenharmony_ci *
7ba5c3796Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8ba5c3796Sopenharmony_ci *
9ba5c3796Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10ba5c3796Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11ba5c3796Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12ba5c3796Sopenharmony_ci * See the License for the specific language governing permissions and
13ba5c3796Sopenharmony_ci * limitations under the License.
14ba5c3796Sopenharmony_ci */
15ba5c3796Sopenharmony_ci
16ba5c3796Sopenharmony_ci#ifndef OHOS_MEMORY_MEMMGR_INNERKITS_MEM_MGR_CONSTANT_H
17ba5c3796Sopenharmony_ci#define OHOS_MEMORY_MEMMGR_INNERKITS_MEM_MGR_CONSTANT_H
18ba5c3796Sopenharmony_ci
19ba5c3796Sopenharmony_ci#include <string>
20ba5c3796Sopenharmony_ci#include <map>
21ba5c3796Sopenharmony_ci
22ba5c3796Sopenharmony_cinamespace OHOS {
23ba5c3796Sopenharmony_cinamespace Memory {
24ba5c3796Sopenharmony_ci// system app
25ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_SYSTEM = -1000;
26ba5c3796Sopenharmony_ci//ondemand system app
27ba5c3796Sopenharmony_ciconstexpr int RECLAIM_ONDEMAND_SYSTEM = -900;
28ba5c3796Sopenharmony_ci// persist(killable) system app
29ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_KILLABLE_SYSTEM = -800;
30ba5c3796Sopenharmony_ci// foreground process priority
31ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_FOREGROUND = 0;
32ba5c3796Sopenharmony_ci// visible process priority
33ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_VISIBLE = 50;
34ba5c3796Sopenharmony_ci// perceived suspend delay case
35ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_BG_SUSPEND_DELAY = 100;
36ba5c3796Sopenharmony_ci// perceived background process priority
37ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_BG_PERCEIVED = 200;
38ba5c3796Sopenharmony_ci// background and connected by distribute device
39ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_BG_DIST_DEVICE = 260;
40ba5c3796Sopenharmony_ci// background priority
41ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_BACKGROUND = 400;
42ba5c3796Sopenharmony_ci// unknown process priority
43ba5c3796Sopenharmony_ciconstexpr int RECLAIM_PRIORITY_UNKNOWN = 1000;
44ba5c3796Sopenharmony_ci
45ba5c3796Sopenharmony_cienum class MemMgrErrorCode {
46ba5c3796Sopenharmony_ci    MEMMGR_SERVICE_ERR = 190900,
47ba5c3796Sopenharmony_ci};
48ba5c3796Sopenharmony_ci
49ba5c3796Sopenharmony_ciconst std::map<int, std::string> ReclaimPriorityMapping = {
50ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_SYSTEM, "System" },
51ba5c3796Sopenharmony_ci    { RECLAIM_ONDEMAND_SYSTEM, "OnDemand_system" },
52ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_KILLABLE_SYSTEM, "Persistent" },
53ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_FOREGROUND, "Foreground" },
54ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_VISIBLE, "visible" },
55ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_BG_SUSPEND_DELAY, "Suspend-delay" },
56ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_BG_PERCEIVED, "Perceived" },
57ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_BG_DIST_DEVICE, "Dist-device" },
58ba5c3796Sopenharmony_ci    { RECLAIM_PRIORITY_BACKGROUND, "Background" },
59ba5c3796Sopenharmony_ci};
60ba5c3796Sopenharmony_ci
61ba5c3796Sopenharmony_ciconst std::string RECLAIM_PRIORITY_UNKNOWN_DESC = "Undefined";
62ba5c3796Sopenharmony_cistd::string GetReclaimPriorityString(int32_t priority);
63ba5c3796Sopenharmony_ci} // namespace Memory
64ba5c3796Sopenharmony_ci} // namespace OHOS
65ba5c3796Sopenharmony_ci#endif // OHOS_MEMORY_MEMMGR_INNERKITS_MEM_MGR_CONSTANT_H
66