[mobile] Remove password lockscreen
[apps/native/starter.git] / include / util.h
1 /*
2  * Copyright (c) 2000 - 2015 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 #ifndef __MENU_DAEMON_UTIL_H__
18 #define __MENU_DAEMON_UTIL_H__
19 #include <dlog.h>
20 #include <stdio.h>
21 #include <sys/time.h>
22 #include <app.h>
23
24 #define APP_TRAY_PKG_NAME "org.tizen.app-tray"
25 #define MENU_SCREEN_PKG_NAME "org.tizen.menu-screen"
26 #define PROVIDER_PKG_NAME "org.tizen.data-provider-master"
27 #define CLUSTER_HOME_PKG_NAME "org.tizen.cluster-home"
28 #define EASY_HOME_PKG_NAME "org.tizen.easy-home"
29 #define EASY_APPS_PKG_NAME "org.tizen.easy-apps"
30
31 #ifdef TIZEN_PROFILE_COMMON
32 #define HOMESCREEN_PKG_NAME MENU_SCREEN_PKG_NAME
33 #else
34 #define HOMESCREEN_PKG_NAME "org.tizen.homescreen-efl"
35 #endif
36
37 #define TASKMGR_PKG_NAME "org.tizen.task-mgr"
38 #define DEFAULT_TASKMGR_PKG_NAME "org.tizen.taskmgr"
39 #define CONF_PATH_NUMBER 1024
40
41 #define BUF_SIZE_16 16
42 #define BUF_SIZE_32 32
43 #define BUF_SIZE_128 128
44 #define BUF_SIZE_256 256
45 #define BUF_SIZE_512 512
46 #define BUF_SIZE_1024 1024
47
48
49 #ifdef  LOG_TAG
50 #undef  LOG_TAG
51 #define LOG_TAG "STARTER"
52 #endif
53
54 /* Log */
55 #if !defined(_W)
56 #define _W(fmt, arg...) LOGW("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
57 #endif
58
59 #if !defined(_D)
60 #define _D(fmt, arg...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
61 #endif
62
63 #if !defined(_I)
64 #define _I(fmt, arg...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
65 #endif
66
67 #if !defined(_E)
68 #define _E(fmt, arg...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
69 #endif
70
71 #if !defined(_SECURE_W)
72 #define _SECURE_W(fmt, arg...) SECURE_LOGW("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
73 #endif
74
75 #if !defined(_SECURE_D)
76 #define _SECURE_D(fmt, arg...) SECURE_LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
77 #endif
78
79 #if !defined(_SECURE_I)
80 #define _SECURE_I(fmt, arg...) SECURE_LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
81 #endif
82
83 #if !defined(_SECURE_E)
84 #define _SECURE_E(fmt, arg...) SECURE_LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##arg)
85 #endif
86
87 #define retv_if(expr, val) do { \
88         if(expr) { \
89                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
90                 return (val); \
91         } \
92 } while (0)
93
94 #define ret_if(expr) do { \
95         if(expr) { \
96                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
97                 return; \
98         } \
99 } while (0)
100
101 #define goto_if(expr, val) do { \
102         if(expr) { \
103                 _E("(%s) -> goto", #expr); \
104                 goto val; \
105         } \
106 } while (0)
107
108 #define break_if(expr) { \
109         if(expr) { \
110                 _E("(%s) -> break", #expr); \
111                 break; \
112         } \
113 }
114
115 #define continue_if(expr) { \
116         if(expr) { \
117                 _E("(%s) -> continue", #expr); \
118                 continue; \
119         } \
120 }
121
122 #define PRINT_TIME(str) do { \
123         struct timeval tv; \
124         gettimeofday(&tv, NULL); \
125         _D("[%s:%d] %s TIME=%u.%u", __func__, __LINE__, str, (int)tv.tv_sec, (int)tv.tv_usec); \
126 } while (0)
127
128 #define _F(fmt, arg...) do {            \
129         FILE *fp;\
130         fp = fopen("/var/log/starter.log", "a+");\
131         if (NULL == fp) break;\
132     fprintf(fp, "[%s:%d] "fmt"\n", __func__, __LINE__, ##arg); \
133         fclose(fp);\
134 } while (0)
135
136 #if !defined(_)
137 #define _(str) dgettext(PACKAGE, str)
138 #endif
139
140 #if !defined(S_)
141 #define S_(str) dgettext("sys_string", str)
142 #endif
143
144
145 #endif /* __MENU_DAEMON_UTIL_H__ */