676455477b8d3c8a8e57ef8319ac8b58a327f542
[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          * start terminating application
43          */
44         RESOURCED_NOTIFIER_APP_TERMINATE_START,
45         /*
46          * finished application termination
47          */
48         RESOURCED_NOTIFIER_APP_TERMINATED,
49
50         /*
51          * suspend background application
52          */
53         RESOURCED_NOTIFIER_APP_WAKEUP,
54         RESOURCED_NOTIFIER_APP_SUSPEND_READY,
55         RESOURCED_NOTIFIER_APP_SUSPEND,
56
57         /*
58          * group some applications
59          */
60         RESOURCED_NOTIFIER_APP_GROUP,
61
62         /*
63          * service status
64          */
65         RESOURCED_NOTIFIER_SERVICE_LAUNCH,
66         RESOURCED_NOTIFIER_SERVICE_WAKEUP,
67
68         /*
69          * widget status
70          */
71         RESOURCED_NOTIFIER_WIDGET_FOREGRD,
72         RESOURCED_NOTIFIER_WIDGET_BACKGRD,
73
74         /*
75          * control resourced module
76          */
77         RESOURCED_NOTIFIER_FREEZER_CGROUP_STATE,
78         RESOURCED_NOTIFIER_SWAP_START,
79         RESOURCED_NOTIFIER_SWAP_UNSET_LIMIT,
80         RESOURCED_NOTIFIER_SWAP_ACTIVATE,
81         RESOURCED_NOTIFIER_SWAP_COMPACT,
82         RESOURCED_NOTIFIER_LOGGING_START,
83         RESOURCED_NOTIFIER_LOGGING_WRITE,
84         RESOURCED_NOTIFIER_DATA_UPDATE,
85         RESOURCED_NOTIFIER_DATA_RESET,
86         RESOURCED_NOTIFIER_CONTROL_EXCLUDE,
87         RESOURCED_NOTIFIER_MEM_LEVEL_CHANGED,
88         RESOURCED_NOTIFIER_MEM_CONTROL,
89         RESOURCED_NOTIFIER_LIMIT_APP,
90         RESOURCED_NOTIFIER_THROTTLING_RESOURCE,
91         RESOURCED_NOTIFIER_BOOSTING_RESOURCE,
92
93         /*
94          * control system service (*.service)
95          */
96         RESOURCED_NOTIFIER_SYSTEM_SERVICE,
97         RESOURCED_NOTIFIER_LIMIT_SYSTEM_SERVICE,
98
99
100
101         /*
102          * real time scheduler
103          */
104 //      RESOURCED_NOTIFIER_RT_SCHEDULER,
105
106         /*
107          * receive external event
108          */
109         RESOURCED_NOTIFIER_BOOTING_DONE,
110         RESOURCED_NOTIFIER_POWER_OFF,
111         RESOURCED_NOTIFIER_SYSTEMTIME_CHANGED,
112         RESOURCED_NOTIFIER_LOW_BATTERY,
113         RESOURCED_NOTIFIER_CPU_ON,
114         RESOURCED_NOTIFIER_CPU_OFF,
115         RESOURCED_NOTIFIER_LCD_ON,
116         RESOURCED_NOTIFIER_LCD_OFF,
117
118         RESOURCED_NOTIFIER_DEDUP_START,
119         RESOURCED_NOTIFIER_DEDUP_SCAN,
120         RESOURCED_NOTIFIER_DEDUP_STOP,
121
122         RESOURCED_NOTIFIER_MAX,
123 };
124
125 /*
126  * This is for internal callback method.
127  */
128 int register_notifier(enum notifier_type status, int (*func)(void *data));
129 int unregister_notifier(enum notifier_type status, int (*func)(void *data));
130 void resourced_notify(enum notifier_type status, void *value);
131
132 #ifdef __cplusplus
133 }
134 #endif /* __cplusplus */
135
136 #endif /* __NOTIFIER_H__ */