cpu-sched: Add background notifiers for fixed oom score app
[platform/core/system/resourced.git] / src / common / notifier.h
1 /*
2  * resourced
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20
21 #ifndef __NOTIFIER_H__
22 #define __NOTIFIER_H__
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 enum notifier_type {
29         /*
30          * application status
31          */
32         RESOURCED_NOTIFIER_APP_LAUNCH,
33         RESOURCED_NOTIFIER_APP_RESUME,
34         RESOURCED_NOTIFIER_APP_FOREGRD,
35         RESOURCED_NOTIFIER_APP_BACKGRD,
36         RESOURCED_NOTIFIER_APP_BACKGRD_ACTIVE,
37         RESOURCED_NOTIFIER_APP_ACTIVE,
38         RESOURCED_NOTIFIER_APP_INACTIVE,
39         RESOURCED_NOTIFIER_APP_PRELAUNCH,
40         RESOURCED_NOTIFIER_APP_ANR,
41
42         /**
43          * FIXME: It is temporary notifier to update cpu affinity for
44          * background app with fixed oom score.
45          */
46         RESOURCED_NOTIFIER_APP_BACKGRD_WITH_FIXED_OOM_SCORE,
47         /*
48          * start terminating application
49          */
50         RESOURCED_NOTIFIER_APP_TERMINATE_START,
51         /*
52          * finished application termination
53          */
54         RESOURCED_NOTIFIER_APP_TERMINATED,
55
56         /*
57          * suspend background application
58          */
59         RESOURCED_NOTIFIER_APP_WAKEUP,
60         RESOURCED_NOTIFIER_APP_SUSPEND_READY,
61         RESOURCED_NOTIFIER_APP_SUSPEND,
62
63         /*
64          * group some applications
65          */
66         RESOURCED_NOTIFIER_APP_GROUP,
67
68         /*
69          * service status
70          */
71         RESOURCED_NOTIFIER_SERVICE_LAUNCH,
72         RESOURCED_NOTIFIER_SERVICE_WAKEUP,
73
74         /*
75          * widget status
76          */
77         RESOURCED_NOTIFIER_WIDGET_FOREGRD,
78         RESOURCED_NOTIFIER_WIDGET_BACKGRD,
79
80         /*
81          * control resourced module
82          */
83         RESOURCED_NOTIFIER_FREEZER_CGROUP_STATE,
84         RESOURCED_NOTIFIER_SWAP_START,
85         RESOURCED_NOTIFIER_SWAP_UNSET_LIMIT,
86         RESOURCED_NOTIFIER_SWAP_ACTIVATE,
87         RESOURCED_NOTIFIER_SWAP_COMPACT,
88         RESOURCED_NOTIFIER_LOGGING_START,
89         RESOURCED_NOTIFIER_LOGGING_WRITE,
90         RESOURCED_NOTIFIER_DATA_UPDATE,
91         RESOURCED_NOTIFIER_DATA_RESET,
92         RESOURCED_NOTIFIER_CONTROL_EXCLUDE,
93         RESOURCED_NOTIFIER_MEM_LEVEL_CHANGED,
94         RESOURCED_NOTIFIER_MEM_CONTROL,
95         RESOURCED_NOTIFIER_LIMIT_APP,
96         RESOURCED_NOTIFIER_THROTTLING_RESOURCE,
97         RESOURCED_NOTIFIER_BOOSTING_RESOURCE,
98
99         /*
100          * control system service (*.service)
101          */
102         RESOURCED_NOTIFIER_SYSTEM_SERVICE,
103         RESOURCED_NOTIFIER_LIMIT_SYSTEM_SERVICE,
104
105
106
107         /*
108          * real time scheduler
109          */
110 //      RESOURCED_NOTIFIER_RT_SCHEDULER,
111
112         /*
113          * receive external event
114          */
115         RESOURCED_NOTIFIER_BOOTING_DONE,
116         RESOURCED_NOTIFIER_POWER_OFF,
117         RESOURCED_NOTIFIER_SYSTEMTIME_CHANGED,
118         RESOURCED_NOTIFIER_LOW_BATTERY,
119         RESOURCED_NOTIFIER_CPU_ON,
120         RESOURCED_NOTIFIER_CPU_OFF,
121         RESOURCED_NOTIFIER_LCD_ON,
122         RESOURCED_NOTIFIER_LCD_OFF,
123
124         RESOURCED_NOTIFIER_DEDUP_START,
125         RESOURCED_NOTIFIER_DEDUP_SCAN,
126         RESOURCED_NOTIFIER_DEDUP_STOP,
127
128         RESOURCED_NOTIFIER_MAX,
129 };
130
131 /*
132  * This is for internal callback method.
133  */
134 int register_notifier(enum notifier_type status, int (*func)(void *data));
135 int unregister_notifier(enum notifier_type status, int (*func)(void *data));
136 void resourced_notify(enum notifier_type status, void *value);
137
138 #ifdef __cplusplus
139 }
140 #endif /* __cplusplus */
141
142 #endif /* __NOTIFIER_H__ */