• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RECALIM_PRIORITY_CONSTANTS_H
17 #define OHOS_MEMORY_MEMMGR_RECALIM_PRIORITY_CONSTANTS_H
18 
19 #include <map>
20 #include <string>
21 #include <set>
22 #include <sys/types.h>
23 
24 namespace OHOS {
25 namespace Memory {
26 // system app
27 constexpr int RECLAIM_PRIORITY_SYSTEM = -1000;
28 // foreground process priority
29 constexpr int RECLAIM_PRIORITY_FOREGROUND = 0;
30 // visible process priority
31 constexpr int RECLAIM_PRIORITY_VISIBLE = 1;
32 // perceived suspend delay case
33 constexpr int RECLAIM_PRIORITY_BG_SUSPEND_DELAY = 100;
34 // perceived background process priority
35 constexpr int RECLAIM_PRIORITY_BG_PERCEIVED = 200;
36 // background priority
37 constexpr int RECLAIM_PRIORITY_BACKGROUND = 400;
38 // frozen process priority
39 constexpr int RECLAIM_PRIORITY_FROZEN = 600;
40 // suspend process priority
41 constexpr int RECLAIM_PRIORITY_SUSPEND = 800;
42 // empty process priority
43 constexpr int RECLAIM_PRIORITY_EMPTY = 900;
44 // unknown process priority
45 constexpr int RECLAIM_PRIORITY_UNKNOWN = 1000;
46 
47 constexpr int RECLAIM_PRIORITY_MIN = -1000;
48 constexpr int RECLAIM_PRIORITY_MAX = 1000;
49 
50 constexpr std::string_view SYSTEM_UI_BUNDLE_NAME = "com.ohos.systemui";
51 constexpr std::string_view LAUNCHER_BUNDLE_NAME = "com.ohos.launcher";
52 
53 const int USER_ID_SHIFT = 200000;
54 
55 const int IGNORE_PID = -1;
56 
57 enum class AppStateUpdateReason {
58     CREATE_PROCESS = 0,
59     PROCESS_READY,
60     FOREGROUND,
61     BACKGROUND,
62     SUSPEND_DELAY_START,
63     SUSPEND_DELAY_END,
64     BACKGROUND_RUNNING_START,
65     BACKGROUND_RUNNING_END,
66     EVENT_START,
67     EVENT_END,
68     DATA_ABILITY_START,
69     DATA_ABILITY_END,
70     APPLICATION_SUSPEND,
71     PROCESS_TERMINATED,
72     OS_ACCOUNT_CHANGED,
73 };
74 
75 enum class BundleState {
76     STATE_DEFAULT = 0,
77     STATE_WAITING_FOR_KILL,
78 };
79 } // namespace Memory
80 } // namespace OHOS
81 #endif // OHOS_MEMORY_MEMMGR_RECALIM_PRIORITY_CONSTANTS_H
82