Release version 0.15.20
[platform/core/appfw/launchpad.git] / src / launchpad / inc / loader_info.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #pragma once
18
19 #include <stdbool.h>
20 #include <glib.h>
21 #include <bundle.h>
22
23 #define DEFAULT_CPU_THRESHOLD_MAX               90
24 #define DEFAULT_CPU_THRESHOLD_MIN               40
25
26 enum loader_method_e {
27         METHOD_TIMEOUT = 0x0001,
28         METHOD_VISIBILITY = 0x0002,
29         METHOD_DEMAND = 0x0004,
30         METHOD_REQUEST = 0x0010,
31         METHOD_AVAILABLE_MEMORY = 0x0020,
32         METHOD_TTL = 0x0040,
33         METHOD_OUT_OF_MEMORY = 0x0100,
34         METHOD_INSTALL = 0x0200,
35 };
36
37 typedef struct _loader_info {
38         int type;
39         char *name;
40         char *exe;
41         GList *app_types;
42         int detection_method;
43         int timeout_val;
44         char *hw_acc;
45         GList *alternative_loaders;
46         bundle *extra;
47         int cpu_threshold_max;
48         int cpu_threshold_min;
49         bool on_boot;
50         bool global;
51         bool app_exists;
52         int activation_method;
53         int deactivation_method;
54         unsigned int ttl;
55         bool is_hydra;
56         bool app_check;
57 } loader_info_t;
58
59 typedef void (*loader_info_foreach_cb)(loader_info_t *info, void *data);
60
61 GList *_loader_info_load_dir(const char *path);
62 GList *_loader_info_load_file(GList *list, const char *path);
63 GList *_loader_info_unload(GList *list, const char *loader_name);
64 void _loader_info_dispose(GList *info);
65 int _loader_info_find_type(GList *info, const char *app_type, bool hwacc);
66 int _loader_info_find_type_by_loader_name(GList *info, const char *loader_name);
67 const char* _loader_info_find_loader_path_by_loader_name(GList *info, const char *loader_name);
68 loader_info_t* _loader_info_find_loader_by_loader_name(GList *info, const char *loader_name);
69 int *_loader_get_alternative_types(GList *info, int type, int *len);
70 int _loader_info_foreach(GList *info, loader_info_foreach_cb callback,
71                 void *data);
72 bool _loader_info_exist_app_type(loader_info_t *info, const char *app_type);